Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Adding Line Items Into Affiliate Tracking Code Rate Topic   - - - - -

 
  • chrisdicken
  • Junior Member
  • Members
  • Join Date: 03-Mar 11
  • 1 posts

Posted 03 March 2014 - 05:50 PM #1

I wish to implement an affiliate scheme with some tracking code in the order confirmation page that transmits the order information to a third party.

Using CS-Cart 2.2.4

I've found http://kb.cs-cart.co...g-code-addition and created the file order_confirmation.override.tpl in the correct place. Here is the content so far (with <script> tags removed):

irEvent.setOrderId("{$order_info.order_id}");
irEvent.addItem("{$item.product}", "{$item.product_code}", "{$item.price}", {$item.amount});
irEvent.setPromoCode("");
irEvent.fire();

The problem is that I need to add a new row to the script for each line item in the shopping cart (above, it's the line that begins 'irEvent.addItem')

e.g.

irEvent.setOrderId("abc1234");
irEvent.addItem("mp3player1", "sku-1234", "109.00", 1);
irEvent.addItem("mp3player2", "sku-1235", "545.00", 5);
irEvent.setPromoCode("");
irEvent.fire();

I don't know the correct PHP for a loop to list a 'irEvent.addItem' line for each line item in the cart. Hoping that it's a simple bit of code I can just slot in.

Any help or advice would be gratefully received.