0

I have made a download center component in joomla with the help of https://www.component-creator.com and everything worked fine until now. The component doesnt seem to want to show anymore items than 21 from the db, which is weird since i have 24 items in the database.

The component uses two tables. One for subjects and one for the downloads which then have an id for the subject it is connected to.

since there is a lot of code i have put it on github: https://github.com/strookers/com_dlcenter

this is the code from the model layer:

public function getEmner()
{
    $emner = parent::getItems();

    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    $query
        ->select($db->quoteName(array('id', 'ordering', 'state', 'checked_out', 'checked_out_time', 'created_by', 'title')))
        ->from('`#__dlcenter_emne`')
        ->order('ordering ASC');
    $db->setQuery($query);
    $emner = $db->loadObjectList();

    return $emner;
}

public function getDownloads()
{
    $downloads = parent::getItems();
    foreach($downloads as $item){


        if (isset($item->emneid) && $item->emneid != '') {
            if(is_object($item->emneid)){
                $item->emneid = JArrayHelper::fromObject($item->emneid);
            }
            $values = (is_array($item->emneid)) ? $item->emneid : explode(',',$item->emneid);

            $textValue = array();
            foreach ($values as $value){
                $db = JFactory::getDbo();
                $query = $db->getQuery(true);
                $query
                        ->select($db->quoteName('title'))
                        ->from('`#__dlcenter_emne`')
                        ->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                $db->setQuery($query);
                $results = $db->loadObject();
                if ($results) {
                    $textValue[] = $results->title;
                }
            }

        $item->emneid = !empty($textValue) ? implode(', ', $textValue) : $item->emneid;

        }
    }

    return $downloads;
}

And this is from the view layer:

<div class="neaccordion nevertical">
    <?php foreach ($this->emner as $i => $emne) : ?>
    <section id="<?php echo $emne->title; ?>">
        <h3><a href="#<?php echo $emne->title; ?>"><?php echo $emne->title; ?></a></h3>
        <table class="table table-striped" id = "downloadList" ><tbody>
        <?php foreach ($this->downloads as $i => $download) : ?>
            <?php
            if($download->emneid == $emne->title) :?>

            <tr>
                <td style="text-align: left; padding: 0px 0px 0px 10px; vertical-align: middle;">
                    <h4><?php echo $download->titel; ?></h4>
                </td>
                <td style="text-align: right; padding: 0px 10px 0px 0px; vertical-align: middle;">
                        <?php
                        if (!empty($download->download)):
                            $uploadPath = 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_dlcenter' . DIRECTORY_SEPARATOR . 'images/nordelektro/dlcenter' .DIRECTORY_SEPARATOR . $download->download;
                            echo '<a href="' . JRoute::_(JUri::base() . $uploadPath, false) . '" class="readmore" target="_blank" title="Hent fil" style="color: #fff;">Download</a>';
                        else:
                            echo $download->download;
                        endif; ?>
                </td>
            </tr>

            <?php endif; ?>
        <?php endforeach;?>
            </tbody></table>
    </section>
    <?php endforeach;?>
</div>

here is some images of the db:

Table for Subject

Table for Downloads

I have no idea where the problem is since it works fine until item 22. it seems to output every item in the database except the ones after item 21.

if any more information is needed, just ask.

user1438038
  • 5,821
  • 6
  • 60
  • 94
Michael Kirkegaard
  • 379
  • 1
  • 3
  • 14

1 Answers1

0

Off the top it looks like you have an issue with the pagination or the component filtering. I assume you are not seeing pagination once you have exceeded about 20 items. (your database shows one item is in a trashed state, your global settings is likely set to 20 items since that's all your seeing)

This could be an issue with your component, or an issue with your Joomla global settings.

If it's not your Joomla global settings, Check with the component-creator people they are usually fairly responsive to issues in their product.

Walt Sorensen
  • 381
  • 3
  • 14