Thanks for the great add-on. It's functionality is exactly what I needed without too many modifications. After testing the coupon codes, there are 2 problems I ran across, but not sure if there are more.
1) when you set a minimum order, it was calculating the minimum based on the order total, which included tax and shipping. I needed the minimum to be on the subtotal of all items purchased before shipping and tax.
2) the tax calculation is based on the subtotal before discount. I'd like the tax to be calculated after the discount. I've tried what others have posted before with no luck. The tax is still calculated incorrectly.
I was able to solve #1 with a minor change, which I have posted below if anyone needs it. If anyone has solved the tax problem, please post a solution. Thanks.
in ot_discount.php on line 40, change:
$check_query = tep_db_query("select dc.products_id, dc.categories_id, dc.manufacturers_id, dc.excluded_products_id, dc.customers_id, dc.orders_total, dc.order_info, dc.discount_values, dc.number_of_products from " . TABLE_DISCOUNT_CODES . " dc where dc.discount_codes = '" . tep_db_input($sess_discount_code) . "' and if(dc.expires_date = '0000-00-00', date_format(date_add(now(), interval 1 day), '%Y-%m-%d'), dc.expires_date) >= date_format(now(), '%Y-%m-%d') and dc.minimum_order_amount <= " . $order->info['total'] . " and dc.status = '1' limit 1");
to:
$check_query = tep_db_query("select dc.products_id, dc.categories_id, dc.manufacturers_id, dc.excluded_products_id, dc.customers_id, dc.orders_total, dc.order_info, dc.discount_values, dc.number_of_products from " . TABLE_DISCOUNT_CODES . " dc where dc.discount_codes = '" . tep_db_input($sess_discount_code) . "' and if(dc.expires_date = '0000-00-00', date_format(date_add(now(), interval 1 day), '%Y-%m-%d'), dc.expires_date) >= date_format(now(), '%Y-%m-%d') and dc.minimum_order_amount <= " . $order->info['subtotal'] . " and dc.status = '1' limit 1");
It's a simple one word change to check minimum order using order subtotal instead of order total.
BTW- I am using Discount Code version 2.9 on oscommerce 2.2 (newer add on with older shopping cart)
Best,
Iffy
www.cuddlebugfactory.com