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 1 to 20 of 44
15 Sep 2011, 8:52 AM
#1
scottmcclean avatar

scottmcclean

Zen Follower

Join Date:
Mar 2009
Location:
Trowbridge, Wiltshire
Posts:
121
Plugin Contributions:
0

Different Shipping Options for Different Customer Types

Hi all,

I have a problem with shipping that I am struggling to fix.
I have a need to have separate shipping requirements for different customer types.

We have 2 types of customer: the main customers hold accounts with our business and as such are set up as "invoice only", and we calculate their carriage charges when we ship the goods internally - the charges are reflected on their invoice. To do this we activated the "free shipper" and marked all products as "always free shipping". This works great!

The second set of customers are non-account holding and as such we would like them to pay by credit card/Paypal. I set up Flat Rate shipping and created the necessary clones for each flate rate that I need.

I also used a “test” from Ajeh to determine the customer discount pricing group which works. The problem I have now is that for invoice only customers I get a message at the shipping stage which is: “Sorry, we are not shipping to your region at this time.”
I would welcome any thoughts about how I could fix this so that my Invoice only customers get free shipping and my non-invoice customers get the flat rate options.
Many thanks

15 Sep 2011, 2:28 PM
#2
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 could install the Free Shipping Options freeoptions and set Total to >= 0.00 ... then customize the module so only the main customers, however you identify these, are allowed to see this 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!

15 Sep 2011, 2:51 PM
#3
scottmcclean avatar

scottmcclean

Zen Follower

Join Date:
Mar 2009
Location:
Trowbridge, Wiltshire
Posts:
121
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Hi Ajeh,
Thanks for your reply. I have to say this is driving me nuts!

Its seems I am so close yet so far. I wondered if there was anything else that could be added to the lines of code you kindly did for me ages ago.

As soon as I set Order Free Shipping 0 weight to "No" and "Allow free shipping" in the order total area to "No" my Invoice only customers cannot purchase.

I change them to yes and only my paypal (non-invoice users) can shop.

I am not a PHP coder so any help will be greatly appreciated.

15 Sep 2011, 2:53 PM
#4
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 lost me ... where are you setting these things? :unsure:

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!

15 Sep 2011, 3:00 PM
#5
scottmcclean avatar

scottmcclean

Zen Follower

Join Date:
Mar 2009
Location:
Trowbridge, Wiltshire
Posts:
121
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

In Admin/Configuration/Shipping and Packaging there is an option for the "Order Free Shipping 0 weight"

and in Modules/Order Total is where I set the "Allow Free Shipping"

15 Sep 2011, 3:09 PM
#6
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 do not want the Modules ... Order Total .... Shipping ot_shipping to have a Free Shipping setting ...

You want the Modules ... Shipping ... Free Shipping Options freeoptions turned on with the Total set to >=0 ...

Then you need to customize the file:
/includes/modules/shipping/freeoptions.php

if you have a limited number of customers that is Free Shipping ...

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!

15 Sep 2011, 3:36 PM
#7
scottmcclean avatar

scottmcclean

Zen Follower

Join Date:
Mar 2009
Location:
Trowbridge, Wiltshire
Posts:
121
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Hi Ajeh,
You say I will then have to customise the file: Then you need to customize the file: /includes/modules/shipping/freeoptions.php....

Is this actually within the code? If so I wouldnt know where to start. Also - I have about 200 invoice customers (and growing) if that make a difference.

I will install the module and see what it entails.

many thanks for your time.

15 Sep 2011, 3:56 PM
#8
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

How are you identifying the Invoice Customers? :unsure:

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!

15 Sep 2011, 3:58 PM
#9
scottmcclean avatar

scottmcclean

Zen Follower

Join Date:
Mar 2009
Location:
Trowbridge, Wiltshire
Posts:
121
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Hi Ajeh,
I use the Customers area in admin and then select the relevant option (Invoice Only) from the Discount Pricing Group drop down.

15 Sep 2011, 4:30 PM
#10
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

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 ...

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!

15 Sep 2011, 6:53 PM
#11
scottmcclean avatar

scottmcclean

Zen Follower

Join Date:
Mar 2009
Location:
Trowbridge, Wiltshire
Posts:
121
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Cool!

Sorry to be a pain - but I have had a look at the SQL table and it appears that every customer that is not in a "discount group" is set to "0".

Is it possible to reflect in the code that if customer is in group "0" then they do not get free shipping?

15 Sep 2011, 9:12 PM
#12
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

Then you would change the code:

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

to read:

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

and anyone not in a group will not see it ...

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!

16 Sep 2011, 10:50 AM
#13
scottmcclean avatar

scottmcclean

Zen Follower

Join Date:
Mar 2009
Location:
Trowbridge, Wiltshire
Posts:
121
Plugin Contributions:
0

Re: Different Shipping Options for Different Customer Types

Ajeh - this is awesome! It works perfectly - thank you so much for this.

16 Sep 2011, 1:53 PM
#14
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 most welcome ... thanks for the update that this is working for you now ... :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!

29 Feb 2012, 2:05 AM
#15
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

Linda,

I thought I would try a variation of this suggestion to allow only members of Discount Group 2 to use a particular Payment Option. Whenever I try to use your code in a payment module (freecharger for example) it just hoses the admin/modules/payment menu and clearly doesn't work.

What is different or what could I be doing wrong?

I did notice that the freecharger module does not include a $db global declaration, although adding it did not help...

Any thoughts?

Thanks in advance

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

29 Feb 2012, 2:49 AM
#16
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 can customize the file:
/includes/modules/payment/freecharger.php

      $this->enabled = ((MODULE_PAYMENT_FREECHARGER_STATUS == 'True') ? true : false);
// 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

However, the Zen Cart Free Charger freecharger is meant for when there is no charge on the order ... I am not sure why you want the block on it ... as there will not be a way to checkout with that on there ...

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, 3:07 AM
#17
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

Thanks for the quick reply Linda! Without thinking it through I was using freecharger as an example.

Our Customer Service Reps want to be able to sell to employees and phone in customers. As some do not have email addresses or Credit Cards (the only method our public site supports) we need a way for a CSR to purchase an item for the employee or in the name of the caller. I figured that freecharger, moneyorder, or purchaseorder (an add-on mod) might be configured to allow it if the CSR were in a discount (0%) group.

If there is a better way I'll bet you know what it is! :yes:

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

29 Feb 2012, 3:10 AM
#18
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 could do it with the Purchase Order or Check/Money Order moneyorder but the Zen Cart Free Charger freecharger is made for a different purpose so that would be a bad choice ...

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, 3:16 AM
#19
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 could do it with the Purchase Order or Check/Money Order moneyorder but the Zen Cart Free Charger freecharger is made for a different purpose so that would be a bad choice ...

Terrific!

So, freecharger essentially removes all charges, making the order free?

If so, could one make it available only to group 2 (CSR) as in your second example above, thus providing a CSR the option of processing the order outside via cash or other then simply Commenting on the order that it was paid with another (unlisted) payment method? :blink:

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

29 Feb 2012, 3:32 AM
#20
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

Tried adding the code in both freecharger and purchaseorders and get the same hosed admin menu:

Here is the menu before adding the code:
Attachment #10223

And after adding to purchaseorders:
Attachment #10224

As you can see it completely removes the module from the menu and removes all configuration options at the right.

Here is where I placed the code:

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

// 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

// class methods
    function update_status() {

Sorry for being such a pain...:blush:

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