Hi,

I am currently developing a promotion/voucher/discount system too.

First, I have to calculate this in the shopping cart and not in the
order.
Even if the shopping cart is a reflect of a future order, for me they
are distinct.
I have many parameters in the shopping cart too like the delivery day,
etc.. that the order will just copy.

I have
$order->createFromShoppingCart( $shopping_cart );


So for the promotion,
the PromotionTable has a method findDiscounts(ShoppingCart,
sfGuardUser)

the shopping cart store the discounts and calculate. The order just
copy the discounts and the amount of discount.

Hope it helps !


On Mar 30, 1:56 pm, Tom Haskins-Vaughan <t...@templestreetmedia.com>
wrote:
> (sf1.4/Doctrine)
>
> Hi all,
>
> Let's say I'm developing an ecommerce solution. I have the following models:
>
> Order - takes a shopping cart all the way through to an actual order.
>
> OrderItem - link between the Order and one or more Products
>
> Product - a catalogue of products
>
> Promotion - e.g., buy one get one free, or 10% off item, buy these
> both for $10, etc
>
> The part I'm interested in is the promotions. I *could* do the logic
> in the Order model like so:
>
> $order = new Order();
> ...
> $order->applyPromotion($promotion);
>
> But there is likely to be quite a lot of logic, depending on what kind
> of promotion it is (adding OrderItems, discounting Orders, etc), so my
> instinct was to create a PromotionManager class so for example:
>
> $promoManager = new PromotionManager();
> $promoManager->appyPromotion($promotion, $order);
>
> Is this a better way to go, or am I causing myself needless abstraction?
>
> I know there's more than one way to skin a cat, but I'm trying hard to
> get to grips with the best way.
>
> Anyway, thanks in advance.
>
> Tom

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to