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

VM 2.0.1 vmcustom plugin plgVmAddToSearch trigger problem

Started by tnyari, January 26, 2012, 16:17:55 PM

Previous topic - Next topic

tnyari

Since VM 2.0.1 the vmcustom plugin handling changed.
Now the plgVmAddToSearch trigger check the return value of a plugin, if it's false they will reset generic filters by $useCore variable.
The problem is, when the plgVmAddToSearch trigger called, the plugin can manipulate core sql in product model, but just only the where clause. This will always cause wrong sql query, because, the orderby field disabled by $useCore, and the ordeby field cannot modify by the plugin.
Here is the SQL when plgVmAddToSearch trigger called, and the return value is false:

SELECT SQL_CALC_FOUND_ROWS *
FROM `adxkl_virtuemart_products_hu_hu` as l JOIN `adxkl_virtuemart_products` AS p using (`virtuemart_product_id`)
LEFT JOIN `adxkl_virtuemart_product_customfields` as pf ON p.`virtuemart_product_id` = pf.`virtuemart_product_id`
WHERE ( <--- HERE COMES THE PLUGIN WHERE --->)
---->HERE IS THE PROBLEM: WE NEED HERE THE ORDERBY FIELD
ASC LIMIT 0, 10

The other problem with this, is the sql grouping. I write a plugin what want to use this trigger for advanced customfield search (eg. filter ranged values, or just filter single value or more values) i must disable $useCore, because the core customfield where clause only support "OR" between customfield values, and i need "AND" too...

In version 2.0.0 the plgVmAddToSearch  called after the core query builder but before a query. In this case i can manipulate the where clause in sql. So, my plugin worked with 2.0.0, and i don't have an idea how to write it to work with 2.0.1.

Can someone help me?