VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: GJC Web Design on April 23, 2020, 00:11:18 AM

Title: html entities .. and custom parameters - quorvia_product_cart_variant
Post by: GJC Web Design on April 23, 2020, 00:11:18 AM
Using the excellent quorvia_product_cart_variant custom plugin (https://forum.virtuemart.net/index.php?topic=127362.0 ) ...

From an older VM  (not sure when this problem started  - perhaps ~ vm3.2.0 ) many 100s of the customfield_params have been entered in the admin with line breaks

These were stored in the DB as

custom_drop="1 - Commercial script,\r\n2 - Palace,\r\n3 - English script,\r\n4 - Times,\r\n5 - TIMES VET,\r\n6 - Zurich,\r\n7 - Murray,\r\n8 - Script tina,\r\n9 - Bickley,\r\n10 - Edwardian,\r\n11 - American,\r\n12 - Garamond,\r\n13 - Comic Sans,\r\n14 - ARMY,\r\n15 - Amaze"|custom_drop_weight="0"|

after updating to VM3.6.10 if the product is stored again it saves these as

custom_drop="1 - Commercial script,
2 - Palace,
3 - English script,
4 - Times,
5 - TIMES VET,
6 - Zurich,
7 - Murray,
8 - Script tina,
9 - Bickley,
10 - Edwardian,
11 - American,
12 - Garamond,
13 - Comic Sans,
14 - ARMY,
15 - Amaze"|custom_drop_weight="0"|

which leads to this delightful display.. see screenshot

changing the

$selects[] = array('value' =>$valueWithPrice[0], 'text' => htmlentities($text) );

to

$selects[] = array('value' =>$valueWithPrice[0], 'text' => $text) ;

in the customfield display template corrects the select display but the display in the cart and email/invoice is still duff...


Lettertype 
6 - Zurich
Kleur Opdruk Donkerbruin

Removing the line breaks either in the DB or thru the admin of course solves everything but interested in why this has changed ..  where is this new save pattern coming from?

Title: Re: html entities .. and custom parameters - quorvia_product_cart_variant
Post by: AH on April 23, 2020, 14:48:20 PM
Looks to be something to do with VM and the way it is saving the product_customfield data in the database
No issue when it saves the original _customfield data
Title: Re: html entities .. and custom parameters - quorvia_product_cart_variant
Post by: GJC Web Design on April 23, 2020, 14:49:56 PM
agree ..  something is different in VM as to what was previously happening on "save"
Title: Re: html entities .. and custom parameters - quorvia_product_cart_variant
Post by: AH on April 23, 2020, 15:00:43 PM
and is different in admin customfield save vs admin product customfield save
Title: Re: html entities .. and custom parameters - quorvia_product_cart_variant
Post by: Studio 42 on April 23, 2020, 17:32:50 PM
I said in 2012 that the solution is to use JSON to save all parameters to prevent this problems
About the problem, perhaps some user had a problem with encoding and Max added an encoding since. But the solution is to move the params to use json for all the datas.