10 replies [Last post]
Carl Thuringer's picture
Offline
Joined: 02/17/2010
Juice: 16

I have been working on my project's primary problem for a few weeks and I think I have narrowed down exactly how to accomplish what I want with the minimum of effort.
Basically, the store has a series of products that can have photos printed on them. Think T-shirts, mousepads, mugs, etc. The photos are going to be organized into galleries on the site, each photo as a node. When a customer decides they want to purchase a photo, they click a link on the node page corresponding to their choice. "Get this photo on a mug."

Here's the trickiness:
What I want to do is have that link be a cart link, and in addition to selecting an attribute/option combo for the add to cart action, it will fill in a textfield with an unfiltered hyperlink (ala nodereference, but without the security or the overhead) so that the link is included in the cart, the order, the invoice, etc for fulfillment purposes.

Now, I spent the night reading uc_cart_links, uc_cart, and uc_attribute and I can't figure out how to either hack it, or form_alter it to do what I want, so here I am. The biggest concern on my mind right now is that uc_cart_links doesn't support anything to do with textfields.

So... any suggestions, community?

Carl Thuringer's picture
Offline
Joined: 02/17/2010
Juice: 16
Re: Need to use cart links to fill attribute textfield

One bump to see if anybody has any ideas this week.

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3369
Re: Re: Need to use cart links to fill attribute textfield

Cart links supports textfield attributes in the -dev version of Ubercart.

It takes only a few lines of jQuery to re-write the cart link on the fly to include text that the customer types into a textfield. Just put a click handler on the link which grabs the value of the text field and appends it to the href, then return true to let the default click handler take care of the POSTing.

<tr>.
Carl Thuringer's picture
Offline
Joined: 02/17/2010
Juice: 16
Re: Re: Re: Need to use cart links to fill attribute textfield

Woah, thanks! I'm anxious about using a dev version of ubercart on a production site, but this is very enticing as it reduces what I thought would be a whole module to little more than a few dabs of glue in the right places. Laughing out loud

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3369
Re: Re: Re: Re: Need to use cart links to fill attribute textfie

The dev version is just the 2.2 version with bug fixes, so I'm comfortable recommending that you use that for a production site. But if you just want the cart links fix, apply the patch from http://drupal.org/node/560358

<tr>.
gahlord's picture
Offline
Joined: 04/05/2010
Juice: 8
Example of textlink cart link?

I'm trying to use cart links to add customizable product to a cart, similar to what the starter of this thread is doing.

When I add a link like this:

http://mydomain.com/cart/add/e-p520_a10oTest?destination=cart

[p520 is my customizable product and a10 is an attribute (Tea Name) for a text field the customer supplies]

I get the cart and quantity etc but for the text field attribute I get: Team Name (Single Line): 0
I was hoping to get: Team Name (Single Line): Test

I've added the second of the two patches in the drupal.org/node560358 comment #3 link with no change in this behavior.

Does anyone have an example of how that textfield should be put into the URL? Am I missing something here?

Thanks?

xibun's picture
Offline
Joined: 05/13/2009
Juice: 104
Re: Example of textlink cart link?

I'm also looking for an example on how this link has to look. Anyone has this working?

gahlord's picture
Offline
Joined: 04/05/2010
Juice: 8
Got this to work

Xibun,

I got the functionality I needed: Pass customizable data from Flash to textfield of Ubercart. But I was unable to do it via the cartlinks. No matter what I tried or whacked at I couldn't get Ubercart to understand the open-ended textfields.

Ultimately I passed the data straight to the product page. If you'd like me to write up a how-to let me know and I will. It wasn't too hard really, once I figured out how to do it. My method doesn't use cart links though.

xibun's picture
Offline
Joined: 05/13/2009
Juice: 104
Thanks gahlord, sorry, only

Thanks gahlord,

sorry, only spotted your reply now. I got a tinkering solution on my side - so I have it working.. thanks for offering your help.

I believe in the long run cartlinks should be able to do this trick. I've opened an issue on d.o.

gahlord's picture
Offline
Joined: 04/05/2010
Juice: 8
A hopeful bump

Just bumping it. Hoping someone can shed some light for me. Smiling

Cayenne's picture
Offline
Joined: 01/01/2009
Juice: 535
Re: A hopeful bump

Consider the drupal prepopulate module. It lets you specify a url that prepopulates identified fields with the specified values.

Ryan suggested that, and it worked fine for me.