Page 1 of 1

Products Custom Fields Search

Posted: Tue May 20, 2014 9:58 am
by MoltenCore
Hi Folks

I know it still have a bug with the search functionnality with custom fields on the PRODUCTS module. We cant make a succefull search with 2 or more custom fields. But I think I have found
where the problem come from.

Take this SQL query for exemple:

SELECT SQL_CALC_FOUND_ROWS C . * , PH.hierarchy_id
FROM cms_module_products C
LEFT JOIN cms_module_products_prodtohier PH ON PH.product_id = C.id
LEFT JOIN cms_module_products_fieldvals FVA ON C.id = FVA.product_id
AND FVA.fielddef_id =5
LEFT JOIN cms_module_products_fieldvals FVB ON C.id = FVB.product_id
AND FVB.fielddef_id =1
WHERE C.status = 'published'
AND (
FVA.value = 'tertiaire'
)
AND (
FVB.value = '1 pers.'
)ORDER
BY C.product_name ASC
LIMIT 0 , 10000

This is a SQL query from my site after a serach on ONLY 2 custom fields. I
notice that the values of FVA and FVB are wrong. they are inverted: FVA.value should be "1 pers." and FVB.value should be "tertiaire" (ou also can imagine that the fielddef_id are inverted instead of value).

This is the reason why the search result are never good with more than one custom fields.

I tried to look inside the PHP code of this module. The mistake seems to be related to class.products_resultset.php and the $fieldid, $fieldval variables. But I am not good enough in PHP object to find where it start to go wrong.

Its not seems to be a big deal for someone who understand the object logic. And it will fix a realy important functionality of you GREAT products module.

thx for any help

Re: Products Custom Fields Search

Posted: Tue May 20, 2014 10:37 am
by Jo Morg
If possible file a bug report here: http://dev.cmsmadesimple.org/bug/list/408
Give as much detailed information as possible for the developer to be able to reproduce the issue, and try to fix it, if it really is a bug.

Re: Products Custom Fields Search

Posted: Tue May 20, 2014 10:48 am
by MoltenCore
Thanks Jo

I already done it
http://dev.cmsmadesimple.org/bug/view/9651

But I request the Help of the community in case of CG have no time to give anymore to this module.