0

I'm trying to display a little carousel in the top navigation, the .phtml file calls a static-block which calls a block:

{{block type="catalog/product_list" category_id="12" template="catalog/product/featured-products.phtml"}}

It works fine in homepage and category pages, but it fails to display this block in the product-view pages. Do you know why this is happening?.

Thanks .-

1 Answer 1

1

As far as I can tell, product listing won't show up in product view page unless the category_id is the same as the current product's category id.

If you open a product which belongs to category with id 12 it should show the block.

This is because of the code in magento's List.php:

if (Mage::registry('product')) {
                $categories = Mage::registry('product')->getCategoryCollection()
                    ->setPage(1, 1)
                    ->load();
                if ($categories->count()) {
                    $this->setCategoryId(current($categories->getIterator()));
                }
            }
2
  • Thanks. So there's no way to call a product list in product-view page?.
    – Guille
    Jun 5, 2014 at 17:39
  • You can create a new block overriding the product list block without these restriction in the code and call that block instead of the default product list block in the view page. Jun 6, 2014 at 1:10

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.