Forums / General Questions / Group Pricing and Free Shipping

Group Pricing and Free Shipping

Views: 2,127

Results 1 to 19 of 19
7 Mar 2011, 2:51 PM
#1
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Group Pricing and Free Shipping

Is it possible to have those who are in group pricing receive free shipping if they spend over a certain amount? but only if they are in a certain zone!

7 Mar 2011, 3:03 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Are you using any of the Free Shipping modules now, such as the Free Shipping Option freeoptions ...

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!

7 Mar 2011, 3:39 PM
#3
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

it is in the modules but not installed it yet.

7 Mar 2011, 4:03 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

What you could do is build a Zone Definition for the Free Shipping Options ...

Then, set the Total to >= XX.XX for the amount that must be used ...

Then, customize the shipping module to check the customer's group and see if they are allowed the shipping choice ...

Now, you should also consider that if the customer is not logged in the module will not show until they login and if they are in the customer group and if the amount is >= 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!

7 Mar 2011, 4:32 PM
#5
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

Then, customize the shipping module to check the customer's group and see if they are allowed the shipping choice ...

any clues....

7 Mar 2011, 4:44 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Let's say you want to limit the Free Shipping Options freeoptions to customers in group 1 ...

You can change the code to:

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
      }

// bof: limit to 1 customers_group_pricing
      $group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");

      if (!IS_ADMIN_FLAG && $group_query->fields['customers_group_pricing'] != '1') {
        // do not show
        $this->enabled = false;
      }
// eof: limit to 1 customers_group_pricing

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!

7 Mar 2011, 5:32 PM
#7
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

got it to work with group pricing, however, i can't get it to work by weight, am i doing something wrong,

I want shipping to be free if order is over £50 but less than 2Kg in weight

7 Mar 2011, 5:46 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Weight is not truely pounds or Kg ...

Is your whole site in Kg?

You should use:
Total >= 50.00
Weight <= 2.00

To make these settings run together, you need to customize one more section of the code ...

Currently, the module is written for Total OR Weight OR Count ...

// final check for display of Free Options
      if ($this->ck_freeoptions_total or $this->ck_freeoptions_weight or $this->ck_freeoptions_items) {

try changing to be:

// final check for display of Free Options
      if ($this->ck_freeoptions_total and $this->ck_freeoptions_weight and $this->ck_freeoptions_items) {

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!

6 Apr 2011, 2:22 PM
#9
jacdesigner avatar

jacdesigner

Zen Follower

Join Date:
Jun 2005
Location:
Austin, Texas, US
Posts:
205
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

Hi there - I appreciate your suggestions here; I think it is close to what I wish to do. Basically one of my merchants wants to reverse this scenario and only offer free shipping options to regular shoppers and NOT anyone in the special customer group. (The customer group represents wholesale buyers.)

Is it possible that I could reverse the "false" setting to be "true" in your code suggestion?

Ajeh:

Let's say you want to limit the Free Shipping Options freeoptions to customers in group 1 ...

You can change the code to:

  // disable only when entire cart is free shipping
  if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
  }

// bof: limit to 1 customers_group_pricing
$group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");

  if (!IS_ADMIN_FLAG && $group_query->fields['customers_group_pricing'] != '1') {
    // do not show
    $this->enabled = false;
  }

// eof: limit to 1 customers_group_pricing

This message brought to you by Jac.
Happily developing sites with Zen Cart since 2003.

6 Apr 2011, 3:17 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Reverse the logic so anyone in Group 1 cannot see the Free Options:

      if (!IS_ADMIN_FLAG && $group_query->fields['customers_group_pricing'] == '1') {

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!

20 Apr 2011, 3:03 AM
#11
jacdesigner avatar

jacdesigner

Zen Follower

Join Date:
Jun 2005
Location:
Austin, Texas, US
Posts:
205
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

Thank you very much - this does seem to be the solution we were looking for.

I have implemented it for several different customer groups to negate those conditions - so only regular standard users can see the Free option - all the discount groups have to pay their shipping and do not even see the choice in estimate or checkout. I have tested this on a couple user groups and verified it works.

One thing I did do differently is add some lines to repeat the condition for additional discount groups (group 1, 2, 3, etc.).

This message brought to you by Jac.
Happily developing sites with Zen Cart since 2003.

20 Apr 2011, 3:14 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Thanks for the update that this is working for you ... :smile:

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!

21 Feb 2012, 1:53 PM
#13
enginarat avatar

enginarat

New Zenner

Join Date:
Mar 2011
Location:
Marco Island, FL
Posts:
71
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

Zen-cart 1.3.9h

I believe my problem is simpler than the two above: I have discount groups (%15 & 20%) that have been working like a charm. Recently we also wanted to offer FREE SHIPPING to anyone including the discount groups for their purchases over $1000. I installed freeoption module and set Free Shipping when Total >=
1000.00
It works just fine except it also offers free shipping to discount groups even the total drops below $1.000 after 15 or 20% discount applied. So they are getting free shipping for $850 which does not serve our purpose and we lose money there. Please see ATTACHED screenshot.

Any help will be highly appreciated.
Thanks in advance.

21 Feb 2012, 3:33 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Not really ...

Try this change in RED to the file:
/includes/modules/shipping/freeoptions.php

// class methods
    function quote($method = '') {
      global $order;
      $order_weight = round($_SESSION['cart']->show_weight(),9);

      // check if anything is configured for total, weight or item
      if ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='' or MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')) {
        $this->ck_freeoptions_total = true;
      } else {
        $this->ck_freeoptions_total = false;
      }
      if ((MODULE_SHIPPING_FREEOPTIONS_WEIGHT_MIN !='' or MODULE_SHIPPING_FREEOPTIONS_WEIGHT_MAX !='')) {
        $this->ck_freeoptions_weight = true;
      } else {
        $this->ck_freeoptions_weight = false;
      }
      if ((MODULE_SHIPPING_FREEOPTIONS_ITEMS_MIN !='' or MODULE_SHIPPING_FREEOPTIONS_ITEMS_MAX !='')) {
        $this->ck_freeoptions_items = true;
      } else {
        $this->ck_freeoptions_items = false;
      }
      if ($this->ck_freeoptions_total or $this->ck_freeoptions_weight or $this->ck_freeoptions_items) {
        $this->enabled = true;
      } else {
        $this->enabled = false;
      }

      // disabled if nothing validates for total, weight or item

// bof: adjusted for discount groups
    global $db, $cart;
    $orderTotal_freeoption = $order->info['total'];
    $group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
    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 = ($orderTotal_freeoption - $gift_vouchers) * $group_discount->fields['group_percentage'] / 100;
      $orderTotal_freeoption = $orderTotal_freeoption - round($discount, 2);
    }
//echo 'Order Total: ' . $order->info['total'] . ' orderTotal_freeoption: ' . $orderTotal_freeoption . '<br>';
      if ($this->enabled) {
        if ($this->ck_freeoptions_total) {
          switch (true) {
          case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='' and MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')):
// free shipping total should not need adjusting
//            if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN and ($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
//            if (($_SESSION['cart']->show_total()) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN and ($_SESSION['cart']->show_total()) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
            if (($orderTotal_freeoption) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN and ($orderTotal_freeoption) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
              $this->ck_freeoptions_total = true;
            } else {
              $this->ck_freeoptions_total = false;
            }
            break;
          case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='')):
//            if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
//            if (($_SESSION['cart']->show_total()) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
            if (($orderTotal_freeoption) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
              $this->ck_freeoptions_total = true;
            } else {
              $this->ck_freeoptions_total = false;
            }
            break;
          case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')):
//            if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
//            if (($_SESSION['cart']->show_total()) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
            if (($orderTotal_freeoption) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
              $this->ck_freeoptions_total = true;
            } else {
              $this->ck_freeoptions_total = false;
            }
            break;
          }
        }
