| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Items List sort on a Product Attribute | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Items List sort on a Product Attribute
I have gone through the doc on creating a new sort:
http://devs.x-cart.com/en/basics/itemslist_introduction_--_showing_products_on_a_page/adding_new_sort_by_option_to_itemslist.html I can successfully adjust this for stock level with p.amount. I was not able to come up with the correct method to do this for a product attribute. Is this possible? Thank you
__________________
sysp |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Items List sort on a Product Attribute
This will be trickier as attributes are a separate table that is not always linked (the "linkInner" and "linkLeft" methods) with the products table when querying the data.
If tables are not linked, you have to decorate the \XLite\Model\Repo\Product:: getQueryBuilderForSearch() method and link the tables manually. When calling linkInner() and linkLeft() methods, the second parameter is the alias that you should use to reference fields in that table. Please check the \XLite\Model\Repo\Order::getQueryBuilderForSearch( ) method for an example of linking extra tables. Another thing is that you need to determine the identifier of the attribute that you want to order products by.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|