Purpose of this Plugin
The standard Zen Cart installation can be configured in Admin > Configuration > Customer Details as:
Customer Shop Status - View Shop and Prices
Customer must be approved to shop
0= Not required
1= Must login to browse
2= May browse but no prices unless logged in
3= Showroom Only
Selecting any of these options assigns conditions 0-3 globally, meaning that every single category / product detail page is treated the same way.
But if you only want some categories to be option "1" or option "2" but leave all the other categories unchanged - how do you do that?
This plugin allows you to do exactly that, namely ....
- hide prices of selected categories if the customer is not logged in. The prices of these categories are hidden and the 'Buy Now' button is replaced with 'Login for price'
- specify selected categories which can only be accessed by privileged customers, for example paid-up members. The customer must be logged in AND the customer must be individually authorized by the store owner to access the selected category / categories. Just being logged in does not automatically grant access to these 'privileged' categories. The authorization is done via the Admin > Customers file.
- specify manufacturers whose products are hidden and are only accessible by customers with special 'privileges'. This can be useful if the manufacturer imposes such a restriction upon online stores or if the range of their products is of sensitive nature.
These categories and manufacturers can be configured via admin and the configuration is stored in the database.
The chosen configuration is reflected in the centreboxes 'New Products For (month)' , 'Specials' and 'Featured Products' and their corresponding sideboxes.
The 'Bestsellers' sidebox is disabled unless a 'privileged' customer is logged in. At this stage the 'Bestsellers' sidebox can not be configured in any other way (I am working on this.....).
In addition 'All Products' also reflects the chosen configuration.
The whole store continues to work as normal, customers can browse, see prices, add products to the cart and check out - with the exception of the specified categories and/or manufacturers.
To see an example of this plugin in action please visit the Demo Store
Disclaimer
This mod has been tested to work with Zen Cart v1.5.4 and v1.5.5 but it has not been tested with prior versions. In fact, I am almost sure it won't work with the ZC 1.3.x series without further modification.
Change Log
Version 2.2.0 (2016-07-22)
- Updated various files to work / comply with ZC v1.5.5 files.
- Added intercept page (Restricted Access) - content can be defined in Admin > Tools > Define Pages Editor > define_restricted_access.php
- Minor bug fixes.
- Updated readme.html file.
Version 2.1.2 (2015-11-02)
- Fixed bug in the installer which prevented the script to complete the installation process resulting in error accessing admin.
Version 2.1.1 (2015-09-15)
- Changes to installation procedure:
- added auto-installer to comply with latest Zen Cart plugin procedures
- eliminated the need of manually running sql install patch
- updated sql uninstall patch
- changes to includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php:
- eliminated having to enter the master categories ID AND the corresponding full cPath (eg 4_12_100) in admin
- added snapshot to 'Login for price' so customer is automatically directed back to the selected product page after logging in
- added appropriate code to 'Document Product' to incorporate this product type into CSAR
- changes to includes/functions/functions_prices.php:
- made 'Login for price' in the listings 'clickable' (= directing to the login page)
- Minor bug fixes
- Updated readme.html file
Upgrading from version 2.1.x to current version
Backup first - files and database
- then:
- Log into your admin and take site 'Down For Maintenance'
- After unpacking the zip file to a temp folder on your computer, open the folder 'CSAR_files' and rename the folders 'YOUR_ADMIN_NAME' and every instance of 'YOUR_TEMPLATE' to match the folder names of your admin and store template
- Compare, merge and upload all new/changed/updated files and folders
- Test and take the site out of maintenance mode.
Upgrade complete.
Upgrading from version 2.0 to current version
Backup first - files and database
- then:
- Log into your admin and take site 'Down For Maintenance'
- Take note of all current categories and manufacturers which you have previously configured for restricted access (you will need them later).
- Still in admin go to Tools > Install Sql Patches and run the sql patch named
CSAR_old_version_2-0_uninstall.sql
- After unpacking the zip file to a temp folder on your computer, open the folder 'CSAR_files' and rename the folders 'YOUR_ADMIN_NAME' and every instance of 'YOUR_TEMPLATE' to match the folder names of your admin and store template
- Compare, merge and upload all new/changed/updated files and folders
- delete the file
YOUR_ADMIN_NAME/includes/functions/extra_functions/category_specific_access_restriction_admin_page_reg.php - if it still exists
- Still in admin, click on any link on the menu, the link 'Admin Home' is always a good selection. This will trigger the auto-installer.
- Navigate to Catalog > Category Restriction and enter your category / manufacturer ID's you noted in step 2.
- Test and take the site out of maintenance mode.
Upgrade complete.
New Installation
IMPORTANT: DO NOT SKIP A SINGLE STEP !
Most ERRORS occur due to improper merging, uploading files to the wrong location or taking shortcuts !!!
- Log into your admin and take site 'Down For Maintenance'
- Backup, Backup, Backup!
Backup your DB and file system
Keep this backup in a safe place to enable uninstallation if so desired
- After unpacking the zip file to a temp folder on your computer, open the folder 'CSAR_files' and rename the folders 'YOUR_ADMIN_NAME' and every instance of 'YOUR_TEMPLATE' to match the folder names of your admin and store template
- Merge the content of the 'CSAR_files' folder with your current working file system. Use an application like Beyond Compare or WinMerge (if you are a Windows user) to perform this task.
- Log into your Admin again (if you have been logged out)
- Upload all files you merged in step 4. of this section (the files included in the 'CSAR_files' folder) to the appropriate locations on your server (the file structure conforms with Zen Cart standards). DO NOT upload the CSAR_files folder itself.
- Still in admin, click on any link on the menu, the link 'Admin Home' is always a good selection. This will trigger the auto-installer.
You are now ready to configure the categories and/or manufacturers you want to restrict.
Configuration
Go to
Admin > Catalog > Category Restriction
Before proceeding further you need to decide which categories you want to restrict. You can find the category ID's / manufacturer ID's by hovering your mouse over the category / manufacturer names on your store front.
Please Note:
If you don't want to hide any prices or restrict categories access or restrict manufacturers then set the value to something very high (a category ID or manufacturer ID which does not exist). The default is '1000'. CSAR needs a value in any of the fields to operate.
- Hide Prices of Specific Categories
Restrict product price display for specific categories if the customer is not logged in.
Enter the categories ID as a comma delimited list (eg 12,19,28) - do not use spaces. Don't use the full category path (eg 7_28).
In this example categories 12, 19, 28 can be restricted.
- Update and done
- Set Categories Requiring Customer To Login
Specify products of certain categories which can only be accessed by individually approved and logged in customers.
Enter the categories ID as a comma delimited list (eg 12,19,36) - do not use spaces.
In this example categories 12, 19 and 36 can be restricted. Any of these categories can be a top level category or a sub category. Don't use the full category path (eg 7_36).
- Update and done
- Set Manufacturers Requiring Customer To Login
Set products of certain manufacturers to be accessed by individually approved and logged in customers only.
Enter the manufacturers IDs as a comma delimited list (eg 1,5,6) - do not use spaces.
In this example products of manufacturer IDs 1, 5, 6 can be restricted.
The restriction could be to hide prices of certain manufacturer's products or it could be used to assign privileged access to manufacturer's products.
- Update and done
Please note that you still need to assign special privileges to certain customers you want to allow access to products of categeories / manufacturers you configured in points 2. and 3. in this segment.
To grant access to these customers go to Admin > Customers > Customers and individually open the details of your chosen/approved customers.
In your list of customers you will see a new column on the right hand side headed Privileges. By default the icon is a red cross. You can sort this column to find which customers are 'privileged' or not.
You can edit the details of an approved customer by clicking the Edit button of that customer
Near the top of each customer's personal details you find a dropdown called Customers Special Privileges Status. The default is 'None'. Set this to 'Has Special Privileges'.
Update the customer file - done
The icon in the customer listing is now changed from a red cross to green indicating that the customer has special privileges.
Uninstall CSAR
- Replace all merged files with the files from your backup. You did BACKUP - didn't you??!!
- Delete all new CSAR files from the server
- Run the included sql patch CSAR_uninstall.sql by going to your Admin > Tools > Install SQL Patches. Copy and paste the code, do not use the upload function
Additional Help
If you have any problems using this add-on module, then first review its support thread to see if the question has already been answered. If not post a query there. What support I can offer will be through the Zen Cart support forum so that all users can benefit. Please don't send me emails, PMs or telephone me - these won't get you help, they'll get you blacklisted.
Final Word
If you are happy with this mod you are cordially invited to make a small donation (PayPal to billing@isonetwork.net.au) towards the power consumption of my computer which has helped me to make this contribution workable.
Cheers from frank18 - isonetwork.net.au