Skip to content
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

[CatalogPromotions] Inform about promotions applied on variants #13035

Conversation

Zales0123
Copy link
Member

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets
License MIT

We need to keep the information about applied catalog promotions on each ChannelPricing. I propose to start simple, with an array of arrays 💃 to make it happen sooner than later. If we decide in the future we need some more sophisticated structure - we can always change it 🚀

@Zales0123 Zales0123 added the Feature New feature proposals. label Aug 31, 2021
@Zales0123 Zales0123 requested a review from a team as a code owner August 31, 2021 11:43
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Aug 31, 2021
@@ -30,6 +30,9 @@ class ChannelPricing implements ChannelPricingInterface
/** @var int|null */
protected $originalPrice;

/** @var array */
protected $appliedPromotions = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to change right now, but just a question for the future - do we plan to have object references here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know yet - we will see what needs we will have when the feature would be growing. But I do not rule it out 🖖

/** @var string $code */
$code = $catalogPromotion->getCode();

return [$code => ['name' => $label]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are saving only one label in one translation, there will be no possibility to translate this label on variants 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Probably we should save the label in each locale - it makes this data structure a little bit more complicated, but benefits are undeniable. I would provide is as an improvement in the separate PR, wdyt?

@Zales0123 Zales0123 force-pushed the inform-about-applied-catalog-promotion-on-variants-list branch from 802246c to f59b034 Compare September 1, 2021 08:40
@GSadee GSadee merged commit 76ba101 into Sylius:master Sep 1, 2021
@GSadee
Copy link
Member

GSadee commented Sep 1, 2021

Thank you, Mateusz! 🎉

@Zales0123 Zales0123 deleted the inform-about-applied-catalog-promotion-on-variants-list branch September 1, 2021 10:35
SirDomin added a commit that referenced this pull request Sep 7, 2021
… on variant` (arti0090)

This PR was merged into the 1.11-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master 
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| License         | MIT

Scenario that will extend #13035

Commits
-------

f4585fd [CP] Add scenario for variant
GSadee added a commit that referenced this pull request Sep 13, 2021
… promotions (arti0090)

This PR was merged into the 1.11-dev branch.

Discussion
----------

Missing part of #13035 Pull request

Commits
-------

f481fcc Add missing description to applied promotions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Feature New feature proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants