Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2011
    Posts
    5
    Plugin Contributions
    0

    Default Combining product quantities for volume discount

    I've seen this question asked before in the past, and the answer was "no". I apologize in advance for bringing it up again, but I was hoping that someone had found a solution in the meantime.

    Is there a way to count different products' quantities for the Products Price Manager quantity discount?

    In my store, I have multiple products that I want to offer quantity discounts on. My customers expect to be able to mix-and-match some (but not all) products to meet the discount quantities. I like the format of discount that the Product Price Manager produces. The price schedule shows up in the product description and when quantities are met, the discounted unit prices show up in the shopping cart. I can also create different discount schedules for different products, which is important to protect me from over-discounting low margin products.

    But, Product Price Manager (PPM) won't combine different products' quantities.

    I can't combine my products into a single product differentiated by attributes, because the products have different attributes already. If I could get PPM to count quantities by category, I'd accept that, but I'd prefer a user definable discount class. I currently use different hierarchical categories to provide multiple navigation paths to products that are linked. A category-based quantity discount would require me to redo my category/product layout.

    I've tried the Quantity Discount Add-On Module, but it doesn't do what I'd like. It offers only one global discount schedule, does not show that schedule in the product description, does not show discounted unit prices (only a total discount amount), and (unless you pay extra), does not show the discount in the shopping cart. In order to get my customers to buy higher quantities, I need the discount to be more evident while they're purchasing. I also dislike how the add-on is implemented.

    I saw a virtuemart modification that changed the core code to count discount quantities by category rather than by product. Is something like that available for zencart? Better yet, is there a way to use some other tag (product metadata perhaps) to define the discount group?

    Thanks,
    Eric

  2. #2
    Join Date
    Jan 2011
    Posts
    5
    Plugin Contributions
    0

    Default Re: Combining product quantities for volume discount

    Ok, here is what I've come up with. I'm totally new to php programming, and zen cart programming, so I'm basically just copying what I've seen elsewhere, with changes based on a little browsing of the wiki. I may be barking up the wrong tree entirely. If there's a better way to do this, please point me to it.

    I've modified function in_cart_mixed_discount_quantity in file includes/classes/shopping_cart.php. I've changed
    PHP Code:
       // compute total quantity regardless of attributes
        
    $in_cart_mixed_qty_discount_quantity 0;
        
    $chk_products_idzen_get_prid($products_id);

        
    // reset($this->contents); // breaks cart
        
    $check_contents $this->contents;
        while (list(
    $products_id, ) = each($check_contents)) {
          
    $test_id zen_get_prid($products_id);
          if (
    $test_id == $chk_products_id) {
            
    $in_cart_mixed_qty_discount_quantity += $check_contents[$products_id]['qty'];
          }
        } 
    to:
    PHP Code:
        // compute total quantity regardless of attributes
        
    $in_cart_mixed_qty_discount_quantity 0;
        
    //!! $chk_products_id= zen_get_prid($products_id);
        
    $product $db->Execute("select products_id, master_categories_id from " TABLE_PRODUCTS " where products_id='" zen_get_prid($products_id) . "' limit 1");
        
    $chk_products_id$product->fields['master_categories_id'];

        
    // reset($this->contents); // breaks cart
        
    $check_contents $this->contents;
        
    reset($check_contents);
        while (list(
    $products_id, ) = each($check_contents)) {
          
    //!! $test_id = zen_get_prid($products_id);
          
    $product $db->Execute("select products_id, master_categories_id from " TABLE_PRODUCTS " where products_id='" zen_get_prid($products_id) . "' limit 1");
          
    $test_id$product->fields['master_categories_id'];
          if (
    $test_id == $chk_products_id) {
            
    $in_cart_mixed_qty_discount_quantity += $check_contents[$products_id]['qty'];
          }
        } 
    I've changed the count from products with the same id to products with the same master category id. It seems to work. I realize that it will only combine totals if the product has "Discount Qty Applies to Mixed Attributes" set to "yes", but I think that may be a good thing. If there's a product that I don't want to combine, all I have to do is change that setting to "No".

    Since it's checking the master category id, I think it will combine linked products based on the primary category, not the category that the customer used to navigate to them. Again, I think that's a good thing. It allows me to set up a category for products with combined discounts, and other categories that link those products for easier navigation.

    I'm slightly concerned that counting this way may result in quantity totals that exceed a product's maximum purchase quantity, but I don't see where that causes any problem.

    Again, I'm new at this, so I've probably overlooked something. If I missed any important points, or if there's a better way to do this, please let me know. I welcome any feedback.

    Regards,
    Eric

  3. #3
    Join Date
    Jan 2016
    Location
    Denmark, Copenhagen
    Posts
    39
    Plugin Contributions
    0

    Default Re: Combining product quantities for volume discount

    Hi,

    Have you found a solution to your problem ? I am interested to know if you had.

  4. #4

    Default Re: Combining product quantities for volume discount

    I am upgrading from 1.5.1 to 1.5.5 and now suddenly my volume discount is no longer working.
    Anyone experiencing the same problem?

    I give quantity discounts, e.g. 6 pieces or more, that is working fine.
    But I use above code to give the same discount if 6 pieces are ordered from the same category, so customers are allowed to combine products from the same category which have the same quantity discount.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Combining product quantities for volume discount

    There was a change in what gets cached which may be a cause for this no longer working because the query(ies) look similar the returned data may not be getting updated.

    Try at the end of your $db->Execute() within the parentheses adding:
    Code:
    , false, false, 0, true
    So that could look like:
    Code:
    $db->Execute($sql_query, false, false, 0, true);
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6

    Default Re: Combining product quantities for volume discount

    now the last is like this:
    $product = $db->Execute("select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id='" . zen_get_prid($products_id) . "' limit 1", false, false, 0, true);

    but it does not help.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Combining product quantities for volume discount

    Quote Originally Posted by manage-it View Post
    now the last is like this:
    $product = $db->Execute("select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id='" . zen_get_prid($products_id) . "' limit 1", false, false, 0, true);

    but it does not help.
    Did you only change the one? Or both additional queries get the additional command(s)?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8

    Default Re: Combining product quantities for volume discount

    thanks it works!. I only changed one.

  9. #9
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Combining product quantities for volume discount

    Quote Originally Posted by manage-it View Post
    thanks it works!. I only changed one.
    Does that mean when you changed the second one all started working? (sorry, trying to make sure the solution is/was clear for whomever might be interested in the future.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Combining Products for Discount Price
    By sparrowce in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 26 Feb 2011, 09:41 PM
  2. Discount groups and volume discount?
    By Mammoth in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 29 Jun 2010, 11:21 PM
  3. Setting up Product Volume Discount
    By boukmn in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 22 Aug 2008, 03:58 AM
  4. Price Breaks / Discount Levels for EXACT quantities?
    By ethan666 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 29 Jan 2008, 02:35 AM
  5. Volume Discount
    By tvmangum in forum Setting Up Specials and SaleMaker
    Replies: 2
    Last Post: 29 Sep 2007, 02:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR