Certain groups of customers see a certain shipping method

Permalink
Hi guys,

I have a core commerce install on a site but i only want customers in a certain group to see a shipping method, where as all the others will see the default. Any idea how you would do this, or what code would be required and where?

thanks for looking!

 
beebs93 replied on at Permalink Reply
beebs93
I've used this in the past for group-specific actions/messages:

$u = new User();
if(($objGrp = Group::getByName('Group Name Here')) && (is_object($objGrp) && !$objGrp->error) && $u->inGroup($objGrp)){
   // For only the group to see
}


As for where specifically, it depends on the layout of your site. If this is a checkout-type page where the user chooses their shipping method AND said checkout page has its own template I would add something like the following to its template file:

$u = new User();
if(($objGrp = Group::getByName('Group Name Here')) && (is_object($objGrp) && !$objGrp->error) && $u->inGroup($objGrp)){
   $area = new Area('Group members content');
}else{
   $area = new Area('Normal user content');
}
$area->display($c);


Does any of that help?
obaluba replied on at Permalink Reply
thanks Beebs that does help

Yeah its the standard core commerce package, which file within the commerce package would i put this code in to set this up?

thanks
beebs93 replied on at Permalink Reply
beebs93
Unfortunately, I've never used that package so I cannot be more specific.

Sorry :(
jordanlev replied on at Permalink Reply
jordanlev
You might get a better answer by posting to the eCommerce support forum -- go to the eCommerce marketplace page and click the "support" link in the sidebar there.