-
-
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
Price calculators #1197
Price calculators #1197
Conversation
@@ -24,7 +24,7 @@ | |||
* A form resize listener capable of coping with a zone member collection. | |||
* | |||
* @author Tim Nagel <t.nagel@infinite.net.au> | |||
* @author Саша Стаменковић <umpirsky@gmail.com> | |||
* @author Saša Stamenković <umpirsky@gmail.com> |
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.
Old one was nice as well ;)
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 was better :)
But you display wrong price in frontend? |
@winzou Ah, true. Missed that :) Will fix, thanks. |
Cool stuff 👍 |
use Sylius\Bundle\CoreBundle\Model\VariantInterface; | ||
|
||
/** | ||
* By default calculator returns variant price. |
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.
Default calculator simply returns the variant price.
I would totally separate the formatting from the calculation. Like this: |
Agree with @winzou on function style. Maybe And beside variant, should we accept |
TBH. it's kinda confusing for me where to put this code. IMO it's not totally correct to have it in the CoreBundle, while all prices are being calculated by MoneyBundle... I'm confused. Anyway, we can't depend on |
@stloyd Where does MoneyBundle calculate price? I thought MoneyBundle was just doing currency exchange. If we put PriceCalculator to MoneyBundle, that would make MoneyBundle depends on Variant wouldn't it? |
PricingBundle. Would be cool to put it there... I'll put your implementation on steroids later. (add optional configuration to pricing calculators) What do you think? |
And I'd go with |
@pjedrzejewski I would say that bundle is overkill, component sound ok but bundle is overkill ;) But totally agree about that interface, I was thinking about same thing, but placed in ProductBundle, or in MoneyBundle, but prefer the first one |
IMHO, it definitely should be a separate bundle. In @umpirsky implementation it is quite thin, but for sure it will contain much more and can be used separately from Product bundle. Why would you couple the pricing stuff only to Product bundle? |
@winzou I agree about @pjedrzejewski I agree about |
@umpirsky Deal! 👍 |
@pjedrzejewski Ready for merging. Just waiting for Travis. |
@pjedrzejewski Can you merge it please? |
Thanks Sasha! The build was failing previously. Nice work! 👍 |
Fixes issue #1120.
This will allow us to have custom price calculators. For example, we have something like this in our project.