–Hidden comment

Use attributes in format region_from and region_to= to change the languages showing in language switcher.
Available regions are:
europe_from europe_to
asia_from asia_to
mideast_from mideast_to
america_from america_to

Example:
europe_from=0 europe_to=22 will put all languages (ordered in language switcher settings) from 1 to 21 to Europe region:
asia_from=22 asia_to=25 will put all languages from 23 to 24 (so only 2) into Asia region.

osCommerce

A free online shop program featuring order history, shopping carts, full search capability, product reviews, secure transactions, bestseller lists, and related items.

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

Find file checkout_success.php

Find and open file checkout_success.php in osCommerce source files.

Locate right place for integration

Inside the file find this line:

if ($global['global\_product\_notifications'] != '1') {...

it should be somewhere after this line:

<! DOCTYPE ........>

Add integration code

Insert the following code just above that line:

  //--------------------------------------------------------------------------
   // 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'];

   //get product ids
    $sql = "select products_id from " .TABLE_ORDERS_PRODUCTS.
          " where orders_id=".(int)$pap_order_id;
    $pap_orders_products_query = tep_db_query($sql);
    $pap_orders_products = '';
    while ($row = tep_db_fetch_array($pap_orders_products_query)) {
        $pap_orders_products .= $row['products_id'] . ',';
    }
    $pap_orders_products = substr($pap_orders_products, 0, -1);

   // draw invisible image to register sale
   if($pap_total_value != "" && $pap_order_id != "")
   {
      print '<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
'."<script type=\"text/javascript\">PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost('$pap_total_value');
sale.setOrderID('$pap_order_id');
sale.setProductID('$pap_orders_products');

PostAffTracker.register();
</script>";
   }
   //--------------------------------------------------------------------------
   // END of integration code
   //--------------------------------------------------------------------------

Integration is finished

It is now integrated. Every time customer enters the order confirmation page the tracking code is called and it will register a sale for referring affiliate.

Another integration

If you plan to divide products into more campaigns, you will probably need another integration, that will divide the whole sale into single product sales.

//--------------------------------------------------------------------------
   // 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 variables for script
    $sql = "select products_id,products_price,products_quantity from " .TABLE_ORDERS_PRODUCTS.
          " where orders_id=".(int)$pap_order_id;
    $pap_products_total_query = tep_db_query($sql);
    $k = 0;
    while ($row = tep_db_fetch_array($pap_products_total_query)) {
        $pap_products_total[$k+1] = $row['products_price'] * $row['products_quantity'];
        $pap_products[$k+1] = $row['products_id'];
        $k++;
    }

    // draw invisible image to register sale
    if($pap_order_id != "")
    {

    ?>
    <script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
    <script type="text/javascript">
 PostAffTracker.setAccountId('Account_ID');    <?php
     for ($j=1; $j<=$k; $j++){
      echo "var sale".$j." = PostAffTracker.createSale();\n".
           "sale".$j.".setTotalCost('". $pap_products_total[$j]."');\n".
           "sale".$j.".setOrderID('".$pap_order_id."');\n".
           "sale".$j.".setProductID('".$pap_products[$j]."');\n\n";
     }
    ?>
    
    PostAffTracker.register();
    </script>;
    <?php
    }
   //--------------------------------------------------------------------------
   // END of integration code
   //--------------------------------------------------------------------------

Direct PayPal integration with osCommerce

If you want to rely on PayPal IPN (as this is secure and 100% sure that the transaction will be recorded), you can directly edit the PayPal button template in osCommerce. Login to your FTP and navigate to catalog/includes/modules/payment/ and edit file paypal_standard.php.

Find function process_button and scroll down to end of it. You should find this block of code:

} else {
    reset($parameters);
    while (list($key, $value) = each($parameters)) {
      $process_button_string .= tep_draw_hidden_field($key, $value);
    }
 }

  return $process_button_string;

