When the option has a "-" (dash) for the add to cart url the option is truncated when is reaches the first dash within the shopping cart.
For the example url below the option value assigned in the shopping cart is 25 instead of what it should be which is 25-14-27-400-004
https://mydomain/cart/add/p110_a2o25-14-27-400-004

Files: 
CommentFileSizeAuthor
#5 960630-cart-links-escape-dashes.patch1.28 KBlongwave
PASSED: [[SimpleTest]]: [MySQL] 2,802 pass(es).
[ View ]

Comments

TR’s picture

Status:Active» Closed (works as designed)

Option ID is an internal Ubercart identifier, which is why I can say positively that option ID never has a dash.

mitchelljj’s picture

Status:Closed (works as designed)» Active

You misunderstand using the example below
https://mydomain/cart/add/p110_a2o25-14-27-400-004

a2 represents the attribute name that is associated to the aid (attribute id) of 2 and
o25-14-27-400-004 represents the value that is assigned the attribute in the case it will be 25-14-27-400-004, but when sending this to the shopping cart via the add to cart url listed above only 25 is assigned to the attribute instead of 25-14-27-400-004.

Also having this same 25-14-27-400-004 value assigned to the attribute within the ubercart product page and then clicking on the add to cart button the entire value of the attribute (25-14-27-400-004) is assigned within the shopping cart unlike when clicking the add to cart link which only assigns 25 (which is the string before the first dash) to the attribute within the shopping cart.

TR’s picture

Title:When the option has a "-" (dash) for the add to cart url the option is truncated when is reaches the first dash within the shopp» Cart links don't accept textfield attributes with embedded dashes

It's easy to misunderstand when you don't explain your problem well. I'm changing the title to what I *think* you mean.

TR’s picture

Version:6.x-2.4» 7.x-3.x-dev

This should be fixed in 7.x-3.x first, then backported if necessary.

longwave’s picture

Status:Active» Needs review
StatusFileSize
new1.28 KB
PASSED: [[SimpleTest]]: [MySQL] 2,802 pass(es).
[ View ]

Dashes are special characters in cart links, so the only way around this is to escape them. This patch supports escaping dashes with backslashes, so the example above becomes https://mydomain/cart/add/p110_a2o25\-14\-27\-400\-004

longwave’s picture

Priority:Normal» Minor
longwave’s picture

Status:Needs review» Closed (works as designed)

I think this is such a minor problem that it can be ignored; there can't be many cases where attribute textfield options must contain dashes and can't use underscores instead. If this really is a problem for someone, feel free to revive this issue.

ardi’s picture

Issue summary:View changes

This is a serious problem for me. I have a specific use case where I think cart links should be able to support "-". My product is a "domain name". A domain name has attributes: ID protection enabled, domain name, domain extension etc.

The domain name attribute has to be text for this to work. And it must support numbers, hyphens and letters. So for this specific scenario, I can't create add to cart links.