Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Alright, well I found an answer that basically works through the lack of working and/or multiple category filtering. It's dirty, but works. It's based off a blog post from here: <a href="http://asia-connect.com.vn/2009/07/magento-filter-by-multiple-categories/" rel="nofollow">http://asia-connect.com.vn/2009/07/magento-filter-by-multiple-categories/</a></p> <p>I can't say I'm happy with this solution. I can't figure out why Magento would remove the ability to do filtering on Categories in a useful manner. The fact that it didn't appear to filter anything at all just compounded my issues. Feel free to chime in with a more sensible solution. I'd gladly replace this solution with it.</p> <pre><code>$products = Mage::getResourceModel('reports/product_collection') -&gt;addOrderedQty() -&gt;addAttributeToSelect('*') -&gt;addAttributeToSelect(array('name','small_image')) -&gt;setStoreId($storeId) -&gt;addStoreFilter($storeId) // -&gt;addCategoryFilter($category) -&gt;addViewsCount() -&gt;setPageSize($productCount); $alias = 'cat_index'; $categoryCondition = $products-&gt;getConnection()-&gt;quoteInto( $alias.'.product_id=e.entity_id AND '.$alias.'.store_id=? AND ', $storeId ); $cats = array( $category-&gt;getId() ); foreach($category-&gt;getChildren() as $catChild) { $cats[] = $catChild-&gt;getId(); } $categoryCondition.= $alias.'.category_id IN ('.implode(',',$cats).')'; $products-&gt;getSelect()-&gt;joinInner( array($alias =&gt; $products-&gt;getTable('catalog/category_product_index')), $categoryCondition, array('position'=&gt;'position') ); $products-&gt;_categoryIndexJoined = true; </code></pre>
    singulars
    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.
    1. VO
      singulars
      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