// eof: adjusted for discount groups

        if ($this->ck_freeoptions_weight) {

and really test this ...

NOTE: this cannot work in the Shipping Estimator if the customer is not logged in ...

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!

21 Feb 2012, 6:53 PM
#15
enginarat avatar

enginarat

New Zenner

Join Date:
Mar 2011
Location:
Marco Island, FL
Posts:
71
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

Thanks Ajeh. That solves my problem and works like a charm.

I want to point to another issue that also concerns totals "AFTER" group discounts applied.
We charge a "Low order fee" for orders below $300 (admin/modules/order total/ot_low order fee). However, same thing happens after group discounts applied; people get no low order fee ($20) for orders below $300 AFTER group discount applied (ie $285 for 15%, $280 for 20%). Low order fee must kick in AFTER group discounts applied. Thanks.

21 Feb 2012, 7:00 PM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Some use these settings based on the Total after discounts and others use these settings based on the Total prior to discounts ...

This leaves you needing to adjust the code as needed to work your way ...

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!

21 Feb 2012, 7:27 PM
#17
enginarat avatar

enginarat

New Zenner

Join Date:
Mar 2011
Location:
Marco Island, FL
Posts:
71
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

Exactly!
So, as I wrote earlier my requirement is "AFTER" the group discount applied. Is there anyway I can reach this code? Currently I have lifted the limit to $345 and it approximately comes to $300 when 15% discount applied. If there's not another solution I can live with that. Once again, I am grateful for your efforts.

21 Feb 2012, 7:41 PM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Group Pricing and Free Shipping

Look at the file:
/includes/modules/order_total/ot_loworderfee.php

and adjust the code in the function process:

//        if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
        if ( ($pass == true) && ( $order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {

It bases it on the subtotal ... you want to adjust that amount similar to how it was done for the shipping module ...

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!

21 Jan 2013, 4:10 PM
#19
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: Group Pricing and Free Shipping

I have a similar situation.

I have my regular customers and my wholesalers.

I have a group called Wholesalers, and they currently get their discount, however some wholesalers have their own shippers, and account number so for those we do NOT charge shipping.

I also have a second group of wholesalers that get a lesser percent off, but still have their own shipper.

So if I understand correctly I can make a new zone, and use the code from the first example but change the line of code from

if (!IS_ADMIN_FLAG && $group_query->fields['customers_group_pricing'] != 'wholesalers' or 'wholesalers35') {

But I am afraid that adding a the zones will effect my payment set up, am I able to add more than one zone to my payment types. Is there anything else?