Where is the code that initially creates an Order with OrderItems from an existing Cart

9 views
Skip to first unread message

Stanislav Mihaylov

unread,
Dec 6, 2012, 11:13:31 AM12/6/12
to satchm...@googlegroups.com
Hi there,
I have the following problem:
I have totally altered the way unit_price and line_total are calculated for a given CartItem according to the needs of my website. So each CartItem on creation is stored in the database with the right unit_price and line_total values.
The problem is when it comes to checkout, the OrderItems, corresponding to these CartItems have completely different prices, which probably are recalculated, based on product prices, disregarding the CartItem prices.

My question is where exactly is the code that initializes an Order from a Cart and all OrderItems from CartItems ?
Where is the code that sets the OrderItem prices?
I found in shop.models.Order the method 'force_recalculate_total', but it seems to operate with already existing OrderItems and their prices.
Another method in payment.utils.py -> 'update_orderitems' seems to operate with the right prices (from the CartItems), but I have no idea where it is called. Probably that is not the one that initiates the prices, otherwise they wouldn't be wrong.

I need to find a way to set the OrderItem prices to be the same as CartItem prices.

Thank you in advance for your knowledge and assistance!

Reply all
Reply to author
Forward
0 new messages