VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: patben on May 15, 2013, 15:27:47 PM

Title: Order products by a custom field
Post by: patben on May 15, 2013, 15:27:47 PM
Hi

I want to order the products in one category by a custom field is that posible??

For example i want to order books whith a custom field that is the year of the book release
Title: Re: Order products by a custom field
Post by: balai on May 15, 2013, 16:48:10 PM
You need a filtering extension.
Look here: http://breakdesigns.net/extensions/custom-filters
Title: Re: Order products by a custom field
Post by: patben on May 15, 2013, 17:01:21 PM
with custom filters can I sort products with a custom field????
Title: Re: Order products by a custom field
Post by: balai on May 15, 2013, 18:24:55 PM
oh sorry i thought you wanted to filter products by custom field.

To sort them by custom field i think that you should change the sql query in the category pages.
You can find it at the file: administrator\components\com_virtuemart\models\product.php

The function is the sortSearchListQuery
Title: Re: Order products by a custom field
Post by: patben on May 16, 2013, 15:59:43 PM
I would be obliged if you give me a little more information, because I could not understand how to do what im ask.

Thank you
Title: Re: Order products by a custom field
Post by: patben on June 18, 2013, 22:52:46 PM
any idea ?
Title: Re: Order products by a custom field
Post by: balai on June 19, 2013, 11:14:51 AM
It needs some sql knowledge.
You should join the query with the product_customfields table of the database and then change the order by to 1 of the fields of this table
Title: Re: Order products by a custom field
Post by: patben on June 19, 2013, 16:37:31 PM
I have to make changes in this file only, administrator\components\com_virtuemart\models\product.php ?
Title: Re: Order products by a custom field
Post by: balai on June 19, 2013, 16:42:36 PM
If you want to have your products to be sorted only by a custom field yes this file is enough.
If you want to have other sorting options too, you should add the sort by custom field option also to the drop-down list that regrads the sorting
Title: Re: Order products by a custom field
Post by: patben on June 25, 2013, 15:44:58 PM
i want i can choose sort by custom field in sort by page of settings of virtuemart but don't lost the other options of sort by. it is posible?