Forums / Built-in Shipping and Payment Modules / Different Shipping Options for Different Customer Types

Different Shipping Options for Different Customer Types

Started by scottmcclean on 15 Sep 2011, 8:52 AM · Views: 5,562

Results 21 to 40 of 44
29 Feb 2012, 4:06 AM
#21
ajeh avatar

ajeh

Oba-san

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

Different Shipping Options for Different Customer Types

You just stuck that code where ever ... I do not know what module you are using but it should have a line like the Checkout/Money Order moneyorder ...

The code would go between the two lines in black:

      if ((int)MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID > 0) {
        $this->order_status = MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID;
      }

// bof: Only for Discount Group 2
      if (!IS_ADMIN_FLAG) {
        global $db;
        $chk_discount_group_sql = "SELECT customers_group_pricing FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'";
        $chk_discount_group = $db->Execute($chk_discount_group_sql);
        if ($chk_discount_group->fields['customers_group_pricing'] != 2) {
          $this->enabled = false;
        }
      }
// eof: Only for Discount Group 2

      if (is_object($order)) $this->update_status();

NOTE: the Zen Cart Free Charge freecharger ONLY will work when there are NO chargers on the Order and NO shipping as in a totally FREE Order ...

It does not MAKE the order free ... it shows because the order is Free ...

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!

29 Feb 2012, 11:01 PM
#22
stizzed avatar

stizzed

New Zenner

Join Date:
Jan 2012
Location:
Northern Indiana
Posts:
42
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Ajeh:

You just stuck that code where ever ...

HAHAHA! No, I didn't just stick it where ever... :laugh: I put it between the class constructor and methods code, essentially where you put it in your first example. The structure of the purchaseorder code is slightly different from that of the built in modules but I don't know that placement is my problem.

If you look over my most recent post you may realize that I am having problems regardless of where I put the code.

I will test your most recent example and see where I end up!

Thanks Linda!

Michael (Zen Greenhorn)
Remember: Every expert started out as a beginner!

29 Feb 2012, 11:42 PM
#23
stizzed avatar

stizzed

New Zenner

Join Date:
Jan 2012
Location:
Northern Indiana
Posts:
42
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Got it!

Part of my process for modifying code is to create an 'OLD' version of the modified file whereby I will prepend the working filename with 'OLD.'

This works fine in most circumstances. However, ZC sees any files in the /includes/modules/payment folder as valid files which should be processed in the admin.

I removed the OLD.purchaseorders.php and VIOLA! :clap: It worked PERFECTLY!

Thank you again Linda, for your wise council! I will now be able to make all payment options exclusively available to my CSRs! :flex:

Michael (Zen Greenhorn)
Remember: Every expert started out as a beginner!

29 Feb 2012, 11:44 PM
#24
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

Thanks for the update that this is now working for you ...

NOTE: Be careful as all modules directories are auto loading for any file that ends in php ... and that can mess you up on creating files that conflict with one another ... :lamo:

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!

29 Feb 2012, 11:51 PM
#25
stizzed avatar

stizzed

New Zenner

Join Date:
Jan 2012
Location:
Northern Indiana
Posts:
42
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Ajeh:

NOTE: Be careful as all modules directories are auto loading for any file that ends in php ... and that can mess you up on creating files that conflict with one another ... :lamo:

Good information to know. Thank you!

Michael (Zen Greenhorn)
Remember: Every expert started out as a beginner!

22 Sep 2012, 7:19 PM
#26
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Ajeh, hope you are still subscribed to this thread, looks like you may be able to help me with a problem I have. Been reading this thread and really want to do the same thing with the minimum order mod. Only force minimum order on customers in price group 2 for example. Hope you can help?
Thanks
Phil

Phil Rogers
A problem shared is a problem solved.

27 Sep 2012, 9:55 AM
#27
joneshopes avatar

joneshopes

New Zenner

Join Date:
Aug 2012
Posts:
2
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

please check the connection type and define the connection type properly.
birthday card

27 Sep 2012, 1:41 PM
#28
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

I have not forgotten you ... I just have not had time to really look at this and what you need vs the examples posted ...

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 Oct 2012, 9:19 PM
#29
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

Using the Minimum Order Add-on from:
http://www.zen-cart.com/downloads.php?do=file&id=402

I have re-written it to work with customers_group_pricing = 2

Using for the new code for:
/includes/classes/observers/class.minimum_order_amount.php

and changing it to the code in the attached file ...

This should do what you are trying to do with a normal install of the Minimum Order and setting the Minimum amounts to what you need for this group ...

Let us know if it works for you ...

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!

30 Jan 2013, 11:00 PM
#30
gokeypa avatar

gokeypa

New Zenner

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

Re: Different Shipping Options for Different Customer Types

Hello,

I am using zencart 1.3.9h

I have two types of customer’s retailers and online shoppers. For my retail customers some of them use their own shipper payments have them set in a discount group called wholesalers.

I am NOT using zones other than taxes for my California customers.

