Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / different shipping for different customers

different shipping for different customers

Views: 6,812

Results 1 to 20 of 23
16 Jul 2009, 10:36 AM
#1
ligrex avatar

ligrex

New Zenner

Join Date:
Oct 2008
Posts:
19
Plugin Contributions:
0

different shipping for different customers

Hi guys.
I've 2 problems:
1st: ABOUT ENGLISH: my english isn't so good

2nd: ABOUT ZEN CART.
I've installed mod DUALPRICING and now i'd like to assign different shipping to customers who are RETAIL CUSTOMERS or WHOLESALE CUSTOMERS and different shipping for different WHOLESALE PRICING LEVEL.
Can anybody help me?
Sorry for my english...:oops:

Thank you all.

17 Jul 2009, 2:47 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

How do you want your shipping to work for a Retail Customer?

How do you want your shipping to work for a Whole Sale Customer?

20 Jul 2009, 7:55 AM
#3
ligrex avatar

ligrex

New Zenner

Join Date:
Oct 2008
Posts:
19
Plugin Contributions:
0

Re: different shipping for different customers

i'd like to implement something like this:

retail costumers: 11 euros of shipping cost for orders till 350€ and free shipping for orders >350€

whole sale costumers: 15€ for all the orders.

Can you help me? Thank you so much....

:lookaroun

20 Jul 2009, 1:05 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

What distinguishes your Retail customers from your Whole Sale customers?

Do your customers have to login to shop on your site?

20 Jul 2009, 1:27 PM
#5
ligrex avatar

ligrex

New Zenner

Join Date:
Oct 2008
Posts:
19
Plugin Contributions:
0

Re: different shipping for different customers

I've installed MOD dualpricing and so I distinguish different customers giving them different value in WHOLESALE PRICING LEVEL. 0 is for Retail Customers and 1 or 2 is for different categories of wholesale customers.
All of them they have to login to shop, and thei login using the same form.

Any ideas?
Thank you so much Ajeh for your attention

20 Jul 2009, 2:14 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

You could clone the Flat Rate flat shipping module and customize one file to be used for the Whole Sale customers and one file to be used for the Retail Customers ...

Then on the Retail Customers, add in a further test on the order total to see if the order should be free shipping ...

Then, customize the Free Options freeoptions shipping module to be used on Orders with a Total > 350 ... and customize that so it only shows for Retail Customers ...

All of the shipping modules are controlled based on the value of the $this->enabled ... when true, it shows and when false it does not ...

Do a search on:
clone flat

to see how you can create the extra shipping module ...

As to testing for which customer you are on, there should be something set with your Add On to distinguish one from another that can be used in the shipping module ...

21 Jul 2009, 10:30 AM
#7
ligrex avatar

ligrex

New Zenner

Join Date:
Oct 2008
Posts:
19
Plugin Contributions:
0

Re: different shipping for different customers

Wowowow:clap::clap::clap::clap::clap:

In works great!!!!!
Thank you so much Ajeh....

And it was easy too....

I installed the mod you said and then added only few lines:

$this->enabled = ((MODULE_SHIPPING_FLATCLONE_STATUS == 'True') ? true : false);
if($_SESSION['customer_whole']=='2' && $this->enabled==true)
{
$this->enabled=true;
}else{
$this->enabled=false;
}

in the files of shipping (flatClone.php and zones.php)...
THAT'S ALL!!!

THANK YOU AGAIN!!!

Have nice days...
ligrex

21 Jul 2009, 3:00 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

Thanks for the update and glad that this was able to help you with your shipping issue for whole sale and retail customers ... :smile:

11 Sep 2009, 9:01 PM
#9
berlinna avatar

berlinna

New Zenner

Join Date:
Sep 2009
Posts:
1
Plugin Contributions:
0

Re: different shipping for different customers

Shipping issue for wholesale and retail customer.
I've installed mod DUALPRICING and like to assign different shipping to RETAIL CUSTOMERS versus WHOLESALE CUSTOMERS. RETAIL CUSTOMER is assigned 0 and WHOLESALE CUSTOMER IS 1. I have installed 2 shipping modules. Table Rate and Zone Rate. The Table Rate is set to Price level 49.99:7.95,2000:0.00 for Zone US 48 States(not Alsaka and Hawaii). The Zone Rate is set to Weight level. Zone 1 is US with 1:7.95,2:13.95,3:15.95 and so on. Zone 2 is List of Countries worldwide with 1:30.00,2:40.00 and so on.
QUESTION: I would like for WHOLESALE CUSTOMER to not get the Table Rate but only the Zone Rate. I added this code snippet to the table.php (includes/modules/shipping/table.php)

  • see insert below //disable only when customer is whole

