Catalog Visibility Add-On
The SubloginCatalogVisibility add-on provides product visibility restrictions per sublogin with whitelist and blacklist modes.
Overview
The Catalog Visibility add-on extends the base Sublogin module with:
- Product Restrictions: Control which products each sublogin can see
- Whitelist Mode: Show only assigned products
- Blacklist Mode: Hide assigned products
- Collection Filtering: Automatic filtering across all product lists
- Search Integration: Restricted products don't appear in search
Installation
composer config bearer.repo.softwaresilo.io composer config repositories.softwaresilo composer https://repo.softwaresilo.io/ composer require mageb2b/sublogin-catalogvisibility:* php bin/magento module:enable MageB2B_SubloginCatalogVisibility php bin/magento setup:upgrade php bin/magento cache:flush Core Concepts
Restriction Type
Determines how product assignments are interpreted:
- Whitelist (0): Show ONLY assigned products
- Blacklist (1): Hide assigned products, show all others
Product Assignment
Products are assigned to sublogins via customer_sublogin_catalog_visibility table.
Collection Filtering
System automatically filters product collections based on restrictions.
Configuration
Set Restriction Type for Sublogin
Method 1: Admin Panel
- Navigate to Customers >All Customers
- Edit customer
- Go to Sublogins tab
- Edit sublogin
- Find Catalog Visibility section
- Set Restriction Type:
- Whitelist: Show only assigned products
- Blacklist: Hide assigned products
- Save sublogin
Method 2: Customer Account
- Log in as customer
- Go to My Sublogins
- Edit sublogin
- Configure catalog visibility
- Save
Restriction Modes
Whitelist Mode (Restrictive)
Behavior: Sublogin can ONLY see assigned products.
Configuration:
Restriction Type: Whitelist (0) Assigned Products: Product A, Product B, Product CResult:
- Product A: ✓ Visible
- Product B: ✓ Visible
- Product C: ✓ Visible
- Product D: ✗ Hidden
- Product E: ✗ Hidden
Use Cases:
- Sales rep with specific product portfolio
- Department-specific catalogs
- Regional product restrictions
- Customer-specific assortments
Blacklist Mode (Permissive)
Behavior: Sublogin can see ALL products EXCEPT assigned ones.
Configuration:
Restriction Type: Blacklist (1) Assigned Products: Product X, Product YResult:
- Product A: ✓ Visible
- Product B: ✓ Visible
- Product C: ✓ Visible
- Product X: ✗ Hidden
- Product Y: ✗ Hidden
Use Cases:
- Hide discontinued products
- Exclude competitor products
- Remove restricted items
- Hide internal-use products
Assigning Products
Method 1: Admin Panel - Sublogin Edit
- Edit sublogin
- Go to Catalog Visibility section
- Click Assign Products
- Product grid appears with checkboxes
- Search/filter products
- Check products to assign
- Click Save
Product Grid Columns:
- Checkbox
- Product ID
- Name
- SKU
- Price
- Status
- Visibility
Method 2: Admin Panel - Product Edit
- Edit product
- Go to Sublogin Visibility section
- Select sublogins to assign
- Save product
Method 3: Bulk Assignment
- Go to Catalog >Products
- Select multiple products
- Actions dropdown: Assign to Sublogins
- Select sublogins
- Submit
Where Restrictions Apply
Category Pages
Products are filtered based on restrictions:
Category: Electronics Total Products: 100 Sublogin with Whitelist (10 products assigned): → Shows 10 products Sublogin with Blacklist (5 products assigned): → Shows 95 productsSearch Results
Restricted products don't appear in search:
Search: "laptop" Total Results: 20 Sublogin with Whitelist (3 laptops assigned): → Shows 3 results Sublogin with Blacklist (2 laptops assigned): → Shows 18 resultsProduct Detail Pages
Direct access to restricted products:
Whitelist Mode: - Assigned product: Page loads normally - Non-assigned product: 404 Not Found Blacklist Mode: - Non-assigned product: Page loads normally - Assigned product: 404 Not FoundRelated Products
Related products are also filtered:
Product A has related products: B, C, D, E Sublogin can only see: A, B, C → Related products shown: B, C → Related products hidden: D, EUpsell/Cross-sell
Same filtering applies to upsell and cross-sell products.
Layered Navigation
Filters reflect only visible products:
Category: Clothing Filter: Size Sublogin sees 10 products (sizes: S, M, L) → Size filter shows: S, M, L → Size filter hides: XL, XXL (no visible products)Practical Examples
Example 1: Sales Representative Portfolio
Scenario: Sales rep can only sell specific product lines.
Sublogin: Sales Rep A Restriction Type: Whitelist Assigned Products: - Product Line: Office Furniture - Categories: Desks, Chairs, Storage - Total Products: 45 Result: - Can see: 45 office furniture products - Cannot see: All other products - Search: Only returns office furniture - Categories: Only office furniture categories visibleUse Case: Territory-based sales, product specialization
Example 2: Regional Restrictions
Scenario: EU sublogin cannot see US-only products.
Sublogin: EU Branch Restriction Type: Blacklist Assigned Products: - Products with attribute "region" = "US Only" - Total Products: 120 Result: - Can see: All products except 120 US-only - Cannot see: 120 US-only products - Search: US-only products excludedUse Case: Regional compliance, shipping restrictions
Example 3: Department-Specific Catalog
Scenario: IT department only sees IT products.
Sublogin: IT Department Restriction Type: Whitelist Assigned Products: - Category: Computers & Electronics - Category: Software - Category: Accessories - Total Products: 200 Result: - Can see: 200 IT-related products - Cannot see: Office supplies, furniture, etc. - Budget: Applied only to visible productsUse Case: Department budgets, purchasing control
Example 4: Hide Discontinued Products
Scenario: Hide discontinued products from all sublogins.
Sublogin: All Employees Restriction Type: Blacklist Assigned Products: - Products with status "Discontinued" - Total Products: 35 Result: - Can see: All active products - Cannot see: 35 discontinued products - Main customer: Can still see all productsUse Case: Product lifecycle management
Integration with Other Features
With Roles & Permissions
Sublogin: Sales Rep Role: Sales Representative Permissions: - view_product_list - view_product_details - view_product_prices - add_product_to_cart Catalog Visibility: - Whitelist: 50 assigned products Result: - Can view and add to cart: 50 assigned products - Cannot checkout (no place_order permission)With Budget Management
Sublogin: Department Manager Budget: €5000/month Catalog Visibility: - Whitelist: Department-specific products Result: - Budget applies only to visible products - Cannot exceed budget on visible products - Cannot see or order restricted productsWith Order Approval
Sublogin: Employee Order Approval: Required Catalog Visibility: - Whitelist: Approved products only Result: - Can only order from approved product list - Orders require manager approval - Manager sees same product restrictionsPerformance Considerations
Collection Filtering
System adds WHERE clause to product collections:
-- Whitelist Mode WHERE entity_id IN (SELECT product_id FROM customer_sublogin_catalog_visibility WHERE sublogin_id = ?) -- Blacklist Mode WHERE entity_id NOT IN (SELECT product_id FROM customer_sublogin_catalog_visibility WHERE sublogin_id = ?)Caching
- Product collections are cached per sublogin
- Cache is invalidated when assignments change
- Full page cache considers sublogin ID
Indexing
- No additional indexes required
- Uses existing product indexes
- Foreign key indexes on visibility table
Troubleshooting
Products Not Filtering
- Check restriction type is set
- Verify products are assigned
- Clear cache:
php bin/magento cache:flush - Reindex:
php bin/magento indexer:reindex
Wrong Products Showing
- Verify restriction type (Whitelist vs Blacklist)
- Check product assignments
- Review sublogin configuration
- Check if logged in as correct sublogin
Product Detail Page 404
- Check if product is assigned (Whitelist mode)
- Check if product is blacklisted (Blacklist mode)
- Verify product is enabled and visible
- Check product website assignment
Search Not Filtering
- Verify search index is up to date
- Reindex catalog search:
php bin/magento indexer:reindex catalogsearch_fulltext - Clear cache
- Check search configuration
Configuration Reference
Stores >Configuration > MageB2B > Sublogin Catalog Visibility - Enable Catalog Visibility: Yes/No - Default Restriction Type: Whitelist/Blacklist - Apply to Search: Yes/No - Apply to Related Products: Yes/No - Apply to Upsell/Cross-sell: Yes/No - Show Empty Categories: Yes/No - Redirect Restricted Products: 404/Home/CategoryAPI Integration
Get Visible Products for Sublogin
GET /rest/V1/sublogin/:subloginId/catalog/productsAssign Products to Sublogin
POST /rest/V1/sublogin/:subloginId/catalog/assign { "productIds": [1, 2, 3, 4, 5] }Remove Product Assignments
DELETE /rest/V1/sublogin/:subloginId/catalog/product/:productIdImport/Export
Export Product Assignments
php bin/magento sublogin:catalog:export --sublogin-id=5 --output=assignments.csvImport Product Assignments
php bin/magento sublogin:catalog:import --file=assignments.csvCSV Format:
sublogin_id,product_id,restriction_type 5,101,0 5,102,0 5,103,0