Integration with CRE Loaded is made by placing sale tracking script into the confirmation page. To obtain the values of OrderID and TotalSale, snippet connects to CRE Loaded database and retrieves the values from there.

1.

Locate file checkout_success.php

Find and open file:checkout_success.php

2.

Find correct place for integration in file

Inside file checkout_success.php find these lines:// load all enabled checkout success modulesrequire(DIR_WS_CLASSES . 'checkout_success.php');

3.

Insert code

Before these lines insert this code:

 //--------------------------------------------------------------------------
  // Post Affiliate Pro code
  // The code below will get the order_id and total value of recent order
  // from the database and displays invisible image that registers the sale
  // for affiliate (if some affiliate referred this visitor)
  //--------------------------------------------------------------------------

  // get order id
  $sql = "select orders_id from ".TABLE_ORDERS.
         " where customers_id='".(int)$customer_id.
         "' order by date_purchased desc limit 1";
  $pap_orders_query = tep_db_query($sql);
  $pap_orders = tep_db_fetch_array($pap_orders_query);
  $pap_order_id = $pap_orders['orders_id'];

  // get total amount of order
  $sql = "select value from ".TABLE_ORDERS_TOTAL.
         " where orders_id='".(int)$pap_order_id.
         "' and class='ot_subtotal'";
  $pap_orders_total_query = tep_db_query($sql);
  $pap_orders_total = tep_db_fetch_array($pap_orders_total_query);
  $pap_total_value = $pap_orders_total['value'];

  // draw invisible image to register sale
  if($pap_total_value != "" && $pap_order_id != "")
  {
    $pap_sale_img = '<img src="http://URL_TO_PostAffiliatePro/scripts/sale.php?TotalCost='.$pap_total_value.'&OrderID='.$pap_order_id.'&data1=data_value1&data2=data2_value" width=1 height=1>';
  }

  //--------------------------------------------------------------------------
  // END of Post Affiliate Pro code
  //--------------------------------------------------------------------------

4.

Locate template

Find and open file: /templates/content/checkout_success.tpl.php

5.

Find correct place for integration

In this file find:

</table></form>

6.

After this line insert this code:

<?php
//--------------------------------------------------------------------------
// START of Post Affiliate Pro code
//--------------------------------------------------------------------------
echo $pap_sale_img;
//--------------------------------------------------------------------------
// END of Post Affiliate Pro code
//--------------------------------------------------------------------------
?>

7.

You are ready

Your CRE Loaded shopping cart is integrated now. Every time customer enters the order confirmation page the tracking code is called and it will register a sale for referring affiliate.Note: Tested on CRE Loaded 6.2 Pro B2B 6.2.06