Unfortunately it does not do the job. Still see both shipping modules on check out.

Anyone can help me with this. Thank you

function table() {
global $order, $db;

$this->code = 'table';
$this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_TABLE_TAX_BASIS;

// disable only when customer is wholesale
$this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
if($_SESSION['customer_whole']=='1' && $this->enabled==true)
{
$this->enabled = false;
}
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
}

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
  $check_flag = false;
  $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
  while (!$check->EOF) {
    if ($check->fields['zone_id'] < 1) {
      $check_flag = true;
      break;
    } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
      $check_flag = true;
      break;
    }
    $check->MoveNext();
  }

  if ($check_flag == false) {
    $this->enabled = false;
  }
}

}
/**

  • Enter description here...
  • @param unknown_type $method
  • @return unknown
    */
13 Sep 2009, 4:06 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

You have the right idea ... however, put it below the code:

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

That is taking whatever test you did and resetting it based on if the module is installed or not ... so that more or less, the code is being ignored ... :eek:

10 Dec 2009, 6:35 PM
#11
pauldid avatar

pauldid

New Zenner

Join Date:
Dec 2009
Posts:
10
Plugin Contributions:
0

Re: different shipping for different customers

I have a similar situation, where we need to offer different shipping for retail or wholesale customers. I have not installed the Dual pricing or any other wholesale pricing module yet and first would like to know if that is the best option. We only have two customer types, retail and wholesale. Retail will have a flat rate of $5.00 per order and wholesale will need to be charged actual fedex ground rates. (I assume I will also need to install the fedex module but have not done that yet either).

So is the dual pricing module the best option and how do I make mods to get this working correctly?

Thanks,
Paul

10 Dec 2009, 7:47 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

You need to install the FedEX shipping module and make sure it is working ...

Once working, you need to customize the Flat Rate flat shipping module to only work for regular customers by setting the $this->enabled to false when the customer is a wholesale customer ...

Then customize the FedEX shipping module to set the $this->enabled to false when the customer is a regular customer ...

11 Feb 2010, 10:43 PM
#13
pauldid avatar

pauldid

New Zenner

Join Date:
Dec 2009
Posts:
10
Plugin Contributions:
0

Re: different shipping for different customers

Okay here is what I have tried and it did not seem to work, but maybe I am missing something. I have installed all the shipping modules and have them configured and working, fedex, fedex grd, and usps for our wholesale customers and then it should be just flat rate for our retail customers. To implement wholesale pricing we went with the group pricing per item module because we will have different types of wholesalers and need to offer multiple levels of pricing based on customer type. Now I inserted this:

if($_SESSION['customer_id']) {
  $customer_group_query = "select gp.group_name
                            from " . TABLE_CUSTOMERS . " cu
                            left join " . TABLE_GROUP_PRICING . " gp on cu.customers_group_pricing=gp.group_id
                           where cu.customers_id = " . $_SESSION['customer_id'];
                           $check_flag = false;
  if($customer_group = $db->Execute($customer_group_query)) {
					$check_flag = true;
  }
}

at line 54 in the /includes/modules/shipping/fedexexpress.php file right before:

			if ($check_flag == false) {
				$this->enabled = false;
			}

Then tested with a retail customer account but the fedex pricing still shows up. Does this look like it will work? What did I do wrong? Do I need to remove and then add back the module to get it work?

Thanks,
Paul

12 Feb 2010, 12:25 AM
#14
pauldid avatar

pauldid

New Zenner

Join Date:
Dec 2009
Posts:
10
Plugin Contributions:
0

Re: different shipping for different customers

I figured out my problem. I Changed the code to this:

if($_SESSION['customer_id']) {
  $customer_group_query = "select gp.group_name
                            from " . TABLE_CUSTOMERS . " cu
                            left join " . TABLE_GROUP_PRICING . " gp on cu.customers_group_pricing=gp.group_id
                           where cu.customers_id = " . $_SESSION['customer_id'];
  if($customer_group = $db->Execute($customer_group_query)) {
    $customers_group=$customer_group->fields['group_name'];
    if($customers_group == NULL) {
					$this->enabled = false;
	}
  }
}

And then I inserted it at the top of the function for fedexexpress and WHOO HOO, it works.

24 May 2010, 5:19 PM
#15
virtbiz_guy avatar

virtbiz_guy

New Zenner

