Results 1 to 11 of 11
  1. #1
    Newbie
    Join Date
    April 20th, 2009
    Posts
    14
    Unhappy Affiliate Tracking Code in Virtuemart
    Does anyone use the Virtuemart shopping cart? I'm a merchant trying to sign up with an affilaite network and the javascript code they asked me to paste into the checkout.thankyou page does not pass back the order id and subtotal to the network.

    Wondering if anyone can help. Is there some setting I need to turn on or off? Here is the code I was asked to paste.

    I read on some blog that in virtuemart, you need to call the order_subtotal variable since it does not appear on the thank you page. Not sure how I can do that.

    <script language="javascript"
    src="https://scripts.affiliatefuture.com/AFFunctions.js"></script>
    <script language="javascript">
    var merchantID = XXXX;
    var orderValue = '.$db->f(order_subtotal).';
    var orderRef = '.$order_id.';
    AFProcessSaleV2(merchantID, orderValue,orderRef);
    </script>


    Can anyone help.

    Thanks.

  2. #2
    Analytics Dude Kevin's Avatar
    Join Date
    January 18th, 2005
    Location
    Rochester, NY
    Posts
    5,904
    Did you try the VM support forum? I'll bet someone must be doing it somehow.
    Kevin Webster
    twitter: levelanalytics

    Kayak Fishing
    Web Analytics and Affiliate Marketing

  3. #3
    Newbie
    Join Date
    April 20th, 2009
    Posts
    14
    I did but didn't get any response there.

  4. #4
    Analytics Dude Kevin's Avatar
    Join Date
    January 18th, 2005
    Location
    Rochester, NY
    Posts
    5,904
    Hmm. Try digging for info on using Google Analytics to track e-commerce over there. It must grab the same parameters, no?
    Kevin Webster
    twitter: levelanalytics

    Kayak Fishing
    Web Analytics and Affiliate Marketing

  5. #5
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    Try this code above the javascript.

    PHP Code:
      <?php
       $q 
    "SELECT * FROM #__{vm}_orders WHERE order_id=".$d['order_id'];
       
    $db->query$q );
       
    $order_total $db->f('order_subtotal' )- $db->f('coupon_discount');
      
    ?>
    And in the javascript change
    Code:
    var orderValue = '.$db->f(order_subtotal).';
    to
    Code:
    var orderValue =<?php echo $order_total;?>;
    Adapted from:
    http://joomlamarketingtips.com/produ...liate-4.0.html

  6. #6
    Analytics Dude Kevin's Avatar
    Join Date
    January 18th, 2005
    Location
    Rochester, NY
    Posts
    5,904
    Great post, Donk. Thank you.
    Kevin Webster
    twitter: levelanalytics

    Kayak Fishing
    Web Analytics and Affiliate Marketing

  7. #7
    Newbie
    Join Date
    April 20th, 2009
    Posts
    14
    Thanks Donk. That was very helpful. Until now, even the sale was not being tracked back but with your code, the sale is being tracked. However, the order id is being passed back as "$order_id" instead of the actual order id. And the order total is being passed back as $0. Can you please advise.

    Thanks again. I was pulling my hair over this all week.

  8. #8
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    The original code appears to be a mixture of javascript and PHP.

    You could try changing

    Code:
    var orderRef = '.$order_id.';
    Code:
    var orderRef = "<?php echo $d['order_id'] ?>";
    .

    Failing that you could try changing $d['order_id'] to $order_id.

    Regards

    Bob

  9. #9
    Newbie
    Join Date
    April 20th, 2009
    Posts
    14
    Final code
    Thanks Donk. I figured it out last night based on the link you posted. I just had to add another block of php code. I am not a programmer so I just copied and pasted what I thought made sense. Here is the final code that works. Just thought I'd post it to save others in my postion the headache I went through to get this to work. There is no help on the Virtuemart forum either.

    <?php
    $q = "SELECT * FROM #__{vm}_orders WHERE order_id= $order_id ";
    $db->query( $q );
    $order_totala = $db->f('order_subtotal' )- $db->f('coupon_discount');
    $q = "SELECT * FROM #__{vm}_orders WHERE order_id= $order_id ";
    $db->query( $q );
    $order_ida = $db->f('order_id');
    ?>

    <script language="javascript"
    src="https://scripts.affiliatefuture.com/AFFunctions.js"></script>
    <script language="javascript">
    var merchantID = XXXX;
    var orderValue="<?php echo $order_totala ?>";
    var orderRef="<?php echo $order_ida ?>";
    AFProcessSaleV2(merchantID, orderValue, orderRef);
    </script>

  10. #10
    Newbie
    Join Date
    April 20th, 2009
    Posts
    14
    Oh, and for those who are also looking for hwo to do this, this code has to be pasted in the file below (if you accept credit cards on your site).

    administrator/components/com_virtuemart/html/checkout.thankyou

    You have to modify and paste in a different file if your customer pays via paypal or other payment types.

  11. #11
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    Happy to have helped even though you had to solve it yourself.

    Regards

    Bob

  12. Newsletter Signup

Closed Thread

Similar Threads

  1. Affiliate programs offering "custom coupon code" tracking
    By stealthology in forum Midnight Cafe'
    Replies: 10
    Last Post: October 30th, 2010, 05:42 PM
  2. Replies: 4
    Last Post: February 2nd, 2008, 03:31 PM
  3. Replies: 1
    Last Post: August 9th, 2006, 06:14 PM
  4. Tracking Code?
    By mailman in forum Midnight Cafe'
    Replies: 2
    Last Post: November 25th, 2002, 05:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •