VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: chabi01 on October 24, 2020, 12:07:09 PM

Title: Issue on product creation with name with quote
Post by: chabi01 on October 24, 2020, 12:07:09 PM
Hi everybody,

I have notice a little issue with product name when created.
What is happening :

I am a french native, and in french, we often have name like "L'ARTICLE...." with a "   '   ".
I have my product listed in Calc/Excel file.
To create my product (manually or imported with some tools like CSVImport, it is the same), i can see this issue :

I create a new product,
I copy paste from Calc/Excel the name, and all other information.
If now this a child product shown in a dropdown for a parent product, i have the name shown correctly in the backend and in the list, but shown like this in the frontend :
In the backend : "L'ARTICLE......"
In the frontend : "L1#39;ARTICLE..."

I have then to edit again the child product, copy paste again the name or manually erase the ' to retype it correctly.

I was thinking first "it is a pagecode issue with the excel file", but this is not the reason as if i edit and copy paste again the name, the issue is no more existing..

Do you know a way to avoid this issue ? Is this a bug in the code on product creation ?
This is quite annoying as if i import several hundred products, i have to manually correct all the name with " ' "...

Thanks for the help :)
Xavier
Title: Re: Issue on product creation with name with symbols
Post by: pinochico on October 24, 2020, 13:06:19 PM
QuoteI was thinking first "it is a pagecode issue with the excel file", but this is not the reason as if i edit and copy paste again the name, the issue is no more existing..

It's reason
- microsoft has set up code page another as your administration from VirtueMart
- microsoft products are "shit" - when I copy text from MS product to text editor, then text is with a lot of mass (style, font define...)

Then, if you copy text, copy text from MS product first to Notepad and then to VM.
Try self, I think this help for you.

Or you can hack internal function in VM for product Title (but I don't know where is exactly now).
Title: Re: Issue on product creation with name with symbols
Post by: diri on October 25, 2020, 09:18:02 AM
Hint: Search function is of help at some time as well as basic knowledge of HTML ...

To make story short:

&prime = single quote
&Prime = double quote

If nothing changed in VM those entities are not filtered.

Hope it helps,

diri
Title: Re: Issue on product creation with name with symbols
Post by: chabi01 on October 26, 2020, 10:49:40 AM
Hi everybody,
Thanks for your lights :)

If i use a Linux with LibreOffice, is the problem could solved then ?
Why this question : If this is linked to MSOffice, why the issue is still existing if i open the file under Linux with LibreOffice, and export to CSV using the filter edition in UTF8 ? The csv file should have the MS page code no ?
Moreover, why is this happening on the product creation but not on product edition ??

Thanks again :)
Xavier
Title: Re: Issue on product creation with name with symbols
Post by: chabi01 on November 09, 2020, 11:48:09 AM
Hello,
I saw the issue is not always linked to the import file !
If I have name with quotes inside, especially for children product, on each save, the issue is back.
Then, if i have as name "My product L'Or", the name is replaced in the database in "My product L'Or"...

The only way i found so far is to replace all the products name in the database with a :
UPDATE xxxxx_virtuemart_products_fr_fr SET product_name = REPLACE(product_name, ''', '\'')

This correct my issue but not the problem : each time i'm going to edit and save a parent product, this will mess up all the name of the children...

Where is the function in the file to save and update the product : i have to check where is the problem if possible (i cannot work like this).
Otherwise, i could add a function to "correct" the quote, but again, this is not "normal" no ?

Thanks for the help:)
Xavier
Title: Re: Issue on product creation with name with symbols
Post by: chabi01 on November 09, 2020, 11:50:13 AM
The editor remove the code i want to show.
Read :
Then, if i have as name "My product L'Or", the name is replaced in the database in "My product L'Or"...

and for the sql :
UPDATE xxxxx_virtuemart_products_fr_fr SET product_name = REPLACE(product_name, ''', '\'')

Xavier
Title: Re: Issue on product creation with name with symbols
Post by: chabi01 on November 09, 2020, 12:19:01 PM
Maybe a "Virtuemart master" here could tell me how to correct this in the file calling the children is the dropdown list as the issue is only in the dropdown ? If the code is in the database but shown correctly in the dropdown, it could help while the issue is not corrected...

Thanks for the help :)
Xavier
Title: Re: Issue on product creation with name with symbols
Post by: chabi01 on November 10, 2020, 19:29:03 PM
Ok, i have made a video to show you : this is obviously a bug in Virtuemart !
Check the video and you will understand the bug i have.

Video is to big (1,4Mo) : i have created a wetransfer file here : https://we.tl/t-Tlpf0NTfXl
Note : i add to zip the file (it is a mkv video file).

So, my question is still here and maybe someone can help me to find a way to solve this : every time i save a parent product with children, their name are "broken"...

Xavier
Title: Re: Issue on product creation with name with symbols
Post by: chabi01 on November 13, 2020, 18:23:51 PM
Nobody can help me ??
Maybe is this fixable quickly with an htmlspecialchars_decode ?
If yes, where is generate the dropdown list for children product ? I found the customfield.php file but i cannot find the right line to modify...

Please help !
Xavier
Title: Re: Issue on product creation with name with quote
Post by: GJC Web Design on November 13, 2020, 19:25:41 PM
starts around line 160

see image
Title: Re: Issue on product creation with name with quote
Post by: chabi01 on November 16, 2020, 18:11:11 PM
Hi,
Ok, sor far, i see the text value  in  line 156 :
$text = $elem;

And as the text value is used as it on line 174 with :
$o->text = $text;

it should use the correct value if i replace the line 156 with :

$text = htmlspecialchars_decode($elem, ENT_QUOTES);

Unfortunately, it seems to not work...

GCJ, do you a mistake in my code or in the logic ?

Thanks a lot for your help :)
Xavier

Title: Re: Issue on product creation with name with quote
Post by: chabi01 on November 16, 2020, 18:16:06 PM
Strange... to verify if something change in the list, i put something to "view" with $text = $elem . 'xxxxx';
should change each list value to show my "xxx" in the string in the list  no ?

Nothing change... not sure this is the right place or there is something I miss here....

Xavier
Title: Re: Issue on product creation with name with quote
Post by: jjk on November 16, 2020, 21:51:03 PM
Just for your information: https://forum.virtuemart.net/index.php?topic=140498.msg493952#msg493952
Title: Re: Issue on product creation with name with quote
Post by: GJC Web Design on November 16, 2020, 22:44:59 PM
Quoteto verify if something change in the list, i put something to "view" with $text = $elem . 'xxxxx';
should change each list value to show my "xxx" in the string in the list  no ?

correct

is your customfield.php over ridden in templates/your_template/html/com_virtuemart/sublayouts?

Title: Re: Issue on product creation with name with quote
Post by: chabi01 on November 17, 2020, 16:32:01 PM
Hi :)


I did the change in my template override (and after this, as i have no results, i did also in the virtuemart component folder to be sure) : no results after modify the files..

By the way, thanks JJK for your advice.

I keep trying... no success so far.
Xavier
Title: Re: Issue on product creation with name with quote
Post by: GJC Web Design on November 17, 2020, 16:47:25 PM
what sort of custom r u using Generic or Multi Variant?

Generic is down at line 322

                     $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);
Title: Re: Issue on product creation with name with quote
Post by: chabi01 on November 19, 2020, 14:48:12 PM
Hi,
Issue solved with a custom component development to run my query on the database : a new entry in the backend menu "fix the product name with quote" to run a query to fix the name directly in the database.
Like this, no need to modify the Virtuemart code in override, just my own fix to get something working correctly.

Thanks for all who give me some help here :)
Xavier