OroCommece has an advanced web catalog to manage all frontend display related to catalog menu , products , landing page , So from admin Left Menu Products→ Master Catalog you have the ability to add all your category with many roots , and create restriction based to customer or customer group or localization , you can managing SEO , global product options by category …..
But the categories management is small part of catalog management often the B2B Shop need mutlti catalog display related to current customer or need other links based on dynamic variant for example: adding to principal menu a root link with sub links which can show a dynamic products segment of specific brand or new arrival products with some condition for example just product created in some time Or... in the same time you want restrict Links and Products display just for some of your customers, So this very small opportunity gave by Marketing→ Web Catalogs , you can make all this complex job manually by admin user without coding.
What about Override Product Variant Configuration* : you should check if you don’t add product manually , if you have added by segment or by expression .
And from note we have : If has selected, all simple product variants included into this product collection will be displayed on the page regardless of "Display Simple Variations" setting in the system configuration. Please note that this applies only to the products included via "Advanced Filter", as both "Manually Added" and "Excluded" products do not depend on this configuration option.
If you don’t check it and you use an external 3d party lib for example to reindex the integer.manually_added_to_variant well get added to criteria , but if you didn’t add manually products so for example integer.manually_added_to_variant_1 didn’t get reindexed so you have an empty result .
All fields added to website reindexing:
Oro\Bundle\ProductBundle\Entity\Product: alias: oro_product_WEBSITE_ID fields: - name: product_id type: integer - name: sku_uppercase type: text - name: status type: text - name: type type: text - name: inventory_status type: text - name: is_variant type: integer - name: all_text type: text store: false default_search_field: true - name: all_text_LOCALIZATION_ID type: text store: false - name: assigned_to_ASSIGN_TYPE_ASSIGN_ID type: integer - name: image_product_large type: text - name: image_product_medium type: text - name: product_units type: text - name: primary_unit type: text - name: attribute_family_id type: integer - name: manually_added_to_ASSIGN_TYPE_ASSIGN_ID type: integer
manually_added_to_ASSIGN_TYPE_ASSIGN_ID for example is : integer.manually_added_to_variant_1
assigned_to_ASSIGN_TYPE_ASSIGN_ID: integer.assigned_to_variant_1
The manually_added_to_ASSIGN_TYPE_ASSIGN_ID well get reidexed inside class vendor/oro/commerce/src/Oro/Bundle/ProductBundle/EventListener/ManuallyAddedProductCollectionIndexerListener.php just if some products has been added manually to some variant
assigned_to_ASSIGN_TYPE_ASSIGN_ID: well get indexed if the variant has used which means all the time
the query related to last display based on variant get built in commerce/src/Oro/Bundle/ProductBundle/DataGrid/EventListener/SearchContentVariantFilteringEventListener.php :
by event onBuildAfter of datagird frontend-product-search-grid
oro_product.datagrid.event_listener.search_content_variant_filtering: class: Oro\Bundle\ProductBundle\DataGrid\EventListener\SearchContentVariantFilteringEventListener arguments: - '@oro_product.handler.request_content_variant' calls: - [setConfigManager, ['@oro_config.manager']] tags: - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.pre.frontend-product-search-grid, method: onPreBuild } - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.frontend-product-search-grid, method: onBuildAfter }
the part of code is:
$datasource ->getSearchQuery() ->addWhere(Criteria::expr()->eq(sprintf('integer.assigned_to_variant_%s', $contentVariantId), 1));</p> <p> $overrideVariantConfiguration = $event->getDatagrid() ->getConfig() ->offsetGetByPath(self::OVERRIDE_VARIANT_CONFIGURATION_CONFIG_PATH); if ($overrideVariantConfiguration) { $datasource ->getSearchQuery() ->addWhere(Criteria::expr()->gte('integer.is_variant', 0)); } elseif ($this->isVariationsHideCompletely()) { $datasource ->getSearchQuery() ->addWhere(Criteria::expr()->orX( Criteria::expr()->eq('integer.is_variant', 0) )); }
Test to Override Product Variant Configuration*:
$overrideVariantConfiguration = $event->getDatagrid() ->getConfig() ->offsetGetByPath(self::OVERRIDE_VARIANT_CONFIGURATION_CONFIG_PATH);
Done!
Comments