VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sscheidegger on December 29, 2011, 11:58:38 AM

Title: Problem with double quotation marks
Post by: sscheidegger on December 29, 2011, 11:58:38 AM
Hi all

Found the following VM bug when using double quotation marks in the category name or product name: A product/category name with double quotation marks (example: <The "one" product>) can be stored and will display correctly in FE and BE. However when the product/category is edited afterwards, the name is not loaded correctly and on saving the product/category again, parts of the name get lost (example: <The >).

I guess this is an easy one ;-)
Title: Re: Problem with double quotation marks
Post by: Milbo on December 29, 2011, 13:41:37 PM
I fear that is an evil one.

Use html entities for things like !"ยง$% and so on. That is afaik the most correct method.
Title: Re: Problem with double quotation marks
Post by: sscheidegger on December 30, 2011, 09:33:12 AM
Very interesting. I tried to use &quot; instead of ". The behaviour is exactly the same! <The &quot;one&quot; product> can be stored and displays as <The "one" product>. But when I edit the product, it shows <The > in the name field and stores it like that.

From the observed behaviour I'd say the special characters are escaped correctly before storing them to the database. About displaying it later in the FE I'm not sure, in the html code of the website I find both, <The &quot;one&quot; product> for the page title and <The "one" product> for the product name! However, I don't mind as long as it displays correctly.

The real problem happens when loading the edit form of the BE. There, the product/category name doesn't use html entities for displaying them. The html code is
<input type="text" class="inputbox"  name="product_name" id="product_name" value="The "one" product" size="32" maxlength="255" />

Hope this helps!
Title: Re: Problem with double quotation marks
Post by: jjk on December 30, 2011, 11:27:13 AM
The handling of quotes also depends on your php version.
See here: http://php.net/manual/en/language.types.string.php (http://php.net/manual/en/language.types.string.php)
and here: http://docs.joomla.org/Specification_of_language_files (http://docs.joomla.org/Specification_of_language_files)
and here: http://forum.virtuemart.net/index.php?topic=95254.msg313531#msg313531 (http://forum.virtuemart.net/index.php?topic=95254.msg313531#msg313531)
;)
Title: Re: Problem with double quotation marks
Post by: jan suhr on December 30, 2011, 17:22:42 PM
I have the same problem trying to set inch in my produktnames, like 17" and so on.

When saving the product the " and everything after it is gone. Tried &quot; but that gave the same kind of error.

I don't think it has anything to do with PHP-versions in this case since I have tried other shops on the same system and they can handle the inch/quote without any problems.

Over half of the products in this shop has inches in their productnames. I don't like to write 17in or for Swedish 17tum on the products.

Jan
Title: Re: Problem with double quotation marks
Post by: behemoth on February 26, 2013, 16:03:15 PM
I've just come across this problem. Is there a suggested fix? The site I'm working on has a number of products that are referenced by their size in inches, represented by a ".
Title: Re: Problem with double quotation marks
Post by: behemoth on February 27, 2013, 14:17:52 PM
I have a workaround for what I'm doing here. It appears I can substitute the quotation mark with the HTML entity &quot; in the csv file I import via CSVi and it appears to work ok. It doesn't answer the question, but if anybody else is in the same situation as me, it does work.
Title: Re: Problem with double quotation marks
Post by: ryandiaz on April 30, 2013, 17:46:08 PM
Related bug: When my product name starts with quotation mark (")

for example: "Happy Birthday" Paper Napkins

When one clicks Add to Cart, the entire product name gets dropped from inside the ajax facebox popup box. Instead of saying: "Happy Birthday" Paper Napkins has been added to your cart.  It says: has been added to your cart.

As a work around, I have removed all instances of quotation marks from my product names.  But you can see where this would be a problem if someone relied on using quotation marks.

Joomla 2.5.9 | Virtuemart 2.0.20b
Title: Re: Problem with double quotation marks
Post by: Milbo on May 01, 2013, 14:05:57 PM
Quote from: jan suhr on December 30, 2011, 17:22:42 PM
I don't think it has anything to do with PHP-versions in this case since I have tried other shops on the same system and they can handle the inch/quote without any problems.
The whole thing is so complex, because there are different php versions and for this versions the handling is different. That means, there is a solution for any php method. But maybe the other shopsystem is strong on php 5.2 and vm on php5.3.

Quote from: behemoth on February 27, 2013, 14:17:52 PM
I have a workaround for what I'm doing here. It appears I can substitute the quotation mark with the HTML entity &quot; in the csv file I import via CSVi and it appears to work ok. It doesn't answer the question, but if anybody else is in the same situation as me, it does work.

But this shows that your editor is not correctly configured. This is the next problem, that you can configure your editor in joomla, if it should replace " by the correct html entity, or not. It depends if you use TinyMce or JCE.
Title: Re: Problem with double quotation marks
Post by: jjk on May 02, 2013, 07:37:15 AM
Just for info - somebody else who wanted to use quotes in the titles instead of the word inches uses double single quotes as a workaround.
Title: Re: Problem with double quotation marks
Post by: lindapowers on May 02, 2013, 13:30:02 PM
I just noticed that when customers enter their address like this:

street 1, (cofee shop)

the system only displays: street 1 ignoring the ( ) and the text inside.

Don't know if is related to this issue.

Regards
Title: Re: Problem with double quotation marks
Post by: behemoth on May 29, 2013, 22:07:48 PM
Quote from: behemoth on February 27, 2013, 14:17:52 PM
I have a workaround for what I'm doing here. It appears I can substitute the quotation mark with the HTML entity &quot; in the csv file I import via CSVi and it appears to work ok. It doesn't answer the question, but if anybody else is in the same situation as me, it does work.

But this shows that your editor is not correctly configured. This is the next problem, that you can configure your editor in joomla, if it should replace " by the correct html entity, or not. It depends if you use TinyMce or JCE.
[/quote]

Sorry I didn't reply sooner.

I'm not using the Joomla editor. There are so many products, these are managed via CSVi. The problem is in inputting them into the csv files in the first place, but not really within the scope of Joomla or Virtuemart.