Why use a separated NormalProduct entity instead of leveraging native Product Attributes for location-specific Services?
Background & The Issue
In the current architecture of QloApps, additional services are decoupled into what acts as a clone of the core Product entity (managed via AdminNormalProductsController). When a service (e.g., breakfast, spa, airport shuttle) is required across multiple hotels but requires hotel-specific pricing, the system forces the creation of a massive amount of distinct product entries.
For instance, if a marketplace or chain has 100 hotels and each has a slightly different rate for the same breakfast service, administrators must spawn 100 distinct products.
This technical choice introduces several critical issues:
- Database Bloat & Scalability: Spawning 100 products for 1 service scales terribly. It exponentially multiplies entries inside
ps_product,ps_product_lang,ps_product_shop,ps_image, etc., - Maintenance Nightmare: If the description or global settings of the "Breakfast" service change, the admin has to update 100 separate products instead of altering a single entity.
- Complex Data Flow: It splits the catalog logic, requiring heavy core modifications and custom controllers to handle what PrestaShop already natively supports.
Alternative Proposal: Leveraging Native Product Attributes / Combinations
Instead of building a NormalProduct wrapper that duplicates rows, why didn't the core team leverage PrestaShop's native Product Attributes (Combinations) or a single unified mapping layer?
How it would look architectural-wise:
- 1 Service = 1 Native Product: Create a single product named "Breakfast".
- Hotel As An Attribute: Generate an Attribute Group named "Hotel Location" where each attribute value corresponds to an
id_hotel. - Native Price Impacts: Leverage the native
id_product_attribute(combinations) to store specific prices, tax rules, or status overrides per hotel.
Major Benefits of this approach:
- Zero Database Saturation: 1 service remains 1 row in
ps_product. Adding a 101st hotel only adds 1 combination line. - Native Ecosystem Compatibility: The service seamlessly integrates into
Cart,Product page, checkout steps, invoices, and accounting hooks because it reuses 100% of the native PrestaShop 1.6 core engine. - Auto-Selection: Via a simple override on
ProductControllerandCart, QloApps could automatically inject the correctid_product_attributeby matching it with the activeid_hotelcurrently stored in the user's session or cookie.
Questions to the Core Team / Community
I would love to understand the core reasoning behind this structural decision:
- Was there a hard constraint or technical blocker in the PrestaShop 1.6 core that prevented using native combinations/attributes for location-based services?
- Why choose to maintain a cloned product logic (
NormalProduct), which breaks native core behaviors and requires repetitive data entry, over an attribute/combination approach or an externalhotel_service_pricingmapping table?
Looking forward to your architectural insights on how we can make QloApps more scalable for multi-property configurations!
Source: Qloapps/QloApps