// --------------------------------------------
// change this whole block of code to this block:

} else {
        reset($parameters);
        while (list($key, $value) = each($parameters)) {
          if ($key == "custom") {
            $tofix = tep_draw_hidden_field($key, $value);
            $process_button_string .= substr($tofix,0,-1) .' id="pap_ab78y5t4a" >';
          }
          else {
            $process_button_string .= tep_draw_hidden_field($key, $value);
          }
        }
      }

      $process_button_string .= '<script type="text/javascript">';
      $process_button_string .= 'document.write(unescape("%3Cscript id=%27pap_x2s6df8d%27 src=%27" + (("https:" == document.location.protocol) ? "https://" : "http://") + "URL_TO_PostAffiliatePro/scripts/trackjs.js%27 type=%27text/javascript%27%3E%3C/script%3E"));';
      $process_button_string .= '</script><script type="text/javascript">PostAffTracker.setAccountId(\'default1\');';
      $process_button_string .= 'PostAffTracker.setAppendValuesToField(\'||\');';
      $process_button_string .= 'PostAffTracker.writeCookieToCustomField(\'pap_ab78y5t4a\');</script>';

      return $process_button_string;

This will add tracking script directly to the paypal button and insert proper value into custom parameter.

Now, you have to resend the IPN from osCommerce to PAP too. See the next step.

PayPal redirect to PAP

When there is a sale, PayPal sends IPN to your osCommerce. You have to resend it to PAP to save the transaction. Navigate to catalog/ext/modules/payment/paypal/ in your FTP and modify file standard_ipn.php . Insert the following code to the beginning of the file:

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, "https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php");
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
 curl_exec($ch);

The last step is to modify customer ID saved in custom field, to the the value without PAP visitor ID. Find line:

if ($result == 'VERIFIED') {

and add the following code above the line:

$separator = '||';
    if ($_POST['custom'] != '') {
      $explodedCustomValue = explode($separator, $_POST['custom'], 2);
          if (count($explodedCustomValue) == 2) {
            $_REQUEST['custom'] = $_POST['custom'] = $explodedCustomValue[0];
            $HTTP_POST_VARS['custom'] = $explodedCustomValue[0];
      }
    }

Do not forget to integrate your website with the click tracking code.

Back to Integrations Create account for FREE
Would you like to improve your affiliate software even more? Check out the Paymate Express integration for Post Affiliate Pro.

Paymate Express

The text provides instructions on integrating Paymate Express, a payment service for online transactions, with PostAffiliate Pro. It includes steps for choosing a custom value separator, updating Paymate button code, adding integration code to Paymate button form, and integrating with processing scripts. The text also offers additional resources on integrating with other payment services.

Would you like to improve your affiliate software even more? Check out the aMember v4 integration for Post Affiliate Pro.

aMember v4

The article discusses the integration of aMember v4 software with PayPal and Post Affiliate Pro for accepting membership payments, managing profiles, delivering digital content, and running an affiliate program. The process includes getting the cookie value, adding a custom parameter to the PayPal request, handling IPN notifications, and syncing aMember signup with Post Affiliate Pro. The necessary files and code changes are described in detail with step-by-step instructions.

Would you like to improve your affiliate software even more? Check out the PayPal Express Checkout (IPN & custom field) for Post Affiliate Pro.

PayPal Express Checkout (IPN and custom field used by other script)

Would you like to improve your affiliate software even more? Check out the PayPal Express Checkout (IPN & custom field) for Post Affiliate Pro.

Would you like to improve your affiliate software even more? Check out the ZenCart integration for Post Affiliate Pro.

ZenCart

Would you like to improve your affiliate software even more? Check out the ZenCart integration for Post Affiliate Pro.

Our website uses cookies. By continuing we assume your permission to deploy cookies as detailed in our privacy and cookies policy.

×

Schedule a one-on-one call and discover how Post Affiliate Pro can benefit your business.

We’re available on multiple dates

Schedule a call