I am trying to display all products on my website in every category by descending SKU #'s. Can't seem to figure out how to do this, any ideas?
Asked
Active
Viewed 63 times
0
-
I'm voting to close this question as off-topic because Stack Overflow is a [programming-related](http://stackoverflow.com/help/on-topic) Q&A site. Your question is not about programming. Perhaps you should post it on http://magento.stackexchange.com instead? – Enigmativity Mar 27 '16 at 07:52
2 Answers
1
The following snippet will give you the collection you want, you may need to add pagination yourself if necessary.
$collection = Mage::getModel("catalog/product")->getCollection();
$collection->setOrder('sku', 'DESC');
You'll also need to join on any extra attributes with joinAttribute()
, since the catalog_product database storage follows the EAV pattern.

Matt O
- 1,336
- 2
- 10
- 19
-
Thanks Matt, do you know where I would add the snippet above? which file do I add that to? – Collin Mar 28 '16 at 23:17
0
I think this should help. Go to Admin->Catalog->Attributes->Manage
Attributes find SKU and enable SKU first. Then you have to go app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php.
Find at line 119 and change
protected $_direction = 'asc';
Change to
protected $_direction = 'desc';

Manish Jesani
- 1,339
- 5
- 20
- 36