0

I have an online shop implemented in Ubercart 6.x-2.4 and Drupal 6.19

All cool everything works but I'm struggling to do custom things

What I want to do is after saving the shipment data (i'm insterested in sending the Client that the package has been sent and he has to receive by email the tracking number)

So I added a predicate that does just that, but I don't know how to get the shipment object associated with the order and get that tracking number. I just know that there is an API somewhere...

0

Are you managing to save the tracking number to the order? With a bit of preprocess magic you could probably get the number as a variable to the invoice template that already gets sent out.

EDIT:

Something like the below would work, that I did to get extra data displayed in an invoice. I did this in my theme, so replace that with your own theme name (and the other capitalised bits).

    function [THEMENAME]_preprocess_uc_order(&$variables) {
        $variables['tracking_number'] = 
           db_fetch_object(db_query("QUERY TO GET TRACKING NUMBER"))->COLUMNNAME;
    }

Then if you put uc_order.tpl.php (needed as a dummy file so your theme can override other templates) and your own custom template into your theme directory then you are able to reference it in the template with a simple call like print $tracking_number;

  • I could do it with a predicate on the event when creating a new package with an action of executing a PHP code and it gives you 2 objects: order and shipping so I could get all that Info – PartySoft Dec 2 '11 at 9:29
  • @PartySoft, did the edit solve your problem? – Malks Dec 5 '11 at 22:25
  • Yes, it did, I guess It can be done both ways – PartySoft Jan 13 '12 at 15:40
0

This question needs an update for Drupal 7. I created a module for drupal 7 and a patch for UberCart that accomplish adding Tokens for shipment tracking that can easily be used in email.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.