Issue with simple and double quote in customfield variant (children products)

Started by chabi01, April 21, 2020, 14:28:51 PM

Previous topic - Next topic

chabi01

Hi,
When i have children product with a simple quote in the name (should be the same with double quote), then in the "dropdown list", i find html entities and also if i select the product in the list.

Check this page to see  the issue : http://biosource2020.xlcrea373030.com/isolation/coton-lin-chanvre-en-panneaux/panneau-isolant-en-chanvre-coton-et-lin-biofib-trio-detail.html
The parent product have a correct quote in his name, but check the children product in the dropdown, and select one in the dropdown...

How can i solve this ? Please, if i have to modifiy the php code, give me the file name and the code to change (to avoid me to make a big mess in the files..).

Thanks a lot for the help :)

Xavier

chabi01

For the record : very last Joomla and very last VM versions.
Xavier

Studio 42

You need certainly to encode the value.
See in virtuemart/layout/customfields.php
Note the you can override the layout in your template, to not loose the changes

chabi01

Hi,
Thanks, but how to do this ? Can somebody can help me for the code to change here ? I have checked the customfields.php file but i dont find where to change the code here...

Thanks :)

Xavier

Studio 42

Exact file is components/com_virtuemart/sublayouts/customfield.php
   case 'A':

   $options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view='.$view.'&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $productChild->virtuemart_product_id,false), 'text' => $productChild->{$customfield->customfield_value}.$priceStr);

The problem is in
$productChild->{$customfield->customfield_value}

chabi01

Hi,
I tried this :

$options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view='.$view.'&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $productChild->virtuemart_product_id,false), htmlspecialchars_decode('text' => $productChild->{$customfield->customfield_value}).$priceStr);


but this generate an error.
How to solve this... I shouldn't not be the only one who have this issue : as in France we use a lot of quote in name and as for a tv shop you can have some " as 32" for size, anybody did solve this before ?

Thanks a lot for the help :)
Xavier

pinochico

hmmm,

Im not programmer, but I think you must use decode right by variable (not for all in bracket) = is logical

htmlspecialchars_decode('text' => $productChild->{$customfield->customfield_value}

better

'text' => htmlspecialchars_decode($productChild->$customfield->customfield_value)}
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Studio 42


chabi01