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

[Core][Promotion] Continuation of rules with amount per channel #6906

Conversation

lchrusciel
Copy link
Member

Q A
Bug fix? yes
New feature? yes
BC breaks? yes
Related tickets fixes #6641
License MIT

Continuation of @Zales0123 work from #6895 with Symfony3 support

@michalmarcinkowski
Copy link
Contributor

Rebase needed 😉

@lchrusciel
Copy link
Member Author

@michalmarcinkowski done

@lchrusciel lchrusciel force-pushed the rules-with-amount-per-channel-can-into-master branch from 575a4dd to 6d9f77e Compare November 28, 2016 23:44
@Zales0123
Copy link
Member

Damn it, I was already in the middle of this :/

Copy link
Contributor

@michalmarcinkowski michalmarcinkowski left a comment

Choose a reason for hiding this comment

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

Please apply these comments in a separate PR.

@@ -24,7 +24,7 @@ Feature: Adding a new promotion with rule
Given I want to create a new promotion
When I specify its code as "100_MUGS_PROMOTION"
And I name it "100 Mugs promotion"
And I add the "Total price of items from taxon" rule configured with 100 "Mugs"
And I add the "Total price of items from taxon" rule configured with "Mugs" taxon and €100 amount for "United States" channel
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be $100 instead of €100

/**
* @author Mateusz Zalewski <mateusz.zalewski@lakion.com>
*/
final class BuildChannelAwarePromotionRuleFormSubscriber extends BuildPromotionRuleFormSubscriber
Copy link
Contributor

Choose a reason for hiding this comment

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

ChannelBased

return;
}

if (!$model instanceof ChannelAwareRuleCheckerInterface) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ChannelBased

$resolver
->setDefined(['currency'])
->setAllowedTypes('currency', 'string')
->setDefault('currency', 'USD')
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we shouldn't set USD as default currency.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we have any better idea, what should be added by default? Or should we just skipped this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Skip the default value and make it required.

$this->isConfigurationValid($configuration);
$channelCode = $subject->getChannel()->getCode();
if (!isset($configuration[$channelCode])) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Change method signature and return false 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.

Should I adjust all early returns in this class? If so, should I change a logic of the rest of commands to return false, if nothing happened?

Copy link
Contributor

Choose a reason for hiding this comment

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

We will try to work on that tomorrow, but definitely a separate PR.

@michalmarcinkowski michalmarcinkowski added BC Break PRs introducing BC breaks (do not even try to merge). Bug Fix labels Nov 29, 2016
@lchrusciel lchrusciel changed the title [Core][Promotion] Rules with amount per channel [Core][Promotion] Continuation of rules with amount per channel Nov 29, 2016
@lchrusciel lchrusciel force-pushed the rules-with-amount-per-channel-can-into-master branch 2 times, most recently from d0b5e2c to e965fd4 Compare November 29, 2016 00:29
/**
* {@inheritdoc}
*/
public function getName()
Copy link
Member

Choose a reason for hiding this comment

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

It should be getBlockPrefix - it also causes some errors, as there is no proper widget used to rendering action/rule configuration.

Copy link
Member

Choose a reason for hiding this comment

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

Highly possible it's the only thing that crashes the build right now 😄 🐃

@lchrusciel lchrusciel force-pushed the rules-with-amount-per-channel-can-into-master branch from 621d767 to 4dd4914 Compare November 29, 2016 10:20
@lchrusciel lchrusciel force-pushed the rules-with-amount-per-channel-can-into-master branch from 4dd4914 to 7712774 Compare November 29, 2016 10:29
@michalmarcinkowski michalmarcinkowski merged commit c9e9822 into Sylius:master Nov 29, 2016
@lchrusciel lchrusciel deleted the rules-with-amount-per-channel-can-into-master branch November 29, 2016 11:30
@michalmarcinkowski
Copy link
Contributor

Great! 👍 👍 🎉

pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…channel-can-into-master

[Core][Promotion] Continuation of rules with amount per channel
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…channel-can-into-master

[Core][Promotion] Continuation of rules with amount per channel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Break PRs introducing BC breaks (do not even try to merge).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rounding Issues in Cart
3 participants