Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Different free shipping depending on customer discount group

Different free shipping depending on customer discount group

Locked

Views: 5,467

Results 1 to 20 of 22
This thread is locked. New replies are disabled.
4 Dec 2008, 9:35 PM
#1
elgar avatar

elgar

New Zenner

Join Date:
May 2008
Location:
Ukraine
Posts:
71
Plugin Contributions:
0

Different free shipping depending on customer discount group

Hi! I need to provide two different free shipping options depending on the customer's discount group. For instance, retail customer would get free shipping if his total is over $300. But for a wholesale customer I need to provide a different free shipping option, which is when their order is over $500.

I will appreciate your help very much.

Thank you.

5 Dec 2008, 5:13 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

How do you identify your Retail customer vs Wholesaler customer now?

5 Dec 2008, 9:43 AM
#3
elgar avatar

elgar

New Zenner

Join Date:
May 2008
Location:
Ukraine
Posts:
71
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

Ajeh:

How do you identify your Retail customer vs Wholesaler customer now?

I use dual pricing mod, and also I put wholesalers into a distributor pricing group.

5 Dec 2008, 2:30 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

If you have a "flag" as in something that distinguishes the customer type you can use that on the modules to enable or disable a feature ...

I am guessing that you are using the Modules ... Order Totals ... Shipping ot_shipping with the Free Shipping on Orders >= XX.XX setting ...

You would want to customize the module for the value of where the:
MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING

key is and base that value instead on the customer type and the values you want to use ...

9 Dec 2008, 9:56 PM
#5
elgar avatar

elgar

New Zenner

Join Date:
May 2008
Location:
Ukraine
Posts:
71
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

Ajeh:

If you have a "flag" as in something that distinguishes the customer type you can use that on the modules to enable or disable a feature ...

I am guessing that you are using the Modules ... Order Totals ... Shipping ot_shipping with the Free Shipping on Orders >= XX.XX setting ...

You would want to customize the module for the value of where the:
MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING

key is and base that value instead on the customer type and the values you want to use ...

Thank you very much for the answer. I am not good at code. Could you please specify which line of the code I need to change, and how? :(

10 Dec 2008, 4:50 AM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

Change the code in the ot_shipping.php from:

        if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
          $order->info['shipping_method'] = $this->title;
          $order->info['total'] -= $order->info['shipping_cost'];
          $order->info['shipping_cost'] = 0;
        }

To read:

// check for customer group where wholesale group = 2
$group_check = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
if ($group_check->fields['customers_group_pricing'] == 2) {
// whole sale for over 500
  $over_total = 500;
} else {
// retail sale for over set amount
  $over_total = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
}
        if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= $over_total) ) {
          $order->info['shipping_method'] = $this->title;
          $order->info['total'] -= $order->info['shipping_cost'];
          $order->info['shipping_cost'] = 0;
        }

Change the = 2 to be the customers_group_pricing for the whole salers ...

Set the value of the Free Shipping over XX.XX to be the 300.00 or what ever you want for retail to be ...

This should work ... but, you are the guinea pig as I haven't had time to test it yet ... :eek:

But it should work ... in theory ... :cool:

10 Dec 2008, 5:12 AM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

Scratch that ... needs more customization so I am going to have to work on this a bit ... but getting there ... :cry:

10 Dec 2008, 5:33 AM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

Step 2 is to change the code in:
/includes/modules/pages/checkout_shipping/header_php.php

