User Manual - Customer Group Catalog Permissions

Magento 2 Customer Group Catalog Permissions is equipped with rich functionality in the backend and easy to implement functionality in the frontend. The backend includes both individual and mass settings. The individual ones allow an admin to set the permissions for each category, product and CMS page separately. Mass settings provide the opportunity to configure and delete permissions for the unlimited number of store catalog elements at once.

Both individual and mass settings are aimed at visibility management of the element itself, its price and add to cart button. More to that, it’s possible to assign text messages equipped with CSS-styles and configure the redirection instead of hidden elements.

Compatibility: Magento Open Source 2.3.X - 2.4.X, Magento Commerce 2.3.X - 2.4.X

 

 

Installing Customer Group Catalog Permissions 

Command Line Installation

  1. Backup your web directory and store database
  2. Download the Customer Group Catalog Permissions  installation package
  3. Upload contents of the Customer Group Catalog Permissions installation package to your store root directory
  4. In SSH console of your server navigate to your store root folder:
cd path_to_the_store_root_folder

run the following command: 

php -f bin/magento module:enable Aheadworks_CustGroupCatPermissions

then:

php -f bin/magento setup:upgrade

after:

php -f bin/magento setup:static-content:deploy

     5. Flush store cache; log out from the backend and log in again

Make sure the installation is done from the FTP administrator account. Otherwise, set 775 permissions to the store root directory after the extension is deployed.

Composer Installation

If you are installing an extension from Aheadworks for the first time, you need to add our composer repository to your Magento store:

     1. Login to your ssh console and navigate to your store folder:

cd path_to_the_store_root_folder

Run the following commands:

composer config repositories.aheadworks composer https://dist.aheadworks.com/

On successful execution of the commands you will be able to use the composer to install the extensions.

To install the extension:

     2. Login to your ssh console and navigate to your store folder:

cd path_to_the_store_root_folder

     3. Run the following command to install the latest version of the extension:

composer require aheadworks/module-customer-group-catalog-permissions

if you need to install a specific version, run this command:

composer require aheadworks/module-customer-group-catalog-permissions:<version>

 

Specify the version of the extension in <version>

When prompted, enter Public Key (Username) and Private Key (Password):

Both Public Key (Username) and Private Key (Password) can be found in My Projects and Licenses in your personal account on our site:

     4. Enable the extension:

php -f bin/magento module:enable <Module_Name>

 

Add the product name in <Module_Name>

Next, register the extension:

bin/magento setup:upgrade

Recompile your Magento store if you are in the Production mode:

bin/magento setup:di:compile

To verify that the extension is enabled, run this command:

bin/magento module:status

Clean store cache, by running the following command:

bin/magento cache:clean

Log out and Log in the backend again.

To upgrade the extension:

     5. To update or upgrade an extension:

Download the updated extension file. Take note of the module-name and version. Export the contents to your Magento root.

If a composer package exists for the extension, run one of the following.

Update per module name:

composer update aheadworks/module-customer-group-catalog-permissions

Updater per version:

composer require aheadworks/module-customer-group-catalog-permissions:<version>

Run the following commands to upgrade, deploy, and clean the cache.

php bin/magento setup:upgrade --keep-generated
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

 

Backend Configuration

Note that firstly, you need to disable native permissions to launch the Customer Group Catalog Permissions by Aheadworks.

1. General Configuration

The Configuration page of the extension (Stores Configuration Aheadworks Extensions Сustomer Group Catalog Permissions) includes three sections: General, Catalog Elements Permissions, and CMS Page Permissions.

The General section of the General configuration page allows you to enable the extension via choosing the option ‘Yes’.

Catalog Elements Permissions - section of the Configuration page contains the following configuration options:

Browsing Catalog Elements - the field to be used for the needed mode for the element visibility to be chosen: Show for everyone, Hide from specified customer groups or Hide from everyone;

Note that if you choose mode ‘Hide from specified customer groups’, the following fields appear:

Customer Groups - the field to be used for you to choose the definite customer groups;
Redirect Visitor to This Page - the field to be used for you to insert the URL page for redirection those customers who reach the hidden browsing catalog element;
Display Product Price - the field to be used for the needed mode for the price visibility to be chosen: Show for everyone, Hide from specified customer groups or Hide from everyone.
Allow Adding to Cart - the field to be used for the needed mode for the add to cart button visibility to be chosen: Show for everyone, Hide from specified customer groups or Hide from everyone.

Note that if you choose mode ‘Hide from specified customer groups’ for these two fields (Display Product Price and/or Allow Adding to Cart), the following fields appear:

Customer Groups - the field to be used for you to choose the definite customer groups;

Text Message When Price Is Hidden - the field to be used for you to insert a customized text message using a ready-made HTML-code.

Text Message When Button Add to Cart Is Hidden - the field to be used for you to insert a customized text message using a ready-made HTML-code.

To display the Hidden Add To Cart Message in the places where the Add To Cart button is displayed, you need to add the following code to the corresponding template:

<?php if ($_product->getHideAddToCart()):?> 
<?= /* @escapeNotVerified */ $_product->getHiddenAddToCartMessage(); ?>
<?php endif; ?>

where $ _product is the product object in the template.
Examples
For the Product page:

vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

For the Category Page:

vendor/magento/module-catalog/view/frontend/templates/product/list.phtml

This code is added wherever it is necessary to display the message and the product object ($ _product) is defined.

 

To hide the unwanted text 'Out of stock' when the product permissions are applied, you should:
1) open the template with the output of this text
2) find this text and wrap its output with a conditional construction.

<?php if (!$_product->getHidePrice() && !$_product->getHideAddToCart()):?> 
... the output of the text "Out of stock"
<?php endif; ?>

