Non-unique IDs produced for all the products with exactly the same options

Started by man.of.earth, October 18, 2018, 18:24:33 PM

Previous topic - Next topic

man.of.earth

Hello everyone,

I see that, by default, in case of category listing of products, in case there are several products with exactly the same options (say radio list), those options have non-unique IDs, and those ID's may also contain spaces, in case the repeated custom property name contains spaces.
A sample is here: https://www.arcturian.proxima-mundi.ro/printuri-pe-canvas-foto-n . In case a certain option for a certain product is chosen, a different product page might open (the javascript on the page might select the same id, but for another product (since the IDs are not unique).
The IDs generated are something like id="[mare (100 x 67 cm)" (begin with [ )

It seems the problem originates in /sublayouts/customfield.php.

Unique IDs might be constructed like product_ID.option-number, without spaces.

___

Later edit:

I found a workaround for this:
Around line 173 in /sublayouts/customfield.php, change
$o->value = $elem;
for
$o->value = $product_id.$i;

This way, the IDs are made unique, even though the options are exactly the same for several products.

Later later edit: It does not actually work (some more thinkgs have to be changed in the javascript). I'll think of something else meanwhile :)