Product exchange¶
Remote PIM¶
Even if this is outside the scope of this training, this is important to know that the products could be stored outside Ibexa DXP. With a remote PIM, Ibexa DXP role is to display them on the storefront, and, for the Commerce edition, to allow their purchase.
Product model migration¶
After having modeled your catalog organization on your developer instance, you may want/need to generate migration files for backup, or to install the model on a shared instance (for example a staging instance, or the production instance where the creation of the final products is then done).
Export attribute groups, attributes, and product types:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  |  | 
Export product categories:
1 2 3 4 5  |  | 
TODO: What about product migration limitation, and product variant migration inexistence?
REST API¶
Thanks to REST API, Ibexa DXP's PIM can be shared with other applications.
Attribute groups and attributes¶
| CRUD action | Method verb | Route | 
|---|---|---|
| Create | POST | /product/catalog/attribute_groups | 
| Read | GET | /product/catalog/attribute_groups/ | 
| Update | PATCH | /product/catalog/attribute_groups/ | 
| Delete | DELETE | /product/catalog/attribute_groups/ | 
TODO: GET /product/catalog/attribute_types TODO: GET /product/catalog/attribute_types/{identifier}
TODO: DELETE /product/catalog/attribute_groups/translation/{id}/{languageCode}
| CRUD action | Method verb | Route | 
|---|---|---|
| Create | POST | /product/catalog/attributes | 
| Read | POST | /product/catalog/attributes/view | 
| Read | GET | /product/catalog/attributes/ | 
| Update | PATCH | /product/catalog/attributes/ | 
| Delete | DELETE | /product/catalog/attributes/ | 
TODO: DELETE /product/catalog/attributes/translation/{id}/{languageCode}
Product types¶
| CRUD action | Method verb | Route | 
|---|---|---|
| Create | POST | /product/catalog/product_types | 
| Read | GET | /product/catalog/product_types/ | 
| Read | GET | /product/catalog/product_types/is_used/ | 
| Read | POST | /product/catalog/product_types/view | 
| Update | PATCH | /product/catalog/product_types/ | 
| Delete | DELETE | /product/catalog/product_types/ | 
Product and product variants¶
| CRUD action | Method verb | Route | 
|---|---|---|
| Create | POST | /product/catalog/products/ | 
| Read | GET | /product/catalog/products/ | 
| Read | POST | /product/catalog/products/view | 
| Read | POST | /product/catalog/catalogs/ | 
| Update | PATCH | /product/catalog/products/ | 
| Delete | DELETE | /product/catalog/products/ | 
| CRUD action | Method verb | Route | 
|---|---|---|
| Create | POST | /product/catalog/product_variants/ | 
| Create | POST | /product/catalog/product_variants/generate/ | 
| Read | GET | /product/catalog/product_variant/ | 
| Read | POST | /product/catalog/product_variants/view/ | 
| Update | PATCH | /product/catalog/product_variants/ | 
| Delete | DELETE | /product/catalog/product_variants/ | 
Product assets¶
TODO
Catalogs¶
| CRUD action | Method verb | Route | 
|---|---|---|
| Create | POST | /product/catalog/catalogs | 
| Create | POST | /product/catalog/catalogs/copy/ | 
| Read | GET | /product/catalog/catalogs/ | 
| Read | POST | /product/catalog/catalogs/view | 
| Update | PATCH | /product/catalog/catalogs/ | 
| Delete | DELETE | /product/catalog/catalogs/ | 
Categories¶
TODO
TODO: Exercises¶
TODO: Exercise request through REST the bikes from "5 series" TODO: /product/catalog/catalogs/{identifier}/products/view
PHP API¶
Ibexa DXP's PIM can be extended, accessed through custom controllers, command lines, or whatever you imagine, thanks to the PHP API.
There are several services to read or modify the product model, the products, and other product related features.
Attribute groups and attributes¶
Product API > Attributes gives example about attribute groups and attributes reading and writing.
Notice that there are AttributeGroupServiceInterface and AttributeDefinitionServiceInterface for reading,
and LocalAttributeGroupServiceInterface and LocalAttributeDefinitionServiceInterface for writing.
This is due to reading being available for both local and remote PIM, while writing is available only locally.
This Local prefix in names of services allowing to write is recurrent.
Product types¶
Product API > Product types illustrates how to access product types through the ProductTypeServiceInterface.
To create product types, you could use
\Ibexa\ProductCatalog\Local\Repository\ProductType\ContentTypeFactoryInterface::createContentTypeCreateStruct
(vendor/ibexa/product-catalog/src/lib/Local/Repository/ProductType/ContentTypeFactoryInterface.php).
Notice that this interface isn't in the Ibexa\Contracts namespace, which means that its behavior could change in a future minor version.
As you can see in its ContentTypeFactory::createContentTypeCreateStruct implementation,
this function is responsible for the default fields of a new product type.
Product and product variants¶
Product API > Products gets examples of products and product variants reading and writing.
Notice again that there is a ProductServiceInterface for reading and a LocalProductServiceInterface for writing,
to distinguish what is available on both local and remote PIM, and what is available only locally.
About product search with ProductServiceInterface::findProducts(), also see the following references:
Product assets¶
Product API > Products > Product assets has an example of asset reading.
AssetServiceInterface is used to read product assets,
and LocalAssetServiceInterface to write some.
An asset collection as seen in the back office is represented by an associative array of tags (with attribute identifiers as keys),
and related getters and setters are named getTags() and setTags (for example, AssetInterface::getTags() or AssetUpdateStruct::setTags()).
Write a command that display the assets of the 4 Series Fuji.
1 2 3  |  | 
Notice that AssetServiceInterface::findAssets() returns an AssetCollectionInterface.
AssetCollectionInterface isn't an asset collection as in the back office. It's just a traversable storing a list of assets without any hierarchy.
You can take a look at
\Ibexa\Bundle\ProductCatalog\UI\AssetGroup\AssetGroupCollectionFactory::createFromAssetCollection()
(vendor/ibexa/product-catalog/src/bundle/UI/AssetGroup/AssetGroupCollectionFactory.php).
to see how the back office transform the flat asset list into an "Assets collection for variant" list.
Catalogs¶
Categories¶
Taxonomy API for product categories
TODO: Exercises¶
TODO: Exercise: Write a command/controller listing all mountain bikes by series.
TODO: Exercise: "4 Series" has been discontinued. Create a "Retired product" category below root, moveā¦