VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: rayge on June 19, 2013, 22:58:23 PM

Title: Quotes in Product Child Name causes truncation (SOLVED)
Post by: rayge on June 19, 2013, 22:58:23 PM
I am not sure why but product names such as
1 3/4" Insert Medal in Silver with coin edge
gets truncated to
1 3/4
can someone validate this for me and tell me how to fix it? we are due to launch in 2 days!
Title: Re: Quotes in Product Child Name causes truncation
Post by: rayge on June 21, 2013, 23:55:29 PM
OKay when i View source it shows the full name but ofcourse if i save anything it will kill it. we should be using htmlentities in these fields in order to solve this.
Can someone give me direction on where i can change the code?
Title: Re: Quotes in Product Child Name causes truncation
Post by: Milbo on June 22, 2013, 10:18:29 AM
You said it yourself. You must use html entities for the name and the short description. The reason is that people want be able to style their names with html.

We can do a poll about it, how it should be. One one hand it would be better to convert it directly. On the other hand the description is using the editors and must not be converted. Maybe a configuration option, ... hmmm.

Try the attached file, copy it to /BE/controllers.

[attachment cleanup by admin]
Title: Re: Quotes in Product Child Name causes truncation
Post by: rayge on June 22, 2013, 22:16:12 PM
Well the product title itself has been handling quotes just fine.. its the child product name that I saw the issue.
I would agree that any textarea item should be able to handle html though but a text field would be treated differently.
IE quotes aren't an issue in a text area field for the most part.
<textarea></textarea> VS <input value=""> yanno?

Just my own opinion of course ;P

I tested that script at it didnt change the quotes in the child product name at all. just FYI
Maybe i put it in the wrong page?
/administrator/components/com_virtuemart/controllers/
Right?

OK here is what i was talking about..
/administrator/components/com_virtuemart/views/product/tmpl/product_edit_information.php
Line 344
thats the item i am seeing issues with.
<td><input type="text" class="inputbox" name="childs[<?php echo $child->virtuemart_product_id ?>][product_name]" size="32" value="<?php echo $child->product_name ?>" /></td>

If you look at like 63
<input type="text" class="inputbox"  name="product_name" id="product_name" value="<?php echo htmlspecialchars($this->product->product_name); ?>" size="32" maxlength="255" />

Shouldnt that be the same as like 344?
SO if you change it to
<td><input type="text" class="inputbox" name="childs[<?php echo $child->virtuemart_product_id ?>][product_name]" size="32" value="<?php echo htmlspecialchars($child->product_name); ?>" /></td>

everything shoudl be happy.. andy ou dont need to keep that controller file you just changed.

Title: Re: Quotes in Product Child Name causes truncation
Post by: Milbo on June 23, 2013, 10:37:53 AM
Ehrm no.
One time it is the name of the product and the other time it is the name of the child product.
Title: Re: Quotes in Product Child Name causes truncation
Post by: rayge on June 24, 2013, 22:24:04 PM
Hmm well when I made the change I did everything worked as expected.
and when I tried your file it didnt fix anything.

SO what is wrong with the modification i made?

THANKS!
Title: Re: Quotes in Product Child Name causes truncation
Post by: Milbo on June 25, 2013, 10:12:49 AM
No, what I just meant is that you are talking about the edit field in the parent, which is for the child. Now I also understood what you meant with the child name.

Thanks added an htmlspecialchars to it.