I would like to be able to give this group free shipping so that I can process my orders for them without having to use a coupon code.

I have enabled freeoptions and added the code :

// 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: Only for Discount Group 2
if (!IS_ADMIN_FLAG) {
$chk_discount_group_sql = "SELECT customers_group_pricing FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'";
$chk_discount_group = $db->Execute($chk_discount_group_sql);
if ($chk_discount_group->fields['customers_group_pricing'] != wholesalers) {
$this->enabled = false;
}
}
// eof: Only for Discount Group 2

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {

I then added one of my test accounts to the wholesale group and when I get to the shipping options there is not a choice for free shipping. Just my normal options of fedex and usps. What am I doing wrong?

30 Jan 2013, 11:46 PM
#31
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

You are using:

if ($chk_discount_group->fields['customers_group_pricing'] != wholesalers) {

You are using:
wholesale

and IF you wanted the group name, you would use it in quotes ...

However, the value you are getting back is a number, not text ...

Go to your Groups and see what the ID is for your wholesale customers and use the number and see if it works better ...

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!

31 Jan 2013, 4:56 AM
#32
gokeypa avatar

gokeypa

New Zenner

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

Re: Different Shipping Options for Different Customer Types

wow, Ok that was easy once you showed me the error.

So now what I have is two types of wholesalers, and one type of online customers. I only want one of the types of wholesalers to see the free option. Is there a way for type (X) to only see the free option.

31 Jan 2013, 1:44 PM
#33
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

If the wholesalers are split into two groups then use that Group ID ... if they are not, how can you distinguish between the two groups?

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!

31 Jan 2013, 2:25 PM
#34
gokeypa avatar

gokeypa

New Zenner

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

Re: Different Shipping Options for Different Customer Types

The wholesalers are split into two separate groups. Group (1) and group (2) I changed the code so group 2 would get free shipping, then my test customer in group (2) could see and get the free shipping. I then logged in as a different customer NOT in group 2 and I still saw the free shipping.
Should do something like this so that only group (2) can get and see free shipping.

if ($chk_discount_group->fields['customers_group_pricing'] == 1) or if ($chk_discount_group->fields['customers_group_pricing'] == 0) {
$this->enabled = false;{

31 Jan 2013, 2:33 PM
#35
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

If you only want Group 2, where their ID is 2, to be able to see Free Shipping, what happens if you use:

if ($chk_discount_group->fields['customers_group_pricing'] != 2) {
  $this->enabled = false;
}

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!

31 Jan 2013, 5:35 PM
#36
gokeypa avatar

gokeypa

New Zenner

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

Re: Different Shipping Options for Different Customer Types

if I set the code to that then everyone can see the free shipping whether they are in group 2 or not.

31 Jan 2013, 6:05 PM
#37
gokeypa avatar

gokeypa

New Zenner

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

Re: Different Shipping Options for Different Customer Types

Ok, I did a little more checking and it seams that my browser was keeping the last customers settings that was logged in. So when I cleared my cache it looks like it is working.

31 Jan 2013, 6:16 PM
#38
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

Above the IF can you add the line in RED:

[B]echo 'CUSTOMER GROUP IS: ' . $chk_discount_group->fields['customers_group_pricing'] . '<br>';
[/B]if ($chk_discount_group->fields['customers_group_pricing'] != 2) {
  $this->enabled = false;
}

and see what displays when you run shipping in either the shipping estimator or checkout_shipping ...

NOTE: things might look a little goofy with this echo ...

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!

31 Jan 2013, 6:17 PM
#39
ajeh avatar

ajeh

Oba-san

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

Re: Different Shipping Options for Different Customer Types

Good deal then you do not need the test ... thanks for the update! :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!

27 Mar 2013, 10:07 AM
#40
dre avatar

dre

New Zenner

Join Date:
Mar 2006
Location:
The Netherlands
Posts:
92
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Ajeh:

For example, let's say the Discount Group ID is 2 ... you can customize the code for:
/includes/modules/shipping/freeoptions.php

with the code in RED:

  // 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: Only for Discount Group 2
if (!IS_ADMIN_FLAG) {
$chk_discount_group_sql = "SELECT customers_group_pricing FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'";
$chk_discount_group = $db->Execute($chk_discount_group_sql);
if ($chk_discount_group->fields['customers_group_pricing'] != 2) {
$this->enabled = false;
}
}
// eof: Only for Discount Group 2

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {

> 
> Now only those in Discount Group ID 2 can use this shipping module ...




I tried to put your code into the zones module but then I get an blank screen:
Is it in anyway possible to use thies code also in the table and zones module



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

// bof: Only for Discount Group 1
      if (!IS_ADMIN_FLAG) {
        $chk_discount_group_sql = "SELECT customers_group_pricing FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'";
        $chk_discount_group = $db->Execute($chk_discount_group_sql);
        if ($chk_discount_group->fields['customers_group_pricing'] != 1) {
          $this->enabled = false;
        }
      }
// eof: Only for Discount Group 1

      // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      $this->num_zones = 3;