Hello,
in configuration i set ordering product by stock descending.
i need to add to the query, product_price asc and product_availability asc, simultaneously.
with debug i found this query:
SELECT SQL_CALC_FOUND_ROWS p.`virtuemart_product_id`
FROM `jos_virtuemart_products` as p
LEFT JOIN `jos_virtuemart_product_shoppergroups` as ps
ON p.`virtuemart_product_id` = `ps`.`virtuemart_product_id`
LEFT JOIN `jos_virtuemart_product_categories` as pc
ON p.`virtuemart_product_id` = `pc`.`virtuemart_product_id`
LEFT JOIN `jos_virtuemart_categories` as c
ON c.`virtuemart_category_id` = `pc`.`virtuemart_category_id`
WHERE ( `pc`.`virtuemart_category_id` = 152
AND `c`.`published` = 1
AND ( `ps`.`virtuemart_shoppergroup_id`= "108" OR `ps`.`virtuemart_shoppergroup_id` IS NULL )
AND p.`published`="1" )
group by p.`virtuemart_product_id`
ORDER BY `p`.product_in_stock DESC
LIMIT 0, 10
i hope that this is the right query that i have to modify.
in which file i can do this? and how?
thanks.
Yes, but not, if you change this directly in the model, this is applied in all product lists.(random, featured ...)
I understand. I would try anyway.
how can I do?
product.php in models folder function sortSearchListQuery
There are switches, you can add it there. You can also write a plugin, to modify the query.
This function works for all sorts or just research?
I can not understand what is the line to be changed
thanks.
imho for ALL product by cat displays, searches etc
I can not understand what is the line to be changed... sorry
search for the comment
// special orders case
in the product.php file
please... can you tell me the line specific that i need to modify?
Quote from: guardiano78 on September 15, 2015, 10:38:45 AM
please... can you tell me the line specific that i need to modify?
admin/components/virtuemart/models/product.php
Patrick, I told him already, the file and the function.
Quote from: Milbo on September 13, 2015, 22:09:16 PM
product.php in models folder function sortSearchListQuery
There are switches, you can add it there. You can also write a plugin, to modify the query.
guardiano78, There is no line to modify, you must change some more lines of the function, but as I said before, instead of hacking the core, you should write a plugin.
now I understand. thank you. :)