The widespread business of eCommerce all over the world is also making it more vulnerable & prone to cyber threats with each passing day. Although, there are various available options to prevent such attempts. But, we all know that it’s better to keep the matchsticks out of the house than to keep the fire extinguisher in order to prevent a fire. Using that same concept, we bring you this module i.e. Prestashop Restrict Shop Access module to allow you to restrict access to the shop for some identified threats.
Apart from the above, this module with its unique features also allows you to apply restrictions based on various grounds. Say, you have seen a trend of malware attacks coming mostly from “xyz” browser or “abc” country. Then in such a case, you can now simply add them to your blocking list. So that any user from the identified country using identified browsers can now simply be blocked from using the website. It also provides the functionality to add some specific IP addresses to block the traffic coming from there to the website.
Note: In the following document, the word “user-agent” simply refers to the browser which the customer uses to access the website.
Features of the Prestashop Restrict Shop Access module
- Apply restriction on access of products, shop or both.
- Choose to show or hide the restricted products from the shop.
- Restrict the category pages on the shop.
- Option given to restrict the product listing pages on the shop.
- Option given to restrict the CMS pages on the shop.
- Restrict the access of the shop customer group wise.
- Allow user to send request for shop access or product access.
- Admin can allow product or shop access to specific customer.
- Block products on the basis of the customer’s delivery address or IP address.
- Set date and time range to restrict user from accessing product, shop, or both.
- Set URL where you want to redirect user in case you have restricted shop pages.
- You can hide products from the entire shop if the products are blocked on the basis of the customer’s delivery address or IP address.
- Enable or disable the display of the product details page.
- Configure the message to inform the customer about the unavailability of product for the specific address.
- Set multiple conditions to restrict shop or product access for specific customer groups.
- Select single or multiple countries to block the product.
- Choose to restrict the access on the basis of user agents.
- Add multiple user agents according to their versions to block their users.
- Also, choose to restrict access via certain user agents for their specific version or all versions.
- Add multiple IP addresses to block the product.
- Customers will be able to know the availability of the product in their country.
- Prestashop Restrict Shop Access by Country, IP and User-Agent module is compatible with PrestaShop version 8.x.x and multi-store feature.
- Prestashop Restrict Shop Access by Country, IP and User-Agent module is compatible with catalog’s new product page.
How to install the Prestashop Restrict Shop Access module
- Firstly, go to the module manager in back office and click on ‘upload a module’.
- After that, drag and drop the module file or select the file from the system.
- In this way, the module installation will be successful.
How to configure the Prestashop Restrict Shop Access module
In the configuration settings of the module, there are multiple options. Let’s understand each of them one by one.
Prestashop Company ? Find out More
Restriction Based On: Here, you can choose to restrict the access of product, whole shop or both. In case, if you select to restrict access to the whole shop or both, then your customer would not be able to see anything on the shop.
Hide Product on Shop: Enable this option to hide the restricted products from the shop.
Get country on the basis of: Choose whether you want to fetch the country of a customer on the basis of the delivery address or IP address.
Restrict Start/End Date: In these fields, you can set date and time range for which you want to restrict the customer access.
If Hide Product on Shop is disabled, you’ll further get three settings:
Show Product Details Page: Enable to show the product details page of restricted products with a message. In case, if it’s disabled then the product details page will not open on clicking the product tile on the home page.
Product Restriction Message: Customise the message that you want to show on the product tiles or product details page of blocked products.
Allow user to send request for shop access or product access: If this field is enabled, then user can send request for accessing shop or product.
Restrict access to the whole shop
If group-wise restriction is on then shop-wise restriction will work for those end-users who has restricted groups.
Let’s see what happens when “Restrict Specific Pages” setting is ON.
On enabling this, you will get further options to restrict category pages, CMS pages and Product listing pages. Also, you can set the URL where you want to redirect a user after page restriction.
Restrict Category Pages: ON
Select the categories you want to restrict.
Note: If you have enabled category restriction then Home Category cannot be restricted.
Restrict CMS Pages: ON
Choose the CMS pages that you want to restrict.
Restrict Product Listing Pages: ON
Choose the Product Listing pages that you want to restrict.
Restrict Access to Both (Product wise and Shop)
All the option will be available in case of Both.
Add Block List
After successful installation of the module, five new tabs gets available in the back office.
Block by Customer Groups
Click on the “Add new” button to add restrict for customer groups.
After adding the restriction, you can view it under Block Customer Groups.
Kindly note that the priority set for restriction (in the above screenshot) will be higher than that of global configuration.
Block by User Agent
Here, the user agent simply refers to the browser which the customer is using to access the shop. Now, this module also allows you to simply restrict the users using some particular browsers by adding them here.
After adding the user agents, you can see all of them in a list too.
Block by Country
The next option is to restrict the access of the shop on the basis of the user’s country. For that, you can simply select all the countries whose users you want to restrict from accessing the shop. While restricting the users on the basis of country, one of the options of configuration also works. The option where you choose to get the users country on the basis of either address or delivery address.
Block by IP Address
You can also add some IP addresses for which you want to restrict the access of the shop.
The following screenshot shows the Shop restriction message in the popup.
Under the Customer Requests tab, the admin can see the request sent by the customers for accessing a particular product or whole shop.
Customer sending a Shop request to the admin
Consider the admin have blocked the access to the shop. Now, the customer can send a request for shop access from the front end.
On clicking the save button, the request is sent to the admin.
Till that time, the customer will see message that his request is sent to admin for approval.
Similarly, the customer can also send a request for accessing the product if it has been blocked.
On clicking “Request for product” button, a popup appears on the page where a customer needs to specify email id, mobile number, and description to submit the request.
On clicking the save button, the request will be sent to the admin in the back office.
Give product/shop access to customer
On clicking “Allow a customer” button, a form appears on the page where you need to select a customer and restriction type as product or shop.
On clicking the save button, the access of the selected product will be given to the selected customer.
Process to block the product
In order to configure the block settings for individual products, go to catalog->products->select product->modules.
- If disabled, then the product will be available for every country and IP address.
- If enabled, then the admin can select the country or specify the IP address for which the product will not be available.
Show/Hide Product on Shop
When a User is Logged in
The first case is when an admin tries to hide the blocked products from the shop.
In such a case, a customer from one of the blocked countries cannot view the products on the shop.
Suppose the product details page is hidden and the product is visible.
In this case, a customer from one of the blocked countries cannot view the product. This is because the admin is not allowing to view the product page from the configuration settings.
On clicking the product to view the product detail page the customer gets redirected to the home page.
Now, let’s see another case when the product along with the product details page is visible.
In such a case, a configured message will display on the product details page.
When User is not Logged in
In the configuration settings, we’ve selected to fetch the country of the customer by the delivery address. As we know the user is not logged in, hence getting country by the delivery address would not be possible here because we don’t have any address of the user yet.
So, in such cases, when no address is available then we get the country of the user by IP address.
Now, after tracking the country by IP, the module will block the product if that product is blocked from the country fetched by IP address.
Block the product using an IP address
Now, suppose you are deciding to block both i.e., products & the shop. And, you have also selected to get the country by IP address of the user.
On selecting the IP address in “Get country on the basis of” field, you will see a message. As per the new modification, now you need to download the geolocation data file from the MaxMind website.
In order to download the geolocation data file, you need to register on the MaxMind website first. After creating the account, you will be able to download the “GeoLite2City” file from the website.
Upon successful download of the file, proceed to extract the file in the given below directories.
- In Prestashop 1.7/8, you need to extract it into app/Resources/GeoIP/ directory.
- Whereas, In Prestashop 1.6, you need to extract it into module folder/views/lib/vendor/resource.
In case of blocking by IP address, all the options will work in the same way. However, the country to block the product will be fetched by an IP address only.
Now, the address will be checked by IP & if the country fetched by IP is added to the block list. Then, whether it’s a product or shop, it’ll be blocked accordingly.
So, this was all about Prestashop Restrict Shop Access Module. I hope this document will help you in checking the functionality of the module in a better way. Also, do let us know about your views in the comments.
In case, if you are also looking for the same functionality for your marketplace sellers, then do checkout the blog.
Current Product Version - 6.1.1
Supported Framework Version - 8.x.x, 1.7.x.x