Project

General

Profile

Edit Copy Actions

Feature #10935

open

To implement a dyunamic product filters based on the selected category

Added by Ajit A 2 days ago. Updated about 23 hours ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Start date:
09/21/2026
Due date:
% Done:

100%

Estimated time:
8:00 h
Spent time:

Add

Subtasks


Add

Related issues

Actions #1

Updated by Ajit A 2 days ago

  • Estimated time changed from 4:00 h to 8:00 h
Actions #2

Updated by Ajit A 2 days ago

  • Subject changed from To implement a google, twitter, facebook authenication to To implement a dyunamic product filters based on the selected category
Actions #3

Updated by Ajit A 1 day ago

  • Status changed from New to In Progress

Updated by Ajit A about 23 hours ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Executive Summary
Implemented end-to-end support for Category-Defined Dynamic Attributes and Storefront Filtering. Merchants can now configure custom filter definitions (e.g., Pot Size, Light Needs, Water Needs) on a category level via the POS Admin Dashboard. Products belonging to that category accept these dynamic attributes, and the storefront dynamically renders category-specific filter accordions on the product listing page (/api/v1/comm/find).

1. Repository: evergreen_pos_be (Backend Server)
🛠️ Key Modifications & Features
Category Model Schema Update (Categories-model.js & nursery.product.js):
Added attributeDefinitions schema array (key, label, type, options, isFilterable, isRequired) to enable categories to store dynamic filter metadata.
Product Model Schema Update (productModel.js & nursery.product.js):
Added attributes Map (type: Map, of: String) and a wildcard index (attributes.$**) to store dynamic key-value specifications on product documents.
Payload Protection (productPayloadFilter.js):
Included "attributes" in GLOBAL_PRODUCT_FIELDS so Express request body sanitizers preserve attribute payload objects when creating or updating products.
Dynamic Search & Aggregation Pipeline (product.service.js & ecom.controller.js):
Registered both GET and POST handlers for /api/v1/comm/find.
Built getPossibleAttributeFieldPaths() helper to resolve incoming filter keys (e.g., attr_potsize, attr_lightneeds) across dynamic schema paths (attributes.potSize, attributes.potsize, potSize, lightRequirement) using MongoDB aggregate $match-compatible literal $in and case-insensitive $regex matching.
Extended catId and subCatId query matchers to support both UUID fields (catId, subCatId) and legacy string fields (category, subcategory).
Returned attributeDefinitions array and dynamicFacets object in /comm/find search response payloads.
Subcategory Route Fix (product.route.js & nursery.product.controller.js):
Added GET and POST handlers for /api/v1/nus-category/get-all-sub-cat/:id with tenant slug resolution fallback (req.body, req.query, req.tenant), resolving 404 route errors.
2. Repository: evergreen_pos_fe (Admin Dashboard POS)
🛠️ Key Modifications & Features
Category Dynamic Filter Management (CategoryModal.tsx):
Added an Admin UI section inside category creation/edit modal to configure dynamic attribute definitions (Filter Label, Attribute Key, Control Type, Filterable Options, Show on Sidebar).
Category-Scoped Product Attributes (CreateProduct.tsx & types.ts):
Updated category selection handler to scope dynamic attribute inputs strictly to the selected category (categoriesData.find(c => c._id === formData.category || c.clId === formData.category)).
Added automatic state reset (setProductAttributes({})) when changing categories to prevent attribute bleed-over between categories.
Rendered dynamic attribute form controls only when a category with defined attributes is selected.
3. Repository: evergreenpos_E-commerce_new (Storefront Web App)
🛠️ Key Modifications & Features
Dynamic Storefront Sidebar Filtering (FilteredProducts.tsx):
Integrated dynamic category attribute accordions in the search filter sidebar driven by attributeDefinitions and dynamicFacets returned from /api/v1/comm/find.
Added dynamic check/uncheck handlers that map selected attribute values to URL parameters (attr_<key>).
Responsive Layout & Auth Adjustments:
catlogproducts.tsx & productdetailsui.tsx: Made "GO TO CART" button text responsive (hidden sm:inline) for small mobile viewports.
Cleaned up auth flow parameters in SocialLoginButtons.tsx, Login.tsx, and CreateAccountModal.tsx.

Edit Copy Actions

Also available in: Atom PDF