Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing bestseller of each category in navigation in Magento 1.7
    primarykey
    data
    text
    <p>I'm looking for a possibility to get the most sold product by category to show it in a specific part of the navigation. To show the product(s) isn't the problem but getting them.</p> <p>I already did a intensive search through Google with different keywords but all I got were outdated plugins, modifications for bestseller.phtml (which doesn't exit in Magento 1.7 anymore) and setting filters on the resource model but I haven't found anymore which got me any result.</p> <p>So I tried to get the products by myself (so far, it just should get the sales of any product, not the best one):</p> <pre><code>$category-&gt;getId(); $children = $category-&gt;getChildren(); foreach($children as $child) { $childCategoryIdString = $child-&gt;getId(); $childCategoryId = substr($childCategoryIdString, 14); $childCategory = Mage::getModel('catalog/category') -&gt;load($childCategoryId); $productCollection = Mage::getModel('catalog/product') -&gt;getCollection() -&gt;addCategoryFilter($childCategory) -&gt;load(); $allIds = $productCollection-&gt;getAllIds(); for($i = 0; $i &lt; count($allIds); $i++) { $product = Mage::getModel('catalog/product')-&gt;load($allIds[$i]); echo $product-&gt;getOrderedQty() . '_'; } } </code></pre> <p>This has two issues: First it's making Magento yet slower. Second <code>$product-&gt;getOrderedQty()</code>, a method I have found in various results of my search, doesn't work. Now I don't really know what else I could try and looking for some help which is highly appreciated. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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