sonsandco / django-shoptools

Another django ecommerce library. In progress
Other
3 stars 2 forks source link

Separate order_lines macros for Orders and Carts #9

Open pbright opened 7 years ago

pbright commented 7 years ago

Currently relies on line.item, which breaks for an Order if the item is subsequently deleted (and currently for carts #2 ), or if the items details are subsequently changed (eg. price goes up or down).

Need a separate version for Order which gets the details directly from the OrderLine.

gregplaysguitar commented 7 years ago

I think the default template should just use OrdeLine.description and not line.item anyway so I don't think we need two separate macros. It could use line.item for the url but if it's not there it just wouldn't be a link.

pbright commented 7 years ago

Yeah description is fine.

There's other references to line.item in the macro currently, most of which can simply be removed if line.item doesn't exist.

I think the only troublesome one is line.item.price. Currently we only store the line total, and if you want to display the price per item line.total / line.quantity may not be accurate if, for example, the line has options that have a cost associated with them.

So perhaps we just need to save the cost per item as well as the line total?

gregplaysguitar commented 7 years ago

So perhaps we just need to save the cost per item as well as the line total?

Could do this, but I'd be happy to just conditionally display the price if the item exists. If it goes away we still have the total which is the main thing. I think the vast majority of order lines are going to have quantity=1 anyway?

pbright commented 7 years ago

Sounds reasonable, but I can foresee a situation where a client needs to generate an invoice for an old order for some reason but they've deleted a product and the line has options. I appreciate that's a very corner case and I expect we would be able to recreate it for them anyway, but it would be nice if it was all there just in case.

I'm happy to do the coding if you don't have any concerns beyond development time.

gregplaysguitar commented 7 years ago

but they've deleted a product and the line has options.

Hmm, options are already saved, so this shouldn't be an issue should it? Are we talking about the same thing?