2

I'm having an issue with a product list that I insert in my homepage.

This list should display 22 products that I have registered on my category, but only 16 products are displayed. I check all my products and all of them are in the same category.

Also, I took a look into the phtml file and there isn't any restriction or limit about the quantity of products being displayed.

What can I do to fix this issue ?

UPDATE:

I include the code of the product list:

            <?php // Grid Mode ?>

            <?php $_collectionSize = $_productCollection->count() ?>
            <?php $_columnCount = $this->getColumnCount(); ?>
            <?php 
            if($baseconfig["productgridnumbercolumn"]) : 
                $_columnCount = $baseconfig["productgridnumbercolumn"];
            endif;
            ?>
            <ul class="products-grid">
                <?php  $i=0; $j=0; foreach ($_productCollection as $_product): 
                $product = Mage::getModel('catalog/product')->load($_product->getId());
                $attribute = $product->getResource()->getAttribute('label');
                if(is_object($attribute)){
                    $_options= $attribute->getSource()->getAllOptions(true, true);
                    foreach($_options as $option){
                        if ($option['value'] == $product->getData("label")){
                            $class =  $option['label'];
                        }
                    }         
                    $attdefaultvalue = $attribute->getDefaultValue();

                    $attributeValue =  $product->getlabel();
                    $attributeValueName = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('label');
                    if(strlen($attributeValue) &&  ($attdefaultvalue !== $attributeValue)) { 
                        $labeltype = $class;   
                        $labelname = $attributeValueName;     
                    } 
                    else {
                        $labeltype = "";
                    }
                }

                $_rowCount = ceil($_collectionSize/$_columnCount);
                if ($i%$_columnCount==0) : $j++; endif;
                if ($i++%$_columnCount==0): $width = 100; endif;
                if ($_columnCount):
                    $width = 100/$_columnCount;
                $width = "style=\"width:{$width}%;\"";  
                endif;
                $return = false;

                ?>
                <li class="item <?php if ($j==$_rowCount) : echo "item-row-last"; endif; ?> <?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>" <?php echo $width; ?>>
                    <div class="inner">
                        <!-- Product image -->
                        <div class="product-image">
                            <a title="<?php echo $this->htmlEscape($product->getName()) ?>" class="image-link" href="<?php echo $product->getProductUrl() ?>">
                            </a>
                            <?php if (isset($labeltype) && isset($labelname) && $showlabel): ?>
                                <span class="ico-label <?php echo $labeltype; ?>-label"><?php echo $labelname; ?></span>
                            <?php endif; ?>
                            <div class="actions">

                                <!-- Add to cart -->
                                <?php if ($product->isSaleable()): ?>
                                    <button class="button btn-cart"
                                    onclick="setLocation('<?php echo $this->getAddToCartUrl($product) ?>')">
                                    <span><?php echo $this->helper("catalog")->__('Add to Cart'); ?></span>
                                </button>
                            <?php else: ?>
                                <div class="out-of-stock"><?php echo $this->helper("catalog")->__('Out of stock'); ?></div>
                            <?php endif; ?>
                            <!-- Add to links -->
                            <ul class="add-to-links">
                                <?php if ($this->helper('wishlist')->isAllow()) : ?>
                                    <li>
                                        <a href="<?php echo $this->helper('wishlist')->getAddUrl($product); ?>" class="link-wishlist">
                                            <?php echo $this->__('Wishlist'); ?>
                                        </a>
                                    </li>
                                <?php endif; ?>
                                <?php if ($compareUrl = $this->getAddToCompareUrl($product)): ?>
                                    <li>
                                        <a href="<?php echo $compareUrl ?>" class="link-compare"><?php echo $this->__('Compare'); ?></a>
                                    </li>
                                <?php endif; ?>
                            </ul>
                        </div>
                    </div>
                    <center>
                        <a  class="product-name" href="<?php echo $product->getProductUrl() ?>"><?php echo $product->getName() ?></a>    
                        <?php echo $this->getPriceHtml($product, true, '_jmproduct_' . uniqid()); ?>
                    </center>
                    <?php  #echo $this->getReviewsSummaryHtml($product, true, true) ?>
                        <!--    <?php
                                    // if ($productlistdeslenght) :
                                    //  $productDesc = $product->getDescription();
                                    //  $productShortDesc = $product->getShortDescription();
                                ?>
                                    <p class="pdescription"><?php // echo substr(nl2br(strlen($productDesc) > 10 ? $productDesc : $productShortDesc), 0, $productlistdeslenght) . '...'; ?></p>
                                    <?php //endif; ?> -->
                                </div>
                            </li>
                        <?php endforeach ?>
                    </ul>
                    <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
                <?php endif; ?>
                <div class="toolbar-bottom">
                    <?php echo $this->getToolbarHtml() ?>
                </div>
            </div>
        <?php endif; ?>
    </div>
    <?php
// Provides a block where additional page components may be attached, primarily good for in-page JavaScript
    if ($this->getChild('after')) {
        $_afterChildren = $this->getChild('after')->getSortedChildren();
        foreach ($_afterChildren as $_afterChildName) {
            $_afterChild = $this->getChild('after')->getChild($_afterChildName);
        //set product collection on after blocks
            $_afterChild->setProductCollection($_productCollection);
            echo $_afterChild->toHtml();
        }
    }
    ?>
  • Are all products enabled, visible and in stock? – Fabian Schmengler Apr 5 '16 at 19:09
  • Please, update you question. Add the code of your block and template – Siarhey Uchukhlebau Apr 5 '16 at 19:20
  • @fschmengler - Yes, all the products are enabled, visible & with stock. – Ricardo DeLa Rosa Nieto Apr 5 '16 at 19:57
  • @SiarheyUchukhlebau - I've just update my question and include the code I'm using at this moment. – Ricardo DeLa Rosa Nieto Apr 5 '16 at 19:58
  • Please, check the result of the $_productCollection->getPageSize(); – Siarhey Uchukhlebau Apr 5 '16 at 20:04
2

Most likely the page size in your collection set to 16 by default. So in the place where collection is generated you need to change the default page size value to the value that you need or remove it at all if you want the whole collection to be loaded on one page without limit.

For example in order to set page size equals to 30 elements use $_productCollection->setPageSize(30); before collection is loaded (method load() is called)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.