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

Problem with displaying of double qoutes

Started by borro, June 08, 2015, 13:34:24 PM

Previous topic - Next topic

borro

Hello, dear developers!

I'm testing VM 3.0.9 and I've found that there is a problem with displaying of double qoutes. For example when I'm looking into htmlcode of a product card in admin panel I see the output like this:

<table class="adminform" width="100%">
<tbody><tr class="row0">
<td style="min-width:75px;max-width:200px;width:130px;">
Название товара </td>
<td>
                        <input class="required" type="text" name="product_name" id="product_name" value="Bust" I.="" Stalin""="" size="32" maxlength="255">
</td>
...

Please pay attention to the <input> code. Double quotes in product name makes html code broken, you can see a new html attributes instead of something like this:
<input class="required" type="text" name="product_name" id="product_name" value="Bust "I.Stalin"" size="32" maxlength="255">

I'm a russian customer. Is this bug conneted with work of russian language or some encoding in Virtuemart?

The problem is that when I click Save in product card only the first part of a product name (before the first double qout) goes to DB. So I'm loosing my full products name after saving.
The good news is that when I'm inputing the name of a product by hands with all qoutes and hitting Save button all qoutes becomes saved in DB correct. But it's a bad way of making it work, isn't it? But may be this comment will help you to determine where this problem is hidden in the code. Any ideas?
Wish you happiness!

Milbo

#1
in my case it is replaced by

& # 3 4 ;    //addes spaces to show that it uses the html entity, not the normal "

It looks like a " but, it is not. firebug does not show it. you must rightclick and say "show source/original file" something like that.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

borro

Quote from: Milbo on June 08, 2015, 13:59:26 PM
in my case it is replaced by

"

It looks like a " but, it is not. firebug does not show it. you must rightclick and say "show source/original file" something like that.

Yes, when I look the source like you advised me it looks like
<input class="required" type="text" class="inputbox"  name="product_name" id="product_name" value="Бюст "А. Гитлер"" size="32" maxlength="255" />

but when I'm looking it directly in browser(Chrome and FF) output it behaves like there is that broken html code underneath with added attributes and clicking Save leads to lossing of a full product name
Can you tell what can i do to fix it? What php file is responsible for outputing product name in admin panel?
Wish you happiness!

Milbo

It "looks" wrong, but it is not. I just tested it as admin and manager, works in both cases.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

role74

#4
Good morning

I've the same issues with double quotes.
The product_name is:  Mitteldruckschlauch (1/2"Mx9/16"F) Miflex 100cm schwarz

It's displayed correctly in the front and back end at the beginning, when I type this product name and save the product.
Then I open the product in the backend again, it shows me: Mitteldruckschlauch (1/2

When I save the product now, the name is lost. just the alias tells me what exatcly it was previously.

Every product I'm just changing i.e. the stock level gets renamed this way.  :(

VM3.0.8
Joomla 2.5.28

cheers
-roland


borro

Could someone tell me what php file is responsible for outputing the product name at admin pannel while editing product card? I'll try to fix it
Wish you happiness!

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

borro

Quote from: Milbo on June 15, 2015, 18:20:50 PM
He should try vm3.0.9.4 first.

Thank you. I checked it, nothing have been changed. Any ideas?
Wish you happiness!

borro

#8
Quote from: role74 on June 15, 2015, 07:30:39 AM
Good morning

I've the same issues with double quotes.
The product_name is:  Mitteldruckschlauch (1/2"Mx9/16"F) Miflex 100cm schwarz

It's displayed correctly in the front and back end at the beginning, when I type this product name and save the product.
Then I open the product in the backend again, it shows me: Mitteldruckschlauch (1/2

When I save the product now, the name is lost. just the alias tells me what exatcly it was previously.

Every product I'm just changing i.e. the stock level gets renamed this way.  :(

VM3.0.8
Joomla 2.5.28

cheers
-roland

Hello, Roland.

Here is one solution.
To fix that you have to overwrite the template file administrator/components/com_virtuemart/views/product/tmpl/product_edit_information.php
with your own file in used template for admin panel
In this file you have to change the row
<input class="required" type="text" class="inputbox"  name="product_name" id="product_name" value="<?php echo $this->product->product_name?> size="32" maxlength="255" />
with this one:
<input class="required" type="text" class="inputbox"  name="product_name" id="product_name" value="<?php echo htmlentities($this->product->product_nameENT_QUOTES); ?>" size="32" maxlength="255" />

After that open \administrator\components\com_virtuemart\controllers\product.php file and after line with
if($data===0)$data = vRequest::getRequest();
paste the new row with
$data['product_name'] = str_replace("&#34;",'"', $data['product_name']);

Good luck!

P.S. I don't know why but after calling
public static function filter($var,$filter,$flags,$array=false) (defined in \administrator\components\com_virtuemart\helpers\vrequest.php )
with its
return filter_var_array($var, $filter); (where $filter is the php FILTER_SANITIZE_SPECIAL_CHARS constant with the value of 515)

we are catching the $data array variable (line 59 in \administrator\components\com_virtuemart\controllers\product.php file) with all " replaced with &#34; symbols...
Wish you happiness!

role74

Thanks alot!

It works now.
Can you tell me what VM Version this will be integrated to, so I dont need to change/check with every new release :-)

cheers
-role

Milbo

This quirk? As I said it is quite complex. It works for me and lot others. The question is which ACL you used. Because VM has different modes by ACL to store html entities. Do you use Superuser? or Administrator?
There are ACL settings, please check which one you use. It makes also sense to use the current svn. The fix above
$data['product_name'] = str_replace(""",'"', $data['product_name']);

is really absolutly quickdirty. the normal command is http://php.net/manual/de/function.html-entity-decode.php

But it should not be necessary. or lets say it so, it is the goal that it is not necessary.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

borro

Quote from: Milbo on July 16, 2015, 19:46:51 PM
Do you use Superuser? or Administrator?
Hello
I'm working under the superuser. Is it normal?
Wish you happiness!

Milbo

No, as superuser it should directly work without any changes. you may use the last version on the svn, to check if the error is still there.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

borro

#13
Quote from: Milbo on July 17, 2015, 10:36:33 AM
No, as superuser it should directly work without any changes. you may use the last version on the svn, to check if the error is still there.
Let me explain in details to be sure I supplied you with the correct information. I went to the native Joomla user manager and saw that there is checkmark opposite to "Superuser" value in Assigned user groups tab for my user.
Sorry I don't know what you mean under the word "svn". Please explain its meaning.
It's easy to understand you incorrectly for me with my english language skills. Please tell me what should I do step by step to fix problem with double quotes?
Wish you happiness!

role74

I'm using Superuser and updated my version to 3.0.9.4, but still happens...

Quote from: Milbo on July 16, 2015, 19:46:51 PM
This quirk? As I said it is quite complex. It works for me and lot others. The question is which ACL you used. Because VM has different modes by ACL to store html entities. Do you use Superuser? or Administrator?
There are ACL settings, please check which one you use. It makes also sense to use the current svn. The fix above
$data['product_name'] = str_replace(""",'"', $data['product_name']);

is really absolutly quickdirty. the normal command is http://php.net/manual/de/function.html-entity-decode.php

But it should not be necessary. or lets say it so, it is the goal that it is not necessary.