Sam-AUST Posted June 22, 2016 Share Posted June 22, 2016 Our store has an affiliate program running through Shareasale (for over 10 years now), on building a new website we have found the code on the checkout pages has obviously changed quite a lot. but the tracking code provided for oscommerce is from 2006. This is the code shareasale provides for oscommerce. There are two pages where you need to make changes. In the page: catalog/checkout_process.php, just above the line: // load the after_process function from the payment modules add the following code: // Begin Affiliate Program - Sales Tracking $orders_total=$currencies->format($cart->show_total()- $total_tax); tep_session_register('orders_total'); $orders_id=$insert_id; tep_session_register('orders_id'); // End Affiliate Program - Sales Tracking In the page: catalog/checkout_success.php, just below the line, <h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td> add the following code: <!-- Start Affiliate Program - Sales Tracking --> <?php echo '<img src="https://shareasale.com/sale.cfm?amount='.$orders_total.'&tracking='.$orders_id.'&transtype=sale&merchantID=XXXX" width="1" height="1">'; tep_session_unregister('orders_total'); tep_session_unregister('orders_id'); ?> <!-- // End Affiliate Program - Sales Tracking --> Where you replace XXXX with your merchant ID number. and an alternative for the success page: If that does not work, try changing the code in the checkout_process page to this: // Begin Affiliate Program - Sales Tracking $orders_total=$currencies->format($order->info['subtotal']); tep_session_register('orders_total'); $orders_id=$insert_id; tep_session_register('orders_id'); // End Affiliate Program - Sales Tracking Is there any way in the latest oscommerce version to make this work? Link to comment Share on other sites More sharing options...
burt Posted June 23, 2016 Share Posted June 23, 2016 For modern versions of osCommerce (2.3.1 onwards, including community Responsive version), this is done ALL in checkout_success.php and would be a Content module. So, you end up with a Content Module, which you drop into your osCommerce file structure. You then go into admin and turn it on. That can be done with zero core code changes, which is the absolute best way to do it. Link to comment Share on other sites More sharing options...
Sam-AUST Posted June 23, 2016 Author Share Posted June 23, 2016 Is that an existing thing in the version or is it something I need to have made? Link to comment Share on other sites More sharing options...
♥GLWalker Posted June 23, 2016 Share Posted June 23, 2016 I'm not at a computer right now, but of memory serves me right, there's one in this package http://addons.oscommerce.com/info/8793 Follow the community build: BS3 to osCommerce Responsive from the Get Go! Check out the new construction: Admin Gone to Total BS! Link to comment Share on other sites More sharing options...
Sam-AUST Posted June 24, 2016 Author Share Posted June 24, 2016 Thank you very much for this. Link to comment Share on other sites More sharing options...
♥GLWalker Posted June 24, 2016 Share Posted June 24, 2016 Let me know if it still has all the necessary fields. I should probably repackage it and add as its own module in the uploads so people can find it. Follow the community build: BS3 to osCommerce Responsive from the Get Go! Check out the new construction: Admin Gone to Total BS! Link to comment Share on other sites More sharing options...
burt Posted June 24, 2016 Share Posted June 24, 2016 Let me know if it still has all the necessary fields. I should probably repackage it and add as its own module in the uploads so people can find it. Why not use the order_total? This is the value after any discount if memory serves...then it can be a lot less code... Link to comment Share on other sites More sharing options...
♥GLWalker Posted June 24, 2016 Share Posted June 24, 2016 Why not use the order_total? This is the value after any discount if memory serves...then it can be a lot less code... As I remember (was a long time since I coded them), the order total would also include the shipping - if any. So I would have to get the sub-total, and I believe the subtotal was before any discount applied. Sub total alone would even be better, but I did run into a situation where coupons were in use and the advertisers found themselves paying out commission for orders before discounts were calculated - thus the extra markup to exclude the 2 more popular coupon addons at the time. Follow the community build: BS3 to osCommerce Responsive from the Get Go! Check out the new construction: Admin Gone to Total BS! Link to comment Share on other sites More sharing options...
♥GLWalker Posted June 24, 2016 Share Posted June 24, 2016 Now you had me thinking, order total - shipping BAM - there it is. Damnit Burt, your determined to make me re-code it. Follow the community build: BS3 to osCommerce Responsive from the Get Go! Check out the new construction: Admin Gone to Total BS! Link to comment Share on other sites More sharing options...
burt Posted June 25, 2016 Share Posted June 25, 2016 Forgot about the possibility of other order_total modules and tax :( SubTotal might be the better option. Link to comment Share on other sites More sharing options...
Sam-AUST Posted June 28, 2016 Author Share Posted June 28, 2016 G'day guys, I was just coming here to mention this. It's installed and I've tested it with and without discount coupons. It gives the full amount of the sale, even if a discount has been applied. It definitely should be the amount AFTER the coupon has been applied. In the meantime we will just have to manually edit the total amount. Link to comment Share on other sites More sharing options...
Sam-AUST Posted June 28, 2016 Author Share Posted June 28, 2016 Another thought, if the shop is foreign, there ought to be a way to make sure the amount is in the right currency, hehehe Link to comment Share on other sites More sharing options...
Sam-AUST Posted June 28, 2016 Author Share Posted June 28, 2016 FYI my old store checkout_process had this in it to make sure the right currency was being passed along to SAS. // Begin Affiliate Program - Sales Tracking $orders_total = number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value('USD'), $currencies->get_decimal_places('USD')); tep_session_register('orders_total'); $orders_id=$insert_id; tep_session_register('orders_id'); // End Affiliate Program - Sales Tracking Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.