-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CatalogPromotion] Applying Catalog Promotion with hardcoded rule and action #13002
[CatalogPromotion] Applying Catalog Promotion with hardcoded rule and action #13002
Conversation
src/Sylius/Behat/Resources/config/suites/api/promotion/applying_catalog_promotions.yml
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Resources/config/suites/api/promotion/applying_catalog_promotions.yml
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Applicator/ProductCatalogPromotionApplicatorInterface.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Processor/ProductCatalogPromotionProcessorInterface.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/spec/Applicator/ProductCatalogPromotionApplicatorSpec.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/spec/Processor/DummyProductCatalogPromotionProcessorSpec.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Applicator/ProductCatalogPromotionApplicatorInterface.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Processor/ProductCatalogPromotionProcessorInterface.php
Outdated
Show resolved
Hide resolved
4ed2dd8
to
0d89fa9
Compare
src/Sylius/Bundle/CoreBundle/Processor/DummyProductCatalogPromotionProcessor.php
Outdated
Show resolved
Hide resolved
|
||
interface ProductCatalogPromotionApplicatorInterface | ||
{ | ||
public function applyPercentageDiscount(ProductInterface $product, float $discount): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an interface point of view, this product catalog promotion applicator will be only related with % discounts. What kind of different implementation were you thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that in the future we could also want to lower the price by some fixed amount, not a percentage of it. Then, we would probably have applyFixedDiscount(ProductInterface $product, int $amount): void
function
$this->entityManager = $entityManager; | ||
} | ||
|
||
public function process(CatalogPromotionInterface $catalogPromotion): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more a question to the whole team. When do we want to introduce the logic behind doing this update in chunks for huge catalogs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good and important question, but I believe we could skip it for now. With a proper separation of services, we would be able to make the processing asynchronous/delayed in the places when it needs to be like that 🖖
features/promotion/applying_catalog_promotions/applying_catalog_promotions_for_taxons.feature
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Applicator/ProductCatalogPromotionApplicator.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Applicator/ProductCatalogPromotionApplicatorInterface.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Processor/ProductCatalogPromotionProcessorInterface.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/spec/Applicator/ProductCatalogPromotionApplicatorSpec.php
Outdated
Show resolved
Hide resolved
Thank you, Mateusz! 🥇 |
It's getting serious 💃
This is the first PR proposing an actual application of Catalog Promotions. Pretty dummy one, as it has hardcoded taxon rule and discount amount... But the point of the change, is to start with some simple architecture of services and handle the event thrown in #12990 🖖
I imagine we will be iterating over the proposed solution (especially
ProductCatalogPromotionProcessorInterface
), especially to take into account upcoming real Catalog Promotion rules and actions 🚀