As an example, changes in the vendor / magento / module-catalog / view / frontend / templates / product / list.phtml template:

before:

<?php if ($_product->isAvailable()):?> 
<div class="stock available"> <span> <?= /* @escapeNotVerified */ __('In stock')?> </span> </div>
<?php else:?>
<div class="stock unavailable"> <span> <?= /* @escapeNotVerified */ __('Out of stock')?> </span> </div>
<?php endif; ?>

after:

<?php if ($_product->isAvailable()):?> 
<div class="stock available"> <span> <?= /* @escapeNotVerified */ __('In stock')?> </span> </div>
<?php else:?>
<?php if (!$_product->getHidePrice() && !$_product->getHideAddToCart()):?>
<div class="stock unavailable"> <span> <?= /* @escapeNotVerified */ __('Out of stock')?> </span> </div>
<? php endif; ?>
<? php endif; ?>

Static Pages -  the field to be used for the needed mode for the CMS page visibility to be chosen: Show for everyone, Hide from specified customer groups or Hide from everyone.

Note that if you choose mode ‘Hide from specified customer groups’, the following fields appear:

Customer Groups - the field to be used for you to choose the definite customer groups;

Redirect Visitor to This Page - the field to be used for you to insert the URL page for redirection of those customers who reach the hidden CMS page. Finally, note that these settings are applied to the whole store catalog without dividing it into separate categories, products, or CMS pages. More to that, the settings configured are applied as the default unless other individual ones are specified.

That's it. The configuration is done.

2. Category Permissions (individual settings)

If you want to set the permissions for the individual category, you need to reach the New Permission fieldset. The fieldset is available through the following path: Сatalog Categories Needed Category chosen from the Category tree Category Permissions by Aheadworks New Permission and includes the following columns:

Store View - the website which will be the application scope for the permissions specified;
Customer Group - the particular customer group for which you want to apply the permissions specified;
Category - contains the ‘Show’ or ‘Hide’ modes for you to choose;

Product Price - contains the ‘Show’ or ‘Hide’ modes for you to choose;

Please note: if you decide to hide the product price, the Add to Cart button is hidden automatically. Instead, you can create a customized text message in the field ‘Text Message When Price is Hidden’ using a ready-made HTML-code.

Add to Cart Button - contains the ‘Show’ or ‘Hide’ modes for you to choose.

Please note: if you decide to hide the Add to Cart button you can create a customized text message in the field ‘Text Message When Button Add to Cart Is Hidden’ using a ready-made HTML-code.

3. Product Permissions (individual settings)

If you want to set the permissions for the individual product, you need to reach the New Permission grid. The fieldset  is available through the following path: Products  Categories Needed Product chosen from the Product grid  Edit Product Permissions by Aheadworks New Permission and includes the following columns:

Store View - the website which will be the application scope for the permissions specified;
Customer Group - the particular customer group for which you want to apply the permissions specified;
Product - contains the ‘Show’ or ‘Hide’ modes for you to choose;

Product Price - contains the ‘Show’ or ‘Hide’ modes for you to choose;

Please note: if you decide to hide the product price, the Add to cart button is hidden automatically. Instead you can create a customized text message in the field ‘Text Message When Price is Hidden’ using a ready-made HTML-code.

Add to Cart Button - contains the ‘Show’ or ‘Hide’ modes for you to choose.

Please note: if you decide to hide the Add to Cart button you can create a customized text message in the field ‘Text Message When Button Add to Cart Is Hidden’ using a ready-made HTML-code.

4. Static Page Permissions (individual settings)

If you want to set the permissions for the individual CMS page, you need to reach the Static Page Permissions by Aheadworks fieldset. The grid is available through the following path: Content Pages  Needed Page chosen from the Page grid Select  Edit Static Page Permissions by Aheadworks > and includes the following columns:

Static Page - contains the ‘Show’ or ‘Hide’ modes for you to choose;
Store View - the website which will be the application scope for the permissions specified;
Customer Group - the particular customer group for which you want to apply the permissions specified. 

5. Update Permissions in Bulk

If you want to update permissions in bulk, you need to reach the Update Permissions in Bulk wizard. The wisard is available through the following path: Catalog > Update Permissions in Bulk and includes the following steps:
 
Select Catalog Element Type - the step to be made for you to choose between Categories, Products, and Pages;
Select Items - the step to be made for you to choose the items for which you want to set the permissions;
Set Permissions -  the step to be made for you to set the permissions for the items chosen.
 

Please note: the final step requires you to deal with the fieldset which is the similar to this one you see while configuring  individual permission settings for category, product of CMS page. Finally, to update the permissions in bulk you need to click on the button 'Apply' or the button 'Back' to change the previous steps.
Also, pay your attention that this functionality is available not only from the main menu, but also on the page of the individual permission settings for categories - the Category Permissions by Aheadworks page, products - the Product Permissions by Aheadworks page, and CMS page -  the CMS Page Permissions by Aheadworks page.

6. Delete Permissions in Bulk

If you need to delete permissions in bulk you need to reach the Delete Permissions in Bulk wizard. The wizard is available through the following path: Catalog > Delete Permissions in Bulk and includes the following steps:

Select Catalog Element Type - the step to be made for you to choose between Categories, Products, and Pages;
Select Items - the step to be made for you to choose the items for which you want to set the permissions.

To delete the permissions you need to click on the button 'Delete' or the button 'Back' to change the previous steps.

Note that this functionality is available not only from the main menu, but also on the page of the individual permission settings for categories - the Category Permissions by Aheadworks page, products - the Product Permissions by Aheadworks page, and CMS page -  the CMS Page Permissions by Aheadworks page.

 
 
 

Report incorrect information

Still Have Questions?

Our customer care team is here for you!

Contact Us