No replies
dathenous's picture
Offline
Joined: 03/13/2010
Juice: 7
Was this information Helpful?

This is my first UberCart project and I'm working on a distinctive implementation. I look forward to any advice you might be able to provide me. Here's what I'm trying to do..

We will create "Certificate" products in UberCart. After a customer purchases a "Certificate", they can print it out. Printed on the certificate is a Unique Code that is distinct to that particular Certificate.

Now here's the dilemma, I need to add a "Unique Code" to the UberCart Order Item somewhere in the checkout process. Here's my current plan (And it isn't working right now). I've created an Attribute called Unique Code on the "Certificate" products. When a customer adds the Certificate to their cart, that attribute is left blank. Later, when the customer has completed the checkout process, I'm going to add a Unique Code into that attribute field. I've tried to implement this in hook_order, but the code that I assign is not getting saved with the order.

Here's a boiled down version of my hook_order:

function mcs_uc_create_certificate_order($op, &$arg1, $arg2) {
  if ($op == "save"){
    $arg1->products[0]->data['attributes']['Unique Code'][0] = md5( time() );
  }
}

When I use print_r to see the $arg1 object, it's showing that md5 code in there. However later, when I look at the order, Unique Code is blank.

Can anyone give me some guidance as to what I may be doing wrong?

Lastly, I originally tried using node_checkout, however it didn't seem to work for this application. The above mentioned code is the best I could come up with to solve this problem. Any input as to my coding or overall strategy would be appreciated.

Many thanks