Join Date:
Jun 2009
Posts:
16
Plugin Contributions:
0

Re: different shipping for different customers

I have installed the dual pricing option and need to price wholesale customers at flat rate ($2 per order) and retail customers at table rate (25:15,50:19,75:23,100:27,125:31,150:35,175:39,200:43).

How can I set shipping so that Wholesale customers are offered only flat rate and retail customers only table rate?

Thank you,

25 May 2010, 5:07 PM
#16
maja avatar

maja

New Zenner

Join Date:
Mar 2007
Posts:
2
Plugin Contributions:
0

Re: different shipping for different customers

I have the same issue as above. I have used grouping functionlity to create a wholesale group, and also dual table shipping extention to create a shipping charges for the whlesale. The retail (nongrouped) customer can see correct information - only the retail shipping charge, however, the wholesale (grouped customer) can see both shipping charges. I have tried adding to the wholesale table (in /httpdocs/includes/modules/shipping) the same code as above, but its not working... I still get shown both shipping charges.

(Don't know if this would make any difference but) I have also setup (in the admin side) the two shipping modules to have equal priority of 0.

Thanks,
Maja

25 May 2010, 7:16 PM
#17
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

You can test for the customer's group and and enable and disable the modules that way by controlling the $this->enabled based on the results ...

26 May 2010, 12:38 PM
#18
maja avatar

maja

New Zenner

Join Date:
Mar 2007
Posts:
2
Plugin Contributions:
0

Re: different shipping for different customers

Ajeh:

You can test for the customer's group and and enable and disable the modules that way by controlling the $this->enabled based on the results ...
I thought I was doing that (it doesn't help that my php is a bit too rusty). I have got one file table.php where I'm testing if the customer's group is NULL (which would mean it is retail) and disabling the wholeasle shipping module by doing $this->enabled = false.

I have also got another tableretail.php where I'm testing the opposite. The first (above works) but this one doesn't. In a case the customer is wholesale (i.e. it belongs to this "Trade Group") both modules are displayed. Here is my code:

// disable if customer is wholesale
if($_SESSION['customer_id']) {
$customer_group_query = "select gp.group_name
from " . TABLE_CUSTOMERS . " cu
left join " . TABLE_GROUP_PRICING . " gp on cu.customers_group_pricing=gp.group_id
where cu.customers_id = " . $_SESSION['customer_id'];
if($customer_group = $db->Execute($customer_group_query)) {
$customers_group=$customer_group->fields['group_name'];
if($customers_group == "Trade Group") {
$this->enabled = false;
}
}
}

What am I doing wrong?

Thanks,
Maja

26 May 2010, 9:32 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: different shipping for different customers

Example for the Flat Rate flat.php shipping module:

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

  if (!IS_ADMIN_FLAG) {
// disable if customer is wholesale
$customer_group_query = "select gp.group_name
from " . TABLE_CUSTOMERS . " cu
left join " . TABLE_GROUP_PRICING . " gp on cu.customers_group_pricing=gp.group_id
where cu.customers_id = " . $_SESSION['customer_id'];
$customer_group = $db->Execute($customer_group_query);
    if ($customer_group->fields['group_name'] == 'Trade Group') {
      $this->enabled = false;
    }
  }

25 Apr 2011, 3:01 AM
#20
designingfresh avatar

designingfresh

New Zenner

Join Date:
Dec 2010
Posts:
12
Plugin Contributions:
0

Re: different shipping for different customers

I'm having a problem with the solution above. I'm using dual pricing and using some of the info in these posts I was able to make separate shipping for wholesale and retail by doing this

In includes/modules/shipping/zones2.php file

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

ADD UNDERNEATH IT

// disables wholesale shipping when you are retail customer
$this->enabled = ((MODULE_SHIPPING_ZONES2_STATUS == 'True') ? true : false);
if($_SESSION['customers_wholesale']=='1' && $this->enabled==true)
{
$this->enabled=true;
}else{
$this->enabled=false;
}

In includes/modules/shipping/zones.php file

Around line 95 find

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

ADD underneath it

// disables retail shipping when you are wholesale customer
$this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
if($_SESSION['customers_wholesale']=='0' && $this->enabled==true)
{
$this->enabled=true;
}else{
$this->enabled=false;
}

This works....except when a NEW customer signs up for a new account, and goes to checkout they get this error: Sorry, we are not shipping to your region at this time. BUT if they logoff and log back in, it works =) Is there a small piece of code that is incorrect or a piece of code that is missing that would make it not do this? ANY help would be greatly appreciated!!!

Thank you!
=0)