Catalog API¶
To get information about product catalogs and manage them, use CatalogServiceInterface.
Get catalog¶
To get a single catalog, use Ibexa\Contracts\ProductCatalog\CatalogServiceInterface::getCatalog() and provide it with catalog ID, or CatalogServiceInterface::getCatalogByIdentifier() and pass the identifier:
1 2 | |
Get products in catalog¶
To get products from a catalog, request the product query from the catalog object with Ibexa\Contracts\ProductCatalog\Values\CatalogInterface::getQuery().
Then, create a new ProductQuery based on it and run a product search with ProductServiceInterface::findProduct():
1 2 3 4 5 6 | |
Create catalog¶
To create a catalog, you need to prepare a CatalogCreateStruct that contains: identifier, name, description, and Criteria for filtering products.
Then, pass this struct to CatalogServiceInterface::createCatalog():
1 2 3 4 5 6 7 8 | |
Update catalog¶
Use CatalogServiceInterface::updateCatalog() to update an existing catalog.
You must pass the catalog object and a CatalogUpdateStruct to the method.
In the following example, you update the catalog to publish it:
1 2 3 4 | |