I’m setting up a new store using 1.4.1
I’m trying sort the products in the list by the subcategories they belong to. At the top of list.phtml is
$_productCollection=$this->getLoadedProductCollection();
I tried adding sort filters to that by adding the line
$_productCollection->setOrder('category_ids', 'asc')->setOrder('name', 'asc');
I also tried addAttributeToSort instead of setOrder. This doesn’t seem to have any effect. I’m guessing that $_productCollection is not a model I can sort in this manner. I have been digging around trying to find the correct place to apply the sort method without any success.
Can someone tell me the proper place to do this?
$this->getLoadedProductCollection();just returns the collection of products which are returned by the block from back-end.
if you want to add some custom code for the product collection then edit the file under the folder hierarchy
You will find the same named function i.e.
getLoadedProductCollection()track its working and finally you will find the solution.