cancel
Showing results for 
Search instead for 
Did you mean: 

I can't sort products by price, please help

I can't sort products by price, please help

Hello, I am new on magento, I just start a week ago and a I have a strange ( for me ) trouble...

$category = Mage::getModel('catalog/category')->load(4);
            
$products = $category->getProductCollection()
                    ->addAttributeToSelect('name')
                    ->addAttributeToSelect('price')
                    ->addAttributeToSort('price', 'DESC');

I get all products from a category, and then I want to sorted by price, this is my code:

When I see the query is doing a join type inner with a table named "catalog_product_price_index" which is empty, you imagine my problem... I re-index the data via admin but still doesn't work.

Thanks.

 

1 REPLY

Re: I can't sort products by price, please help