CartBundle Pricing Provider & dynamic pricing values

26 views
Skip to first unread message

Daniel Kucharski

unread,
Mar 5, 2012, 3:18:43 PM3/5/12
to vespolina-dev
Hi,

For your info, the cart bundle master has been refactored in such a
way that all pricing logic previously part of the cart / cart item
model has been moved into a dedicated pricing provider class. A
Simple pricing provider class is bundled with the cartbundle
containing basic cart handling:
https://github.com/vespolina/VespolinaCartBundle/blob/master/Pricing/SimpleCartPricingProvider.php
. The cart bundle works with both ODM and ORM.


In addition the cart item & cart have a field "prices" which now
stores all prices (eg. "totalPrice", "unitPrice", ...). Depending on
your own use case you might want to add other pricing fields at
runtime.
You can use $cart->getPrice('totalPrice') to get a particular pricing
value at cart level, the same concept exists at cart item level.

You can specify your own pricing provider using following
configuration:

vespolina_cart:
pricing_provider:
class: YourAwesomePricingProviderClass


It's also possible to disable pricing. This means that no pricing
calculation will ever happen. To do that, you specify:

vespolina_cart:
pricing_provider:
enabled: false

Recalculating pricing at both cart & cart item level is done by
calling determinePrices method of the cart manager.

$cartManager->determinePrices($aCart);
Reply all
Reply to author
Forward
0 new messages