Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So you're on the right path to look into core, if you want to copy some functional that is similar to the one from the basic Magento - like product listing.</p> <ol> <li>the price function <code>getPriceHtml</code> is a method defined in the abstract class <code>Mage_Catalog_Block_Product_Abstract</code>. So to use it, you need to extend your block from the <code>Mage_Catalog_Block_Product_Abstract</code> one.</li> <li><code>isSaleable</code> returned false because you didn't have some of the attributes joined to your collection.</li> </ol> <p>Here's how you should accomplish your goal, if you want to follow Magento's logic.</p> <ol> <li><p>Create your own module, or just block in <code>local/Mage/Catalog/Block/YourBlock.php</code>. This block should extend <code>Mage_Catalog_Block_Product_Abstract</code>. After that create a method in this block <code>getCustomProductCollection()</code>:</p> <pre><code>pubcli funciton getCustomProductCollection() { if (is_null($this-&gt;_productCollection)) { $category = Mage::getModel('catalog/category')-&gt;load(17); $layer = $this-&gt;getLayer(); $layer-&gt;setCurrentCategory($category); $this-&gt;_productCollection = $layer-&gt;getProductCollection(); } return $this-&gt;_productCollection; } </code></pre></li> <li><p>Now in your <code>phtml</code> file you'll just call for this method:</p> <pre><code>$productCollection = $this-&gt;getCustomProductCollection(); </code></pre></li> </ol> <p>And the rest of the code will work.</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