Private Shop Module for PrestaShop
A powerful PrestaShop module to secure your store by restricting access to logged-in users only. It features a customizable, multilingual popup, advanced front-end protection, and performance optimizations.
🚀 Features
Core Functionality
- Complete Access Control: Restrict your entire store, making it accessible only to registered and logged-in customers.
- Customizable Popup: Design a professional, multilingual popup with custom titles, messages, and button text for each language.
- Advanced Security: Protect your content by disabling right-click, view source, keyboard shortcuts (like Ctrl+C), and content copying for guest users.
- CMS Page Exceptions: Keep specific CMS pages (like "About Us" or "Contact") public while the rest of your store remains private.
- Performance Optimized: A built-in caching system reduces database queries and ensures fast page load times.
- Mobile Responsive: The restriction popup is fully responsive and works flawlessly on all devices, including desktops, tablets, and smartphones.
Security & Technical
- CSRF Protection: Includes built-in Cross-Site Request Forgery protection for all module forms.
- Multilingual Support: Automatically detects the user's language and displays the correct popup text.
- Easy Configuration: A user-friendly admin interface allows for quick and intuitive setup without any coding.
📋 Requirements
- PrestaShop: 1.7.0.0 or higher
- PHP: 7.0 or higher
🔧 Installation
Follow these steps to install the module:
- Download & Extract: Download the module
.zip file and extract its contents on your computer.
- Upload: Upload the
privateshop folder to your PrestaShop /modules/ directory.
- Install: In your PrestaShop admin panel, navigate to Modules → Module Manager.
- Activate: Search for "Private Shop" and click the Install button.
- Configure: Once installed, click Configure to access the settings page.
⚙️ Configuration
The module settings are organized into clear tabs for easy management.
Basic Settings
- Enable Private Shop: A simple toggle switch to turn the entire private shop functionality on or off.
Popup Settings
- Multilingual Text Fields: Customize the popup's content for every language installed in your store.
- Popup Title: The main heading of the restriction message.
- Popup Text: The descriptive body text explaining why access is restricted.
- Button Text: The call-to-action text for the login button.
Security
- Front-End Protection: Enable options to prevent guest users from viewing the page source, using the right-click context menu, or copying content.
Advanced
- CMS Page Exception: Select one or more CMS pages from a list to make them publicly accessible, bypassing the login restriction.
🐛 Troubleshooting
Common Issues
- The popup is not showing up.
- Ensure the module is enabled in the Basic Settings.
- The popup only appears for guest users. Make sure you are not logged in as a customer or an administrator.
- Clear your PrestaShop and browser cache.
- Language tabs are missing in the configuration.
- The multilingual tabs for popup settings will only appear if you have more than one active language in your PrestaShop store. You can add more languages under International → Localization → Languages.
- CSS styles are not loading correctly.
- Try clearing your PrestaShop cache (Advanced Parameters → Performance).
- Ensure the file
/modules/privateshop/assets/css/privateshop.css exists and has the correct file permissions.
💻 API Reference
The module provides helper methods for developers to interact with its configuration.
getConfig($key)
Retrieves a cached configuration value for improved performance.
// Check if the module is enabled
$isEnabled = $this->getConfig('enabled');
// Get the English popup title
$title = $this->getConfig('popup_title_en');
getPopupText($type, $languageIso = null)
Gets a specific popup text (title, text, or button) for a given language ISO code. It automatically falls back to English and then to a default value if a translation is not found.
// Get the popup title for the Greek language ('el')
$title = $this->getPopupText('title', 'el');
// Get the button text for the current language
$buttonText = $this->getPopupText('button');