osCSS is the leading Open Source online shop e-commerce solution thatis available for free under the GNU General Public License. It featuresa rich set of out-of-the-box online shopping cart functionality thatallows store owners to setup, run, and maintain their online storeswith minimum effort and with no costs, license fees, or limitationsinvolved.

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

1.

Edit template

Find and open file /includes/content/checkout_success.php

2.

Locate right place for integration

Inside the file find this line <!-- extra divs to add extra pictures. -->

3.

Add integration code

Insert the following code just above that line:

<?php
   //--------------------------------------------------------------------------
   // STAT - PAP Integration code
   //--------------------------------------------------------------------------
   // 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 != "")
   {
      print '<script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>'."
            <script type="text/javascript">
             var sale = PostAffTracker.createSale();
             sale.setTotalCost('$pap_total_value');
             sale.setOrderID('$pap_order_id');

             PostAffTracker.register();
             </script>";
             }
   //--------------------------------------------------------------------------
   // END - PAP Integration code
   //--------------------------------------------------------------------------
?>