Forums / Built-in Shipping and Payment Modules / Is it possible to enable a shipping method for only a certain customer group?

Is it possible to enable a shipping method for only a certain customer group?

Locked

Views: 5,455

Results 1 to 20 of 38
This thread is locked. New replies are disabled.
27 Apr 2008, 8:08 AM
#1
sacotechnology avatar

sacotechnology

New Zenner

Join Date:
Apr 2007
Posts:
24
Plugin Contributions:
0

Is it possible to enable a shipping method for only a certain customer group?

Hi

I would like to know if it is possible to enable a shipping method (example store pickup) but only for a certain pricing group or on an individual customer bases?

27 Apr 2008, 2:53 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

Each shipping module has a setting for the $this->enabled ... when false, that module with hide, or basically not show ...

If you look at the shipping modules such as Item Rate item you will see:

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

This is running a function that returns true or false based on if the shipping is free ...

You could do something similar by identifying the customer and return true or false if the customer should see the module you need to do this for ...

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 Mar 2010, 1:45 AM
#3
kayz avatar

kayz

New Zenner

Join Date:
Sep 2009
Location:
Victoria
Posts:
88
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

I'm using Zen Cart 1.3.8

I'm confused.

I have three customer groups set up. Gold members, VIP and Friends under group pricing.

I have set up a test customer and enabled them to my friends group which has no discount.

How do I set it up so that only the store pick up will show in their shopping cart when they are signed in and no one else.

Under that shipping option in admin>modules>shipping I only see the option to remove or edit with the settings:

Enable store pick up : true
Shipping cost: 0.00
Tax Class: none
Tax basis: shipping
Shipping Zone: none
Sort order: 6

How exactly do I set it so that it is only made true to the customers I select and false to every one else?

Is there something I'm missing?

29 Mar 2010, 2:22 AM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

You would have to customize the shipping module code ... it is not built in to work off customer group settings ...

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 Mar 2010, 3:42 AM
#5
kayz avatar

kayz

New Zenner

Join Date:
Sep 2009
Location:
Victoria
Posts:
88
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

Ajeh:

You would have to customize the shipping module code

Any ideas on how I would do this.

I'm not real good at coding.

I wouldn't know where to start or which files to customize.

29 Mar 2010, 3:56 AM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

Can the Friends Group see all off the other shipping modules plus the Store Pickup?

What is the customers_group_pricing for the Friends Group?

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 Mar 2010, 5:25 AM
#7
kayz avatar

kayz

New Zenner

Join Date:
Sep 2009
Location:
Victoria
Posts:
88
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

Ajeh:

Can the Friends Group see all off the other shipping modules plus the Store Pickup?

Yes. My test customer that I have linked to my friends group can.

Ajeh:

What is the customers_group_pricing for the Friends Group?

Group Name: Friends
Discount: 0.00%

These are the only 2 options under group pricing (admin>customers>group pricing) and my answers are shown above.

29 Mar 2010, 5:29 AM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

Let me try the questions in a different way ...

When you go to the Catalog ... Group Pricing ... you will see, if you click on the Friends group ... in the URL ... the:
gID=

What is the number after it?

IF a customer is in the Friends Group ... should they be able to see all of the regular shipping methods and be able to see the Store Pick Up in addition to all of the other regular shipping methods?

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 Mar 2010, 6:27 AM
#9
kayz avatar

kayz

New Zenner

Join Date:
Sep 2009
Location:
Victoria
Posts:
88
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

Ajeh:

Let me try the questions in a different way ...

When you go to the Catalog ... Group Pricing ... you will see, if you click on the Friends group ... in the URL ... the:
gID=

What is the number after it?

I'm assuming you mean admin>customers>group pricing. The ID number to the far left. If that is the case then it is 3.

If that's not where you meant I did look under admin>catalog but there is no listing for group pricing there.

Ajeh:

IF a customer is in the Friends Group ... should they be able to see all of the regular shipping methods and be able to see the Store Pick Up in addition to all of the other regular shipping methods?

I want my friends to be able to see all delivery options.

But want to make the store pick up option only available / visible to them and not the general public.

I hope I'm making sense.

29 Mar 2010, 7:07 AM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

