Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Need help with group discount + restricted coupon

    I'm having some trouble achieving the correct calculations with my order total modules.

    We have a discount group that gets 3% off all orders.

    I have set up a $10 coupon that is valid only on one product, with no minimum purchase.

    If I restrict the coupon to the product, it calculates $10 minus the group discount, instead of applying the full $10.

    Example:

    Product A $10.00
    Product B $1.00
    Coupon restricted to product A

    Order total shows:

    Sub-Total: CDN $11.00
    Group Discount - 3%: -CDN $0.33
    Discount Coupon: wy487nwb: -CDN $9.67
    Warehouse Pickup: CDN $0.00
    13% Tax (ON): CDN $0.09
    Total: CDN $0.76

    Why is the coupon deducting the group discount from the coupon amount?

    If I remove the restriction, the coupon applies correctly.

    My order total modules sort order:
    100 Sub-Total
    102 Group Discount
    103 Discount Coupon
    200 Shipping
    300 Tax
    310 Gift Certificates
    900 Total

  2. #2
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: Need help with group discount + restricted coupon

    Also, if the group discount is larger than $10, it won't allow you to apply the coupon at all.

  3. #3
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: Need help with group discount + restricted coupon

    I can't reorder the group discount to apply after the coupon, because then any percentage coupons are calculated on the full subtotal instead of the subtotal minus the group discount. I guess I'm kind of stuck.

    In a perfect world, what *should* happen is that restricted dollar amount coupons should be applied to the product price minus the group discount. NOT the entire subtotal minus the group discount. I'm sure that's not something that would be an easy fix though...

  4. #4
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: Need help with group discount + restricted coupon

    What I'd like to try is to change the code so that when the coupon is for a dollar amount AND there is more than one product, the coupon will ignore the group discount. Can anyone help?

    I'm assuming it would be in this function?

    Code:
     /**
       * Method used to produce final figures for deductions. This information is used to produce the output<br>
       * shown on the checkout pages
       *
       */
      function process() {
        global $order, $currencies;
        $order_total = $this->get_order_total();
        $od_amount = $this->calculate_deductions($order_total['total']);
        $this->deduction = $od_amount['total'];
        if ($od_amount['total'] > 0) {
          reset($order->info['tax_groups']);
          $tax = 0;
          while (list($key, $value) = each($order->info['tax_groups'])) {
            if ($od_amount['tax_groups'][$key]) {
              $order->info['tax_groups'][$key] -= $od_amount['tax_groups'][$key];
              $tax += $od_amount['tax_groups'][$key];
            }
          }
          if ($od_amount['type'] == 'S') $order->info['shipping_cost'] = 0;
          $order->info['total'] = $order->info['total'] - $od_amount['total'];
          if (DISPLAY_PRICE_WITH_TAX != 'true') {
            $order->info['total'] -= $tax;
          }
          $order->info['tax'] = $order->info['tax'] - $tax;
          //      if ($this->calculate_tax == "Standard") $order->info['total'] -= $tax;
          if ($order->info['total'] < 0) $order->info['total'] = 0;
          $this->output[] = array('title' => $this->title . ': ' . $this->coupon_code . ' :',
                                  'text' => '-' . $currencies->format($od_amount['total']),
                                  'value' => $od_amount['total']);
        }
      }
      /**

  5. #5
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: Need help with group discount + restricted coupon

    What I need is:

    If the coupon type is 'F' (flat amount)
    AND there is more than 1 product in the cart
    AND the customer is in a discount group
    THEN the coupon = the full coupon amount up to 100% of the subtotal price

    I think I would need to change this code... But not sure how.

    Code:
    } elseif ($coupon->fields['coupon_type'] == 'F') {
                $od_amount['total'] = round($coupon->fields['coupon_amount'] * ($orderTotal>0), 3);
                $od_amount['type'] = 'F';
                $ratio = $od_amount['total']/$orderTotal;
              }

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Need help with group discount + restricted coupon

    What happens if you change the Modules ... Order Total ... sort orders to the defaults:
    100 Sub-Total
    102 Group Discount 290
    103 Discount Coupon 280
    200 Shipping
    300 Tax
    310 Gift Certificates 840
    900 Total
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Problem with custom Group Pricing and Discount Coupon
    By mvstudio in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 2 Aug 2011, 04:20 PM
  2. Products Restricted to Certain Discount Group
    By impulse120 in forum Managing Customers and Orders
    Replies: 0
    Last Post: 17 Mar 2011, 08:24 PM
  3. Replies: 18
    Last Post: 12 Mar 2010, 06:37 PM
  4. Need help with 1st Discount coupon
    By zerocool in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 29 May 2007, 01:10 PM

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