CMS MADE SIMPLE FORGE

Products

 

[#9651] Search for custom fields problems...

avatar
Created By: noosphere (noosphere)
Date Submitted: Wed Nov 06 11:15:59 -0500 2013

Assigned To: Robert Campbell (calguy1000)
Version: 2.20
CMSMS Version: 1.11.9
Severity: Major
Resolution: Fixed
State: Closed
Summary:
Search for custom fields problems...
Detailed Description:
Hi Robert, first of all thank you for the great module updates !

But apparently something is broken in the search:

{Products action="search" searchfield="field1,field2"}
shows all fields, not only field1 and 2.

Also on my install (not clean - but updated with last versions) when searching
for 2 or more custom fields with "All" option it doesn't return any results.

Take care,
Ed


History

Comments
avatar
Date: 2013-11-08 11:58
Posted By: dave (davidhans)

I have this problem also. I have 21 custom fields.  Could the large number of
fields be causing the "All" problem?
      
avatar
Date: 2013-11-15 03:41
Posted By: noosphere (noosphere)

I suspect there's something wrong with the "searchfield" selector and the db,
since all custom fields are shown but they're not used for search...so let's
wait for Robert to check everything ;-)
      
avatar
Date: 2014-05-02 09:37
Posted By: Julien (ThePrisoner)

Hi All

We still have a bug with the search functionnality with custom fields. 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 for this reason
that the search result is not good.

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.

Please CG, can u have a look on  this. Its not seems to be a big deal. And it
will fix a realy important functionality of you GREAT products module.
      
avatar
Date: 2014-05-21 18:00
Posted By: Robert Campbell (calguy1000)

fixed in svn, thanks.
      
Updates

Updated: 2014-09-27 09:12
state: Open => Closed

Updated: 2014-05-21 18:00
resolution_id: 5 => 7

Updated: 2013-11-22 05:38
resolution_id: => 5