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

Bug in Product Type Parameter processing (and quick fix)

Started by doorknob, August 13, 2008, 02:58:08 AM

Previous topic - Next topic

doorknob

The search by product type parameter facility uses the mysql function FIND_IN_SET() when searching 'multiple value' parameters. This function requires that the items in the set be separated by commas. The values in the product type parameter fields are separated by ';' and so the function fails. The routines that maintain parameter values must be changed to use commas as the separator when saving and retrieving values from 'multiple value' types. It would also make sense to also change the separator in the 'Possible Values' field to a comma to eliminate any errors that might be caused by having a comma embedded in a value.

Regards
Phil

As a short term solution (with potential performance penalty compared with a solution involving switching from semi-colon to comma separators) I have implemented the following changed to shop_browse_queries.php:

Line 227 changed from
$comp = "FIND_IN_SET('$get_item_value',`$parameter_name`)";

to
$comp = "FIND_IN_SET('$get_item_value',REPLACE(`$parameter_name`,';',','))";

and line 235 from
array_push($comp,"FIND_IN_SET('$value',`$parameter_name`)");

to
array_push($comp,"FIND_IN_SET('$value',REPLACE(`$parameter_name`,';',','))");


Regards
Phil



mylonojr

Quote from: doorknob on August 13, 2008, 02:58:08 AM
The search by product type parameter facility uses the mysql function FIND_IN_SET() when searching 'multiple value' parameters. This function requires that the items in the set be separated by commas. The values in the product type parameter fields are separated by ';' and so the function fails. The routines that maintain parameter values must be changed to use commas as the separator when saving and retrieving values from 'multiple value' types. It would also make sense to also change the separator in the 'Possible Values' field to a comma to eliminate any errors that might be caused by having a comma embedded in a value.

Regards
Phil

As a short term solution (with potential performance penalty compared with a solution involving switching from semi-colon to comma separators) I have implemented the following changed to shop_browse_queries.php:

Line 227 changed from
$comp = "FIND_IN_SET('$get_item_value',`$parameter_name`)";

to
$comp = "FIND_IN_SET('$get_item_value',REPLACE(`$parameter_name`,';',','))";

and line 235 from
array_push($comp,"FIND_IN_SET('$value',`$parameter_name`)");

to
array_push($comp,"FIND_IN_SET('$value',REPLACE(`$parameter_name`,';',','))");


Regards
Phil

I am using v1.1.3 and the above mentioned lines are 455 and 471 acordingly.
Is it O.K. if I change them, cause I am facing the same problem?

doorknob

As Avarot said in the previous post, this will not be fixed until 1.1.4. so go aheda and make the change. The line numbers will have changed because I made the original post about 6 months ago but so long as you find the lines that match the code shown then it should fix the problem.
Phil

preciouscreations

The code is present in the shop_browse_quaries.php (VM 1.1.6) but the problem still exists I still get att1;att2 and so on when selecting multiple values.

doorknob

Quotebut the problem still exists I still get att1;att2 and so on when selecting multiple values.
Can you provide a proper description of the problem you are having?

useris

Hi,

I've just started to use this plugin. But when I make search for type which is "eq" = it find to many products, even if product type is not equal. Is it configuration problem? (I am not selecting parameter from dropdown box I just type parameter in the search box)

And one more issue for me is that some of my product type ends with zero but so I must set up product parameter as Text. If I set it as Float Mysql will delete the zero in the end of the parameter. How to make it Float but keep zero?

doorknob

Quote(I am not selecting parameter from dropdown box I just type parameter in the search box)
I'm not at all clear on how you are trying to do a search. A fuller explanation of how you are trying to do the search would be helpful.
QuoteAnd one more issue for me is that some of my product type ends with zero but so I must set up product parameter as Text. If I set it as Float Mysql will delete the zero in the end of the parameter. How to make it Float but keep zero?
Again, I'm not clear on what you mean. zeros on the 'end' of a string (i.e. trailing) should not get lost. If you mean leading zeros and they are significant then you must capture the value as a text string and not a float. You don't say why it needs to be a float. If a value is stored as a float but you want the presentation to include leading zeros, you can edit your vm template files to format the value any way you like

useris

Thanks for your reply but problem was solved.

Quote from: doorknob on June 19, 2011, 01:32:19 AM
Quote(I am not selecting parameter from dropdown box I just type parameter in the search box)
I'm not at all clear on how you are trying to do a search. A fuller explanation of how you are trying to do the search would be helpful.
QuoteAnd one more issue for me is that some of my product type ends with zero but so I must set up product parameter as Text. If I set it as Float Mysql will delete the zero in the end of the parameter. How to make it Float but keep zero?
Again, I'm not clear on what you mean. zeros on the 'end' of a string (i.e. trailing) should not get lost. If you mean leading zeros and they are significant then you must capture the value as a text string and not a float. You don't say why it needs to be a float. If a value is stored as a float but you want the presentation to include leading zeros, you can edit your vm template files to format the value any way you like