Product lists + Catalog feature integration
Edit on GitHubInstall Feature Core
Prerequisites
To start feature integration, overview and install the necessary features:
Name | Version |
---|---|
Product Lists | master |
Catalog | master |
Customer | master |
1) Install the required modules using Composer
Run the following command(s) to install the required modules:
composer require spryker/customer-catalog:"^1.0.0" --update-with-dependencies
Make sure that the following modules were installed:
Module | Expected Directory |
---|---|
CustomerCatalog |
vendor/spryker/customer-catalog |
2) Configure Elasticsearch Querying
Prepare the Search Queries
Once the Product List data is exported to Elasticsearch, make sure to extend your search queries to filter out Restricted Products by adding the following query expander plugin to all your search queries where necessary.
Plugin | Specification | Prerequisites | Namespace |
---|---|---|---|
ProductListQueryExpanderPlugin |
Expands an Elasticsearch query for Abstract and Concrete Products with Blacklist and Whitelist filters based on the Customer session. The result of the query will contain only Products that were on the given Whitelists, but not on the given Blacklists. |
The Customer session must contain Product List information. See Merchant Product Restrictions feature integration for an example implementation. | Spryker\Client\CustomerCatalog\Plugin\Search |
ProductListQueryExpanderPlugin |
Expands search query with filtering by product list ID. | None | Spryker\Client\ProductListSearch\Plugin\Search |
The order of the query expander plugins matters for the search result. Make sure that your query expanders are in the appropriate order. I.e., the FacetQueryExpanderPlugin
needs to be placed after all the other plugins that filter down the result; otherwise, it can’t generate the proper query fragment for itself.
src/Pyz/Client/Catalog/CatalogDependencyProvider.php
<?php
namespace Pyz\Client\Catalog;
use Spryker\Client\Catalog\CatalogDependencyProvider as SprykerCatalogDependencyProvider;
use Spryker\Client\CustomerCatalog\Plugin\Search\ProductListQueryExpanderPlugin as CustomerCatalogProductListQueryExpanderPlugin;
use Spryker\Client\ProductListSearch\Plugin\Search\ProductListQueryExpanderPlugin as ProductListSearchProductListQueryExpanderPlugin;
class CatalogDependencyProvider extends SprykerCatalogDependencyProvider
{
/**
* @return \Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface[]
*/
protected function createCatalogSearchQueryExpanderPlugins()
{
return [
new CustomerCatalogProductListQueryExpanderPlugin(),
];
}
/**
* @return \Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface[]
*/
protected function createSuggestionQueryExpanderPlugins()
{
return [
new CustomerCatalogProductListQueryExpanderPlugin(),
];
}
/**
* @return \Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface[]
*/
protected function getProductConcreteCatalogSearchQueryExpanderPlugins(): array
{
return [
new CustomerCatalogProductListQueryExpanderPlugin(),
new ProductListSearchProductListQueryExpanderPlugin(),
];
}
}
Make sure you haven’t missed the expansion of any product search queries in your project where you need to consider Product Lists.
You should also be able to filter product concrete search results by product list ID.
Thank you!
For submitting the form