Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2006
    Posts
    9
    Plugin Contributions
    0

    Default Group Pricing + Quantity Discount

    Hello,
    I have both the Group Pricing and the Quantity Discounts installed and am trying to accomplish the following with no luck:
    I have setup a few price groups such as:
    50% group
    55% group

    I have also setup in the Quantity Discount section a discount level rule which says that if there are 25 items or more there is a 55% discount.

    My question is, how can I make them work together that when someone places an order of 25 items or more, the cart will ignore the group pricing and only use the discount from the Quantity Discount rule
    (in other words, I want all clients that purchase 25 items or more to get a fixed discount that will over ride any Group Pricing discounts).

    Any help appreciated - thanks in advance!

    Amit

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,625
    Plugin Contributions
    123

    Default Re: Group Pricing + Quantity Discount

    You would have to make GP and QD aware of each other; something they're not right now. Each of these modules stands alone.

    Scott
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Dec 2006
    Posts
    9
    Plugin Contributions
    0

    Default Re: Group Pricing + Quantity Discount

    Thanks Scott,
    Do you think it is possible with a simple IF sentence? If yes, would you have any direction to where that would be?

    Thank you,

    Amit

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,625
    Plugin Contributions
    123

    Default Re: Group Pricing + Quantity Discount

    Quote Originally Posted by zilwiz View Post
    Thanks Scott,
    Do you think it is possible with a simple IF sentence?
    In my experience these things are never that simple; there are tax implications
    and sort order implications and bla bla bla. You are welcome to PM me if you
    need help.

    Scott
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Dec 2006
    Posts
    9
    Plugin Contributions
    0

    Default Re: Group Pricing + Quantity Discount

    Quote Originally Posted by swguy View Post
    In my experience these things are never that simple; there are tax implications
    and sort order implications and bla bla bla. You are welcome to PM me if you
    need help.

    Scott

    Thanks for trying to help, but I managed to figure it out and it did turn out to be simple
    If anyone else needs this in the future, what I did was ad the following line in the includes\modules\order_total\ot_group_pricing.php file
    Code:
    $check_QD_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_1'");
      if ($_SESSION['cart']->count_contents() < $check_QD_query->fields['configuration_value']){
    Which disables the group pricing option when the quantity total is above the defined number.

    In the file it will look like this:
    Code:
    function calculate_deductions($order_total) {
      global $db, $order;
      $od_amount = array();
      $tax_address = zen_get_tax_locations();  
      $group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
      /// -  Check if Quantity Discount is enabled /////
     $check_QD_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_1'");
     if ($_SESSION['cart']->count_contents() < $check_QD_query->fields['configuration_value']){
     ///
      if ($group_query->fields['customers_group_pricing'] != '0') {
       $group_discount = $db->Execute("select group_name, group_percentage from " . TABLE_GROUP_PRICING . " where
                                            group_id = '" . (int)$group_query->fields['customers_group_pricing'] . "'");
       $gift_vouchers = $_SESSION['cart']->gv_only();
       $discount = ($order_total - $gift_vouchers) * $group_discount->fields['group_percentage'] / 100;
       $od_amount['total'] = round($discount, 2);
          /**
           * when calculating the ratio add some insignificant values to stop divide by zero errors
           */
          $ratio = ($od_amount['total'] + .000001)/($order_total - $gift_vouchers + .000001);
       switch ($this->calculate_tax) {
        case 'Standard':
              reset($order->info['tax_groups']);
              while (list($key, $value) = each($order->info['tax_groups'])) {
           $tax_rate = zen_get_tax_rate_from_desc($key);
           if ($tax_rate > 0) {
             $od_amount[$key] = $tod_amount = round(($order->info['tax_groups'][$key]) * $ratio, 2) ;
             $od_amount['tax'] += $tod_amount;
           }
              }
        break;
        case 'Credit Note':
              reset($order->info['tax_groups']);
              while (list($key, $value) = each($order->info['tax_groups'])) {
           $tax_rate = zen_get_tax_rate_from_desc($order->info['tax_groups']);
           if ($tax_rate > 0) {
             $od_amount[$key] = $tod_amount = round(($order->info['tax_groups'][$key]) * $ratio, 2) ;
             $od_amount['tax'] += $tod_amount;
           }
              }
        break;
       }
      }
     }  // - end Check if Quantity Discount is enabled ///
      return $od_amount;
     }
    Hope someone will find this usefully.

    Amit

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,625
    Plugin Contributions
    123

    Default Re: Group Pricing + Quantity Discount

    Bear in mind that this is not a general solution; it will only work when discount basis is total items in cart, and is not compatible with user exits which generate discounts.

    Scott
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v154 Group Pricing Discount and Discount Coupons show on checkout, paypal/eway charge full
    By edvon in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 22 Sep 2015, 02:27 PM
  2. v150 Quantity Discounts /group pricing
    By Serg in forum Customization from the Admin
    Replies: 2
    Last Post: 22 Aug 2012, 09:45 PM
  3. group pricing discount?
    By balihr in forum Managing Customers and Orders
    Replies: 2
    Last Post: 29 Jan 2009, 11:26 PM
  4. Group Pricing - Different Quantity Discount
    By skustes in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 4 Oct 2008, 07:52 PM
  5. Group Pricing/Quantity Discounts
    By kinget in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 22 Jun 2007, 07:40 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