2 replies [Last post]
slayerment's picture
Offline
Uber Donor
Joined: 01/06/2008
Juice: 86
Was this information Helpful?

Long story short, I basically am using "image" nodes to allow people to upload files for business cards and things like that. I have my business card as a product.

The user first uploads an image and then takes them to a page like this: http://www.printandcards.com/node/61 where they can then select a quantity, like 250. This then takes them to the 250 Business Cards product page and lets them continue on w/ their order.

What I am wondering is how I would get these 2 nodes associated with each other upon order completion. As you can see right now, if you hit continue and go the the business card page it passes the "image" nid via GET. I am now wondering where to go from here, or if this is even a good way to do it.

Right now I basically know the image nid and the product nid and can write them to a table in my database, but should I do that as soon as they add the product to their cart? Or should I do it once they begin the checkout? Is there some type of hook I should be using?

Any help would be appreciated.

Thanks,
Quinton

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Synching a nid to the product nid

There are add to cart hooks that you can review in the API docs. Alternatively, I'd look into using a cart link. With these you specify a product node and its attributes. So, your product nodes would all have an attribute called image reference or something like that, but you would not specify any options for these. Also, you wouldn't ever display the product page itself... you might even include some PHP to redirect non-authorized users viewing product nodes to your general product descriptions. The reason being is that the cart link would include the image reference programatically, but someone adding the product by themselves would just screw it up. Eye-wink

slayerment's picture
Offline
Uber Donor
Joined: 01/06/2008
Juice: 86
Thanks for the reply Ryan .

Thanks for the reply Ryan Smiling.