Any comments, suggestions, or mistakes:

Integrating Ultimate Affiliate with OSCommerce (

OSCommerce is a great open-source PHP/MySQL shopping cart that is easy to set up and very flexible to edit. It can be integrated with Ultimate Affiliate easily. You can find various tips and tricks in the oscommerce forms and download areas, but here I've put together some custom coding that not only allows you to trigger commissions, but also to send to the cart contents to the affiliate program so that theoretically you could create commissions schemes for each product - and it even handles quantities!


You will be editing two files, the first being checkout_process.php which is in the main store script directory. In this file find the lines:

// load the after_process function from the payment modules


and above those lines paste this code:

// Begin Ultimate Affiliate code
for ($i=0; $i<$order_size; $i++) {
$aff_product_ids .= tep_get_prid($order->products[$i]['id']) . ",";
$aff_product_names .= $order->products[$i]['name'] . ",";
$aff_product_quantities .= $order->products[$i]['qty'] . ",";
$aff_total = $currencies->format($cart->show_total()- $total_tax);
// End Ultimate Affiliate code


Now, you will edit checkout_success.php to add the code that triggers the commission. This code will be variable depending on how you want to trigger commissions and if you want to use the schemes, etc...

Find this line in the file:

<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3>

And below it you can paste the code that will trigger the commission:

// TOTAL: $aff_total
// ORDER ID: $aff_id
// PRODUCT IDS: $aff_product_ids
// PRODUCT NAMES: $aff_product_names
// PRODUCT QUANTITIES: $aff_product_quantities
<img src="

Now, in the code above I give you some variables to work with:

$aff_total: will be replaced with the final subtotal of the cart minus shipping/tax
$aff_id: the cart order id
$aff_product_ids: A sequential list of the OSCommerce product id for each product in the cart
$aff_product_names: A sequential list of the product names for each product in the cart
$aff_product_quantities: A sequential list of the quantities of each product in the cart.

All of the sequential product lists are in order and match sequentially.

In the most basic setup, you could trigger a commission with:

<img src="$aff_total&goods=$aff_id">

But you may need to use the variables and place them in the javascript popup method if need be, and if you're using the schemes you'll need to insert the $aff_product_ids and $aff_product_quantities variables into the $scheme and $scheme_quantities variables in the url to trigger the commission (to sale.cgi - see the above example.

© 1998 - present, All Rights Reserved