Home Integration Methods osCommerce

osCommerce

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.
1
Find file checkout_success.php
Find and open file checkout_success.php in osCommerce source files.
2
Locate right place for integration
Inside the file find this line if ($global['global_product_notifications'] != '1') { ...
it should be somewhere after  <! DOCTYPE ........> line.
3
Add integration code
insert the following code just above that line

4
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.
5
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.

6
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:
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.
7
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:
The last step is to modify customer ID saved in custom field, to the the value without PAP4 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.