from:

    $free_shipping = false;
    if ( ($pass == true) && ($_SESSION['cart']->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
      $free_shipping = true;
    }

to read:

// check for customer group where wholesale group = 2
global $db, $cart;
$group_check = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");

if ($group_check->fields['customers_group_pricing'] == 2) {
// whole sale for over 500
  $over_total = 500;
} else {
// retail sale for over set amount
  $over_total = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
}

    $free_shipping = false;
    if ( ($pass == true) && ($_SESSION['cart']->show_total() >= $over_total) ) {
      $free_shipping = true;
    }

Still need to fix the display on the template to know which value to show ... that will be step 3 ... :flex:

10 Dec 2008, 6:21 AM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

Step 2B ... forgot the shipping estimator ...

Change the file:
/includes/modules/shipping_estimator.php

the lines:

    $free_shipping = false;
    if ( ($pass == true) && ($_SESSION['cart']->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) {
      $free_shipping = true;
      include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/ot_shipping.php');
    }

Should read:

// check for customer group where wholesale group = 2
global $db, $cart;
$group_check = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");

if ($group_check->fields['customers_group_pricing'] == 2) {
// whole sale for over 500
  $over_total = 500;
} else {
// retail sale for over set amount
  $over_total = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
}

    $free_shipping = false;
    if ( ($pass == true) && ($_SESSION['cart']->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) {
      $free_shipping = true;
      include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/ot_shipping.php');
    }
10 Dec 2008, 6:29 AM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

Step 3 ...

Change the template file for:
/includes/templates/template_default/templates/tpl_checkout_shipping_default.php

where it reads:

<div id="defaultSelected"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . zen_draw_hidden_field('shipping', 'free_free'); ?></div>

to read:

<?php
// check for customer group where wholesale group = 2
global $db, $cart;
$group_check = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");

if ($group_check->fields['customers_group_pricing'] == 2) {
// whole sale for over 500
  $over_total = 500;
} else {
// retail sale for over set amount
  $over_total = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
}
?>
<div id="defaultSelected"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format($over_total)) . zen_draw_hidden_field('shipping', 'free_free'); ?></div>

Then change the template file for the shipping estimator:
/includes/templates/template_default/templates/tpl_modules_shipping_estimator.php

where it reads:

<?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)); ?>

to read:

<?php
// check for customer group where wholesale group = 2
global $db, $cart;
$group_check = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");

if ($group_check->fields['customers_group_pricing'] == 2) {
// whole sale for over 500
  $over_total = 500;
} else {
// retail sale for over set amount
  $over_total = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
}
echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format($over_total));
?>

NOTE: on all of these changes be sure to use your templates and override directories where applicable ...

Wasn't that a fun time to write? Remember us when you are rich and famous! :smartalec:

10 Dec 2008, 8:16 AM
#11
elgar avatar

elgar

New Zenner

Join Date:
May 2008
Location:
Ukraine
Posts:
71
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

:clap: WOW!!! You have done a tremendous work! Thank you very much for all you've done!

Now I need to implement it, which will take some time. I'll post on how it worked. Thanks again!

23 Aug 2010, 8:30 PM
#12
gthenry avatar

gthenry

New Zenner

Join Date:
Oct 2007
Location:
Northeast Georgia, USA
Posts:
36
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

1.3.8A
Dual pricing-wholesale
Customer tax exemp 1.30
UPS shipping module

I am looking for totally free shipping at the retail level and 500 free shipping at a dealer level. Dual pricing wholesale is loaded but I do not plan to use it.

Dealer is defined in group pricing and is ID 2. I have added the code modifications listed in this post. Free shipping seems to work fine. The dealer shipping below 500 is not working. Everything says free shipping. The 500 is defined in modules/shipping/ot_shipping.

As a retail customer, check_shipping says Free shipping for orders over US$0.00. This is how ot_shipping is set.

As a wholesale clustomer, regardless of order size, check_shipping says Free shipping for orders over US$500.00. UPS is not showing for orders under 500.

I see in the code modification descriptions "if ($group_check->fields['customers_group_pricing'] == 2)". I am assuming that the 2 refers to the group ID.

I will appreciate your help.

23 Aug 2010, 8:58 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

Did you customize your code to include ALL of the steps for this? :unsure:

23 Aug 2010, 9:45 PM
#14
gthenry avatar

gthenry

New Zenner

Join Date:
Oct 2007
Location:
Northeast Georgia, USA
Posts:
36
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

I went through the process three times. I modified these files commenting out the unwanted code and copy and pasted the new code.

/includes/modules/order_totals/ot_shipping.php
/includes/modules/pages/checkout_shipping/header_php.php
/includes/modules/shipping_estimator.php
/includes/templates/template_default/templates/tpl_checkout_shipping_default.php
/includes/templates/template_default/templates/tpl_modules_shipping_estimator.php