You can customize the Store Pickup storepickup shipping module with the code changes:

    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_STOREPICKUP_ZONE > 0) ) {
      $check_flag = false;
      $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
                             where geo_zone_id = '" . MODULE_SHIPPING_STOREPICKUP_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;
      }
    }

    $chk_group = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
    if ($chk_group->fields['customers_group_pricing'] == 3) {
      $this->enabled = true;
    } else {
      $this->enabled = false;
    }
  }
  /**
   * Obtain quote from shipping system/calculations

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 Mar 2010, 7:23 AM
#11
kayz avatar

kayz

New Zenner

Join Date:
Sep 2009
Location:
Victoria
Posts:
88
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

Ajeh:

You can customize the Store Pickup storepickup shipping module with the code changes:

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_STOREPICKUP_ZONE > 0) ) {
  $check_flag = false;
  $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
                         where geo_zone_id = '" . MODULE_SHIPPING_STOREPICKUP_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;
  }
}

$chk_group = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
if ($chk_group->fields['customers_group_pricing'] == 3) {
$this->enabled = true;
} else {
$this->enabled = false;
}
}
/**

  • Obtain quote from shipping system/calculations

I added the code you suggested and it seems to be working. 
I logged in as a non friend customer and could not see the store pick up option but when I logged in as a friend the option was there.

Your a genius!!!

Thank you so much.

Where have you been for my other posts / threads. lol

Your fantastic. I've been trying to work this out for days with no luck at all.

Thank you again.
29 Mar 2010, 1:51 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

Glad that this worked for you ... remember the Zen Cart Team when you are rich and famous ... :cool:

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!

9 May 2010, 8:45 PM
#13
gg01 avatar

gg01

New Zenner

Join Date:
Jul 2008
Location:
Ontario, Canada
Posts:
85
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

How would one include two different groups to see this pickup option?? (With ID of 2 and 3)

9 May 2010, 9:05 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

You would need to test for both groups ...

    if ($chk_group->fields['customers_group_pricing'] == 3 || $chk_group->fields['customers_group_pricing'] == 7) {

where 3 and 7 are the two groups that you are testing for ...

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!

9 May 2010, 9:12 PM
#15
gg01 avatar

gg01

New Zenner

Join Date:
Jul 2008
Location:
Ontario, Canada
Posts:
85
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

Ahhh, thank you!!!

I wasn't sure how to set a range or to indicate "and" or "to".

:bigups:

9 May 2010, 9:36 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

Not a problem ... glad this helped you out ... :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!

10 May 2010, 12:37 AM
#17
gg01 avatar

gg01

New Zenner

Join Date:
Jul 2008
Location:
Ontario, Canada
Posts:
85
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

I have been trying to apply this same logic to the ot_coupon.php without success... is it possible?

10 May 2010, 2:20 AM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

The Discount Coupon ot_coupon Order Total module is different ...

You would have to change this function:

  function check() {
    global $db;
    if (!isset($this->check)) {
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_COUPON_STATUS'");
      $this->check = $check_query->RecordCount();
    }

    if (!IS_ADMIN_FLAG) {
      if ([B]I_SHOULD_NOT_RUN_CHANGE_ME[/B]) {
        $this->check = 0;
      }
    }

    return $this->check;
  }

You would need to put your code and condition where I have it marked in bold red ... the IF for the Admin test is so that this will still work normally in the Admin ...

By setting the $this->check to 0, it will turn off or hide the Discount Coupon 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!

10 May 2010, 2:37 AM
#19
gg01 avatar

gg01

New Zenner

Join Date:
Jul 2008
Location:
Ontario, Canada
Posts:
85
Plugin Contributions:
0

Re: Is it possible to enable a shipping method for only a certain customer group?

Ajeh:

The Discount Coupon ot_coupon Order Total module is different ...

You would have to change this function:

function check() {
global $db;
if (!isset($this->check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_COUPON_STATUS'");
$this->check = $check_query->RecordCount();
}

if (!IS_ADMIN_FLAG) {
if ([B]I_SHOULD_NOT_RUN_CHANGE_ME[/B]) {
$this->check = 0;
}
}

return $this->check;
}

> 
> You would need to put your code and condition where I have it marked in bold red ... the IF for the Admin test is so that this will still work normally in the Admin ...
> 
> By setting the $this->check to 0, it will turn off or hide the Discount Coupon module ...

does ('customers_group_pricing' == 3) { make sense??  Does it matter where in the code I put this?  Thank you so much for you help!!
10 May 2010, 2:41 AM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to enable a shipping method for only a certain customer group?

You need to the code to find the customer's group id just like before ... and the IF would be the same thing ...

Before you got the information with:

    $chk_group = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");

Then you had an IF testing whether it was one group or the other to turn it off ...

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!