- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Category products on homepage
I am using the following widget to show products on my home page to show products from a category , the only thing is that the products are displayed in id descending order, so the newest first I want to sort them the opposite was, how do I change the sort order?
{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" show_pager="0" products_count="10" template="Magento_CatalogWidget:roduct/widget/content/grid.phtml" conditions_encoded="^[`1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,`aggregator`:`all`,`value`:`1`,`new_child`:``^],`1--1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,`attribute`:`category_ids`,`operator`:`==`,`value`:`3`^]^]" type_name="Catalog Products List"}}
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Category products on homepage
Hello @miller75
I understand the require which you are trying to achieve.
Actually have seen similar problem on a stackexchange and have proper solution for this - kindly find this link - https://magento.stackexchange.com/questions/127221/magento-2-catalog-product-list-widget-product-ord...
Here they have created a custom module to do this - and there is one github extension link to sort the same - https://github.com/rianorie/magento2-sortcatalogwidget
Try one of the solution and it will works !
Hope it helps !
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Category products on homepage
I have seen this but I am new to Magento so I wasn't sure what to do with it
Thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Category products on homepage
Hi @miller75
So now you have resolved your issue right ? if yest then accept answer as solution so other user gets helped on the same.
let me know if you still have any query on the same will glad to assist you more !
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Category products on homepage
Hello @miller75
Try to download the module from below link
https://github.com/rianorie/magento2-sortcatalogwidget
and install into app/code/Elastomatic/SortCatalogWidget
then after run setup upgrade command, now in widget you will get option to sort it
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Category products on homepage
Thanks for that, I have installed the module and the sort order is in the widget page. but when I add a sort it doesn't change the order of the products.
This is the widget code, could it be using the wrong template?
<p>{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" show_pager="0" products_count="10" template="Magento_CatalogWidget::product/widget/content/grid.phtml" cache_lifetime="2" sort_by="price" sort_direction="DESC" conditions_encoded="^[`1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,`aggregator`:`all`,`value`:`1`,`new_child`:``^],`1--1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,`attribute`:`category_ids`,`operator`:`==`,`value`:`3`^]^]" type_name="Catalog Products List"}}</p> <p></p>