Attribute getting truncated

Posts: 49
Joined: 12/12/2007
Bug Finder

I am trying to build an add to cart link that adds an item with an attribute. It seems though that my attribute string is getting truncated. This is the link i am using:

/cart/add/e-p43_q1_a1o12345I23666I58886?destination=cart

Notice the "I" is a delimeter. I tried with spaces, underscores and nothing seems to work.

This works fine when added to cart from the product page with add to cart button.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I don't understand why you have I as a delimeter... it may be that that's interfering w/ the ID option for cart links and keeping it from adding.

Posts: 49
Joined: 12/12/2007
Bug Finder

I tried all sorts of delimiters from just spaces to commas and nothing seems to work. I am wondering if it is getting truncated somehow.

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

What's the delimiter for? In this scenario:

/cart/add/e-p43_q1_a1o12345I23666I58886?destination=cart

a=1 (the attribute id from the uc_product_options and uc_attributes_options tables)
o=12345I23666I58886 (supposed to be the option id from the same table(s))

The main issue is that, you're not using a database value if your value for "o" is a string and not a number. It appears that in the tables mentioned above, the Type for oid is mediumint(9)

So what's happening (probably) is the Cart Links is looking for an integer, but you're not supplying one, so it's only giving back the first 9 digits of your option ID. But, since your option ID probably doesn't correspond with any value in the database, it's most likely not returning anything at all.

What you'll need to do is look in your database, or in the attribute/option editing screens, and get those values, which you'll then substitute in your a#o# formula.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 49
Joined: 12/12/2007
Bug Finder

Thanks. To clarify what we are doing is creating a payment system where a user can select one or more invoices to make a payment on and we wanted to write out those invoices in an Attribute called Invoice with the options being: invoice 1, 2, 3.

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

So then once you've created your Invoice attribute, and its three options:

a1o1 = Invoice 1
a1o2 = Invoice 2
a103 = Invoice 3

So your link would look like this:

/cart/add/e-p43_q1_a1o2?destination=cart

(keep in mind the values will probably be different in the database - you'll need to remember the IDs of each attribute and combo, either from the Edit Attribute screen or from the uc_attributes_options table)

Or if there are additional values you need to grab, you're better off (for now) writing a Contrib that grabs them from the query string like this:

/cart/add/e-p43_q1_a1o2?destination=cart&invoice=foo&option=bar or something ... still unsure of what you need the I delimiter for but I trust you'll be able to figure it out Smiling

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com