Using Customer Groups

Customizing your site using Customer Groups

Note: These ideas take advange of the 1.5.8 feature Customer Groups, so they will only be applicable to Zen Cart 1.5.8 and above.

Restricting page to a Customer Group

See Protecting Pages.

Restricting a Shipping Method to a Customer Group

In the __construct method of the shipping module, below the other checks for enabled, add

     if (IS_ADMIN_FLAG !== true) { 
       $allowed_group = 1; 
       if (!(zen_is_logged_in() && zen_customer_belongs_to_group((int)$_SESSION['customer_id'],$allowed_group, true))) {
          $this->enabled = false;
       } 
     } 

Restricting a Payment Method to a Customer Group

In the __construct method of the payment module, below the check which ensures sort_order is set, add

     if (IS_ADMIN_FLAG !== true) { 
       $allowed_group = 1; 
       if (!(zen_is_logged_in() && zen_customer_belongs_to_group((int)$_SESSION['customer_id'],$allowed_group, true))) {
          return false; 
       } 
     } 



Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified May 1, 2023 by Scott C Wilson (3f35abb9).