Jump to content

PS 1.5.3.1 - Carrier choice per customer group does not work?


Recommended Posts

Hello,

 

I have created a new customer group for which only one carrier is possible. A customer assigned to only that group should only see this carrier. But all choices remain possible in the order process.

 

Is this a bug or did I miss some configuration steps?

 

Thx in advance for any help! :)

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 4 weeks later...
  • 4 weeks later...

I have the same problem.  With ours we offer local delivery that we manage but only want that to be an option for specific customers. Created a "Local Delivery" group and set it up as you described.  Same problem.  Any customer from any group can see the option and fully check out with it selected.

 

Did you get anywhere on this?

Link to comment
Share on other sites

I found a workaround, until core files will be updated and corrected (which is not under our control).

I had to write an override. Edit /override/classes/Cart.php with this code:

class Cart extends CartCore
{

public function getDeliveryOptionList(Country $default_country = null, $flush = false)
  {
    $customer_group = Customer::getDefaultGroupId($this->id_customer);

    $delivery_option_list = parent::getDeliveryOptionList($default_country, $flush);
    foreach ($delivery_option_list as $id_address => $delivery_option) {
      foreach ($delivery_option as $key => $value) {
        foreach ($value['carrier_list'] as $id_carrier => $data){
          $this_carrier = new Carrier($id_carrier);
          $carrier_enabled_groups = $this_carrier->getGroups();
          $carrier_enabled_group_ids = array();
          foreach ($carrier_enabled_groups as $c) {
            $carrier_enabled_group_ids[] = $c['id_group'];
          }
          if (!in_array($customer_group, $carrier_enabled_group_ids)){
            //remove carrier from the list
            unset($delivery_option_list[$id_address][$key]);
          }
        }
      }
    }
    return $delivery_option_list;
  }

}

In my installation this solved the problem.

Hope that it helps.

 

Giuseppe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...