on 2022 Jun 27 12:00 AM
Hello Experts
We want to activate the discounts of the promotions module.
but we have encountered a problem:
When we use the condition subject to promotion:
We can add materials or product SKUs (variants) that will be subject to promotion, but the process is one by one.
Is it possible to upload products in bulk?
We also have Generic products and Variant Products, we see that the system only allows variant products.
I would understand that it is because in the frontend only the variant materials are displayed.
In summary, I would like to be able to add a large list of products in bulk and not one by one.
Best regards
Elio C.
Request clarification before answering.
There is not an easy way of doing this, but I suggest you to create a category to group the products in promotion and put that category into qualifying category condition. However, it's not possible to add GenericVariantProduct to such category since there is a ValidationInterceptor for GenericVariantProduct which controls the categories of the product.
Another option (without any implementation) would be to add products with ImpEx. The condition of the promotions are held in JSON format, so you can easily manipulate this and achieve what you want. For example, in the following there is a JSON for conditions field of a promotion with coupon and qualifying products with 2 product code defined.
[{"definitionId":"y_qualifying_coupons","parameters":{"coupons":{"uuid":"e3288128-09d2-40ff-b3b5-66498c903e1ba","type":"List(ItemType(AbstractCoupon))","value":["WINTER16"]}},"children":[]},{"definitionId":"y_qualifying_products","parameters":{"products_operator":{"uuid":"797e0260-a096-4624-98b8-f2c0362ea581","type":"Enum(de.hybris.platform.ruledefinitions.CollectionOperator)","value":"CONTAINS_ANY"},"quantity":{"uuid":"96bbbfd7-6654-445c-9e37-21f97c62c429","type":"java.lang.Integer","value":1},"catalog":{"uuid":"94c51e30-792e-4d65-afaa-ad450ea6de9e","type":"ItemType(Catalog)"},"operator":{"uuid":"f6ca2bcf-719c-4bd9-8acf-5026ece2ea42","type":"Enum(de.hybris.platform.ruledefinitions.AmountOperator)","value":"GREATER_THAN_OR_EQUAL"},"products":{"uuid":"041cac09-5c2c-4beb-8f4a-3e5aff51d40c","type":"List(ItemType(Product))","value":["30404::apparelProductCatalog","300020294::apparelProductCatalog"]}},"children":[]}]
You can modify the value field of y_qualifying_products condition and import this with the following ImpEx
UPDATE PromotionSourceRule;code[unique=true];conditions;status(code)[unique=true,default=UNPUBLISHED]
;coupon_code_percentage_discount;[{"definitionId":"y_qualifying_coupons","parameters":{"coupons":{"uuid":"e3288128-09d2-40ff-b3b5-66498c903e1ba","type":"List(ItemType(AbstractCoupon))","value":["WINTER16"]}},"children":[]},{"definitionId":"y_qualifying_products","parameters":{"products_operator":{"uuid":"797e0260-a096-4624-98b8-f2c0362ea581","type":"Enum(de.hybris.platform.ruledefinitions.CollectionOperator)","value":"CONTAINS_ANY"},"quantity":{"uuid":"96bbbfd7-6654-445c-9e37-21f97c62c429","type":"java.lang.Integer","value":1},"catalog":{"uuid":"94c51e30-792e-4d65-afaa-ad450ea6de9e","type":"ItemType(Catalog)"},"operator":{"uuid":"f6ca2bcf-719c-4bd9-8acf-5026ece2ea42","type":"Enum(de.hybris.platform.ruledefinitions.AmountOperator)","value":"GREATER_THAN_OR_EQUAL"},"products":{"uuid":"041cac09-5c2c-4beb-8f4a-3e5aff51d40c","type":"List(ItemType(Product))","value":["30404::apparelProductCatalog","300020294::apparelProductCatalog","300020465::apparelProductCatalog","300022352::apparelProductCatalog"]}},"children":[]}]
Notice that value field was "value":["30404::apparelProductCatalog","300020294::apparelProductCatalog"] and updated as "value":["30404::apparelProductCatalog","300020294::apparelProductCatalog","300020465::apparelProductCatalog","300022352::apparelProductCatalog"] with ImpEx.
You need to be careful to not break the JSON when using this method. And adding too much products might cause performance issues on promotion engine (both in applying on calculations and displaying / modifying from backoffice).
My suggestion would be to implement a some feature to group products in a promotion and create a promotion condition for this grouping feature.
You can use qualifying categories condition if you do not want to create a custom condition. You can group products with something named promotion categories (many-to-many relation between product and category, but will not be validated against GenericVariantProduct interceptor) and define this category in promotion condition. But still, you need to populate promotion categories of the product in related RAOs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.