Jump to content
swguy

[Contribution] Better Together Discounting Module

Recommended Posts

If you want you can change the code to replace the old table defines with the hardcoded names,  but it will be faster just to use the patch I just posted. 


Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Share this post


Link to post
Share on other sites
On 7/31/2019 at 11:05 PM, swguy said:

Adding back the defines will fix the issue. 

In includes/modules/order_total/ot_better_together.php after php starts, add: 

if (!defined('TABLE_PRODUCTS')) {
  define('TABLE_PRODUCTS', 'products');
}
if (!defined('TABLE_PRODUCTS_TO_CATEGORIES')) {
  define('TABLE_PRODUCTS_TO_CATEGORIES', 'products_to_categories');
}
if (!defined('TABLE_TAX_RATES')) {
  define('TABLE_TAX_RATES', 'tax_rates');
}

Yeah this fixed it

Share this post


Link to post
Share on other sites

The usual way to fix this is to just use the table names in your queries....ie replace TABLE_TAX_RATES with tax_rates....problem solved.

Dan

Share this post


Link to post
Share on other sites

Agreed - I'm just getting all the required changes sorted and then I'll submit an update. 


Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Share this post


Link to post
Share on other sites

Installed and playing with the contribution - 2.3.4.1 CE Edge and PHP 7.0

This is what I'm testing:

$this->add_cat_to_cat(3,3,"%", 100);

Which essentially means - buy one from category 3, get one from category 3 for free (100% off)

If I put 10 items in my cart from category 3....5 of them are being discounted 100% and given for free.

Buy One, Get One Free...over and over and over

Is there a way to limit this to only one free item per cart? 

Sorry if this has been answered already.  I rushed thru this thread and didn't see anything.

- Andrea

Share this post


Link to post
Share on other sites

Nothing is built in.  But if you look at includes/modules/order_total/ot_better_together.php around line 310 where it says

       for ($i=0, $n=sizeof($discountable_products); $i<$n; $i++) {
you could do a check like: 

if ($discount > 0) break; 

 

 

 


Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Share this post


Link to post
Share on other sites
15 minutes ago, swguy said:

if ($discount > 0) break; 

Perfect!  Thank You so much!

- Andrea

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×