Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Better Together Discounting Module


swguy

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.

Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

Phoenix users - please get Better Together for Phoenix here: 

https://apps.oscommerce.com/Apps&amp;XpyA1&amp;better-together-for-phoenix

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

Link to comment
Share on other sites

  • 1 month later...

@swguy Dear Scott,

I have been playing with this wonderful app of yours for some time. Yesterday, I saw a FAQ on your website:

Quote

Q: What would my setup() look like if I wanted to do buy one of item 5, get one from category 2, 7 or 9 at $5 off?
A: Here's what you would do:


  function setup() { 
      $this->add_prod_to_cat(5,2,"$", 5); 
      $this->add_prod_to_cat(5,7,"$", 5); 
      $this->add_prod_to_cat(5,9,"$", 5); 
  }

So, I tried a similar promo and tested it. To my surprise, the promo will calculate $5 discount only, no matter items of one,  two or all three categories 2, 7 and 9 are included in checkout. It seems the discount only apply to the first pair of better together promo and ignore the others. Is the algorithm meant to work this way?

 

Link to comment
Share on other sites

Yes it is. Better Together deals with pairs of items. Get ONE from ONE of these categories (2 OR 7 OR 9). 

If you need "get multiple from any of these categories" look at Big Chooser.

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...