Create product/variants when calculating a price for a delivery #4169
Replies: 5 comments
-
can you explain this more @alexsegura ? |
Beta Was this translation helpful? Give feedback.
-
@Paul-Eraman-CoopCycle can you (i) explain where this information should be shown to
|
Beta Was this translation helpful? Give feedback.
-
Work has been started in the pricing-rule-visitor branch |
Beta Was this translation helpful? Give feedback.
-
what would it look like to use products instead of variants? |
Beta Was this translation helpful? Give feedback.
-
We could call this:
and make 1 the backup option if the cooperative has not made a description |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The goal here is to improve a little bit the understanding of how the price was calculated.
Currently, when we calculate the price for a delivery, the resulting order only contains ONE item, pointing to a variant of the "On Demand Delivery" product (it is created by the setup command). This variant is named "Delivery 3km" (for example).
So, we lose track of which rules were matched, we only have the resulting price.
To improve this, we will create a variant for each matched rule, with a human readable name (depending on the rules, it may be a long name, but at least it will be understandable).
Some code needs to be refactored to implement this.
DeliveyManager::getPrice
method will need to be deprecated, in favor of another method that implements a sort of "visitor" pattern, to return a structure with the matched rules, and the corresponding price, instead of an integer.OrderFactory::createForDelivery
Beta Was this translation helpful? Give feedback.
All reactions