17 replies [Last post]
anneeasterling's picture
Offline
Joined: 11/01/2007
Juice: 58

Hi all,

My ubercart is working wonderfully! Now I'm trying to integrate iDevAffiliate and need to put a tracking image on the checkout/complete page. (And I've searched and searched for answer and ended up here.) Here's what the integration instructions for iDevAffiliate say:

You'll need to place some code into your sale confirmation page.  This is the page where your customers return to after making a purchase.  iDevAffiliate will then be included with all your sales.  If an affiliate exists for the customer, the affiliate will be credited appropriately.

You must alter all =XXX entries with the actual variable name your cart or merchant account uses.  Example: =${variable_name}  This will look different for all carts and merchant accounts.  Check their support forums for proper syntax.

Here's the code I'm supposed to add:

<img border="0" src="http://www.sitename.com/share/sale.php?profile=72198&idev_saleamt=XXX&idev_ordernum=XXX" width="1" height="1">

So I'm thinking that I can add it to the "Checkout completion message header" field at /admin/store/settings/checkout/edit/messages. And I think that I need the [order-total] (for the idev_saleamt variable) and [order-id] (for the idev_ordernum variable) tokens. I'm just not sure whether the tokens will work or how to format them. Can anyone point me in the right direction?

Thanks,
Anne

(PS: Hi, Ryan! It was a pleasure to meet you at DIWD in New Orleans!)

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Hey Anne. I'm going to

Hey Anne. Smiling I'm going to guess that you should be able to stick this HTML in there. Just remember to select the proper input format. The tokens should still work with the Full HTML format, but I'd be interested to hear back from you to see how it goes!

anneeasterling's picture
Offline
Joined: 11/01/2007
Juice: 58
Re: Hey Anne. I'm going to

The proper format is what I'm looking for. Do I just use the square brackets like this:

<img border="0" src="http://www.sitename.com/share/sale.php?profile=72198&idev_saleamt=[order-total]&idev_ordernum=[order-id]" width="1" height="1">

???

Thanks,
Anne

PS: And you are confirming that that field appears on all sale confirmation page, right? Thanks again!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Hey Anne. I'm going to

Hmm... you know, that is the proper token format and field to use, but I just realized that the [order-total] token is going to include the currency symbol. You'll actually need to use the PHP input format with something like the following snippet:

<?php
$order
= uc_order_load($_SESSION['cart_order']);
?>

<img border="0" src="http://www.sitename.com/share/sale.php?profile=72198&idev_saleamt=<?php print $order->order_total; ?>&idev_ordernum=<?php print $order->order_id; ?>" width="1" height="1">

anneeasterling's picture
Offline
Joined: 11/01/2007
Juice: 58
Re: Re: Re: Hey Anne. I'm going to

Ryan, I had tried the square brackets and the sales amount wasn't processed properly. So I'm trying this code. Will report later.

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
similar issues

Hi,

I am also trying to integrate ubercart w/idevaffiliate. I found the header being referred to above - do I replace what is currently there with the snippet? This is what I did and nothing is getting tracked in idev....

Were you able to get this working?

-Kim

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
inserting snippet

When I add the snippet to the checkout messages section, do I select PHP input or Full html?

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
It working

It is working. Tbank you for the snippet!

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
total minus shipping/taxes

Hi Ryan,

Is there a way to change this snippet so that just the subtotal is getting passed to idev? We don't want to credit affiliates for shipping and taxes. We just want to give them credit for the subtotal.

Thank you,
Kim

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
Re: total minus shipping/taxes

I changed the "order_total" to "order_subtotal" and left everything else the same. Now I am getting "processing error" instead of the total in idev. Any ideas?

<?php
$order
= uc_order_load($_SESSION['cart_order']);
?>
fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
Re: Re: total minus shipping/taxes

I also tried removing the php and using [order-subtotal]. This didn't work either....

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
Re: Re: Re: total minus shipping/taxes

Using the snippet already available above, I just tried $subtotal instead of $order->order_total

Any idea why this would not work?

We really need to get this working.

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
not working in ubercart 2

Hey Ryan,

I had this working in Ubertcart 1, but have upgraded to Ubercart 2. Now when I put the included snippet into the Checkout Messages header, the php part is showing on the confirmation page....

Has something changed?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: not working in ubercart 2

D6 requires you to enable the PHP Filter module. Have you already done this and double checked your checkout message settings? I'm not sure how the update will affect input formats.

fossle's picture
Offline
Joined: 01/20/2009
Juice: 77
oops

Hi Ryan,

Thank you, I discovered this right after my post (I don't remember having to enable this in drupal5...) I was able to get all to work correctly!

-Kim

Vinegar Joe's picture
Offline
Joined: 10/15/2009
Juice: 2
Re: oops

Apologies for digging up an old thread, but since my problem is almost exactly as described above I figured this would be a good place to post.

I'm using this code from Ryan above:

<?php
$order
= uc_order_load($_SESSION['cart_order']);
?>

<img border="0" src="http://www.sitename.com/share/sale.php?profile=72198&idev_saleamt=<?php print $order->order_total; ?>&idev_ordernum=<?php print $order->order_id; ?>" width="1" height="1">

But the $order->order_total and $order->order_id are coming out blank. I have the PHP filter installed and turned on for the Checkout completion message header.

I'm using Drupal 6 and Ubercart 2.0-rc7. Any help would be appreciated.

zeezhao's picture
Offline
Joined: 04/23/2008
Juice: 956
try: $order =

try:
$order = uc_order_load( intval($_SESSION['cart_order']));

Unless you cart_order variable is not set...

cjscullyca's picture
Offline
Joined: 06/17/2009
Juice: 70
Re: Re: oops

I just decided to implement something more robust than the affiliate module on my site and found this thread when searching for a way to more tightly integrate iDevaffiliate with Ubercart. I didn't find what I was looking for but noted some things here and I thought I'd post about them in case anyone else comes looking for the same info:

Vinegar Joe wrote:

Apologies for digging up an old thread, but since my problem is almost exactly as described above I figured this would be a good place to post.

I'm using this code from Ryan above:

<?php
$order
= uc_order_load($_SESSION['cart_order']);
?>

<img border="0" src="http://www.sitename.com/share/sale.php?profile=72198&idev_saleamt=<?php print $order->order_total; ?>&idev_ordernum=<?php print $order->order_id; ?>" width="1" height="1">

But the $order->order_total and $order->order_id are coming out blank. I have the PHP filter installed and turned on for the Checkout completion message header.

I'm using Drupal 6 and Ubercart 2.0-rc7. Any help would be appreciated.

There were a couple of syntax errors in the above code snippet (the parentheses were left out). At least it didn't work for me until I changed it to:

<?php
$order
= uc_order_load($_SESSION['cart_order']);
?>

<img border="0" src="http://www.sitename.com/share/sale.php?profile=72198&idev_saleamt=<?php print($order->order_total); ?>&idev_ordernum=<?php print($order->order_id); ?>" width="1" height="1">

fossle wrote:

Using the snippet already available above, I just tried $subtotal instead of $order->order_total

Any idea why this would not work?

We really need to get this working.

The order object doesn't appear to contain a subtotal member per se, which is why $subtotal wouldn't work. To get the subtotal you need to access the correct amount variable in the line items array (the one with line_item_id = subtotal) or iterate through the products array and add up the prices for each product and pass the resulting subtotal to iDevaffiliate instead of $order->order_total.