Thanks for the quick reply.

23 Aug 2010, 10:19 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

If you edit the Modules ... Order Totals ... Shipping ot_shipping ... what exactly do you have typed in for the:
Free Shipping For Orders Over

Have you changed the UPS shipping module in any way?

24 Aug 2010, 12:15 AM
#16
gthenry avatar

gthenry

New Zenner

Join Date:
Oct 2007
Location:
Northeast Georgia, USA
Posts:
36
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

First answer- $0.00 Allow free shipping is set to true. My intent with this is to get the free shipping for all Retail sales.

The UPS sales module is as downloaded. This store has been created with a new download, not an upgrade.

I did use the override system with the changes. The file /includes/modules/shipping_estimator.php does not show the classic file so an override was not used on this file. I did maintain the original by adding a numeral to the filename and using the original filename with the modified file. The original renamed file is still on the server.

If necessary, I can revert to original and start over.

I plan to go back through the process again tomorrow.

24 Aug 2010, 12:31 AM
#17
gthenry avatar

gthenry

New Zenner

Join Date:
Oct 2007
Location:
Northeast Georgia, USA
Posts:
36
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

Additional information

All product is set to normal shipping rules.
Freeoptions and Freeshipper are not installed.
UPS is the only installed shipping module.

Order total modules loaded are
name sort order
Group discount 190
Shipping 200
Subtotal 100
Tax 300
Total 999

24 Aug 2010, 2:48 AM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

You have too many things trying to control the shipping going on at the same time that are fighting one another ...

Are you using the
Always Free Shipping: YES

to get free shipping for Retail Customers or to show the Free Shipping image?

Always Free Shipping YES is designed for everyone to be free shipping so you need to customize around this for whole sale customers ...

If you have set the value in the Modules ... Order Totals ... Shipping ot_shipping to 0.00 and enabled it ... that is going to make everything Free Shipping for everyone ...

This conflicts with Always Free Shipping as now it is not even looking at that setting ... it is shutting down all of the shipping modules to give Free Shipping to everyone ...

To make your shipping work correctly, you will need customization ...

You want all Retail Customers to have Free Shipping ... and you say you have marked all Products as:
Always Free Shipping YES

For this you need the FREE SHIPPING! freeshipper shipping module installed ...

You want to have Whole Sale Customers have UPS shipping up to $500 ...

You want to have Whole Sale Customers have Free Shipping on orders $500 or more ...

Correct?

Do your Products have a Product Weight so that UPS can calculate the shipping?

Without weight, there can be no shipping quotes from UPS with any accuracy on the Products for whole sale orders under $500.00 ...

You should customize the Shipping ot_shipping to use 500.00 for the Free Shipping amount and to work for the Whole Sale Group only ...

24 Aug 2010, 6:16 PM
#19
gthenry avatar

gthenry

New Zenner

Join Date:
Oct 2007
Location:
Northeast Georgia, USA
Posts:
36
Plugin Contributions:
0

Re: Different free shipping depending on customer discount group

At this point, the code changes as listed earlier in this thread seem to be working.

This is the admin settings.

The store has five items. Each item is set "No, Normal Shipping Rules". Each item has a "products shipping weight" assigned.

Modules/shipping modules/freeshipper is not installed. The only shipping module installed is UPS.

Modules/order totals modules/ot_shipping is installed. " Free Shipping For Orders Over" is set to 00.00. Allow Free Shipping-set to true.

Additional installed modules/order totals modules are ot_group_pricing, ot_subtotal, ot_tax, ot_total.

After it is determined that the customer is not a wholesale customer, the 00.00 gives free shipping to the retail customer on all products. The 500> free shipping for wholesale customers is hard coded in the new code.

In the end, I deleted the old code I had commented out so any potential associated problems would be totally eliminated. I did find an orphan ?>. I reentered the new code with copy and paste. All the product already had weights assigned so that was not the issue.

What is left is to change some of the standard wording to be more clear for the wholesale customers and it looks like things are ready to go.

Thanks.

https://www.Ride-Easy.com

24 Aug 2010, 6:26 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Different free shipping depending on customer discount group

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