News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Order products by a custom field

Started by patben, May 15, 2013, 15:27:47 PM

Previous topic - Next topic

patben

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

balai


patben

with custom filters can I sort products with a custom field????

balai

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

patben

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


balai

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

patben

I have to make changes in this file only, administrator\components\com_virtuemart\models\product.php ?

balai

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

patben

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?