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 [url=“CS-Cart Documentation — CS-Cart 4.16.x documentation”]CS-Cart Documentation — CS-Cart 4.16.x documentation and created the file order_confirmation.override.tpl in the correct place. Here is the content so far (with 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.