Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok, the solution for me was a custom module, which extends the List Functionality. I added the following file:</p> <blockquote> <p>/app/code/local/Mage/Catalog/Block/Product/List.php</p> </blockquote> <p>With the following extending code:</p> <pre><code>protected function _getProductCollectionSuggestion() { $layer = Mage::getSingleton('catalog/layer'); /* @var $layer Mage_Catalog_Model_Layer */ if ($this-&gt;getShowRootCategory()) { $this-&gt;setCategoryId(Mage::app()-&gt;getStore()-&gt;getRootCategoryId()); } // if this is a product view page if (Mage::registry('product')) { // get collection of categories this product is associated with $categories = Mage::registry('product')-&gt;getCategoryCollection() -&gt;setPage(1, 1) -&gt;load(); // if the product is associated with any category if ($categories-&gt;count()) { // show products from this category $this-&gt;setCategoryId(current($categories-&gt;getIterator())); } } $origCategory = null; if ($this-&gt;getCategoryId()) { $category = Mage::getModel('catalog/category')-&gt;load($this-&gt;getCategoryId()); if ($category-&gt;getId()) { $origCategory = $layer-&gt;getCurrentCategory(); $layer-&gt;setCurrentCategory($category); } } $this-&gt;_productCollection = $layer-&gt;getProductCollection(); $this-&gt;_productCollection-&gt;addAttributeToFilter('suggestion', 1); if($this-&gt;_productCollection-&gt;count()) { foreach($this-&gt;_productCollection as $_productKey =&gt; $_product) { if($_product-&gt;getSuggestion() == 0 || !$_product-&gt;getSuggestion()) { } } } $this-&gt;prepareSortableFieldsByCategory($layer-&gt;getCurrentCategory()); if ($origCategory) { $layer-&gt;setCurrentCategory($origCategory); } return $this-&gt;_productCollection; } </code></pre> <p>Then I loaded this method in the List.phtml and it worked :) Thanks for reading anyway! Maybe this code helps someone!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload