@@ -20,36 +20,36 @@ description: Use PHP API to manage products in PIM, their attributes, availabili
2020Get an individual product by using the ` productService::getProduct() ` method:
2121
2222``` php
23- [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 62, 65 ) =]]
23+ [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 68, 71 ) =]]
2424```
2525
2626Find multiple products with ` productService::findProducts() ` .
2727Provide the method with optional filter, query or Sort Clauses.
2828
2929``` php
30- [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 66, 76 ) =]]
30+ [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 72, 82 ) =]]
3131```
3232
3333### Modifying products
3434
3535To create, update and delete products, use the ` LocalProductServiceInterface ` .
3636
3737``` php
38- [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 87, 91 ) =]]
38+ [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 93, 97 ) =]]
3939```
4040
4141To create a product, use ` LocalProductService::newProductCreateStruct() ` .
4242Provide the method with the product type object and the main language code.
4343You also need to set (at least) the code for the product and the required Field of the underlying content type, ` name ` :
4444
4545``` php
46- [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 77, 84 ) =]]
46+ [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 83, 90 ) =]]
4747```
4848
4949To delete a product, use ` LocalProductService::deleteProduct() ` :
5050
5151``` php
52- [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 114, 115 ) =]]
52+ [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 120, 121 ) =]]
5353```
5454
5555### Product variants
@@ -125,15 +125,15 @@ Get the availability object with `getAvailability()`.
125125You can then use ` ProductAvailabilityServiceInterface::getStock ` to get the stock number for the product:
126126
127127``` php
128- [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 98, 103 ) =]] }
128+ [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 104, 109 ) =]] }
129129```
130130
131131To change availability for a product, use ` updateProductAvailability() ` with a ` ProductAvailabilityUpdateStruct `
132132and provide it with the product object. The second parameter defines whether product is available,
133133and the third whether its stock is infinite. The fourth parameter is the stock number:
134134
135135``` php
136- [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 106, 109 ) =]]
136+ [[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 112, 115 ) =]]
137137```
138138
139139## Attributes
@@ -145,27 +145,27 @@ or `LocalAttributeGroupServiceInterface` to modify attribute groups.
145145` AttributeGroupServiceInterface::findAttributeGroups() ` get all attribute groups, base on optional query:
146146
147147``` php
148- [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 64, 65 ) =]]
149- [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 85, 90 ) =]]
148+ [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 71, 72 ) =]]
149+ [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 92, 97 ) =]]
150150```
151151
152152To create an attribute group, use ` LocalAttributeGroupServiceinterface::createAttributeGroup `
153153and provide it with an ` AttributeGroupCreateStruct ` :
154154
155155``` php
156- [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 59, 63 ) =]]
156+ [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 66, 70 ) =]]
157157```
158158
159159To get information about product attributes, use the ` AttributeDefinitionServiceInterface ` ,
160160or ` LocalAttributeDefinitionServiceInterface ` to modify attributes.
161161
162162``` php
163- [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 71, 73 ) =]]
163+ [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 78, 80 ) =]]
164164```
165165
166166To create an attribute, use ` LocalAttributeGroupServiceinterface::createAttributeDefinition `
167167and provide it with an ` AttributeDefinitionCreateStruct ` :
168168
169169``` php
170- [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 76, 82 ) =]]
170+ [[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 83, 89 ) =]]
171171```
0 commit comments