A technical breakdown of how the Ayko_SharedCatalog fallback mechanism operates within the Penn-Elcom Magento 2 codebase. This module solves the issue of having to explicitly define every B2B price in every shared catalog.
Penn-Elcom use customer groups which they name as "Special Pricing Agreement". This is where Penn-Elcom and a Business agree a special price for a subsection of products.
For products not specifically included in that business's agreement, they will fall into a larger group tier rather than defaulting to the standard retail price.
The technical goal of the Ayko_SharedCatalog module is to facilitate this behavior efficiently. If a B2B Customer Group (Shared Catalog) does not have an explicitly defined price for a specific product, the system must fallback to a designated parent catalog's price without complex frontend calculation overhead.
To power this relationship, the module extends the core schema:
fallback_group_id is added to the shared_catalog table via db_schema.xml.GroupInterface) is extended with a fallback_customer_group attribute, linking the shared catalog fallback directly to the customer group.The heavy lifting of the fallback mechanism is deliberately executed at the Index Level rather than the Frontend to ensure performance. It relies on two key plugins:
Price\Action & Price\TierPriceThe module hooks into the afterExecute method of Magento's native Price Indexer. When Magento finishes indexing standard prices into dimension tables (e.g., catalog_product_index_price_cg31_ws1), the Ayko plugin runs a secondary routine:
fallbackGroupId assigned.cg7_ws1).LEFT JOIN. It strictly looks for: pi.entity_id IS NULL OR pi.tier_price IS NULLBecause this fallback mechanism injects the final computed prices directly into the core Magento index tables (catalog_product_index_price and tier price tables), any search engine that reads prices natively from the Magento index (like ElasticSuite) will automatically inherit these fallback prices without any extra API work.
However, if moving to Algolia or Coveo, you must ensure their indexing jobs are configured to read from the final dimension tables rather than calculating B2B logic on the fly.