aniltimt / substruct

Automatically exported from code.google.com/p/substruct
http://code.google.com/p/substruct
6 stars 0 forks source link

PATCH Delete previous promotion before compare minimum cart value #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Checkout adding a percentage rebate.
2. Go back, and checkout using a fixed rebate that needs a minimum cart value.

What is the expected output? What do you see instead?
It should apply the promotion. It doesn't as the cart value is lower
because of the old promotion.

What version of the product are you using? On what operating system?
trunk. Ubuntu 7.10

Original issue reported on code.google.com by edmundo...@gmail.com on 28 Jun 2008 at 6:31

Attachments:

GoogleCodeExporter commented 9 years ago
Seems to be fixed with all of my other changes this evening. Closing.

Original comment by subim...@gmail.com on 11 Aug 2008 at 11:04

GoogleCodeExporter commented 9 years ago
Hrm...so this wasn't fixed with the applied patch? Can you check trunk please?

Original comment by subim...@gmail.com on 15 Aug 2008 at 10:14

GoogleCodeExporter commented 9 years ago
???
This patch desn't seems to have been applied.

In the order model, set_promo_code, instead of:

...
# Make sure it's valid to add
if promo.minimum_cart_value
  return if promo.minimum_cart_value > self.line_items_total
end
logger.info "PROMO MIN CART VALUE PASSED"

# Don't allow more than one promotion?
# This destroys any line items created previously.
self.order_line_items.delete(self.promotion_line_item) if 
self.promotion_line_item
...

do:

...
# Don't allow more than one promotion?
# This destroys any line items created previously.
self.order_line_items.delete(self.promotion_line_item) if 
self.promotion_line_item

# Make sure it's valid to add
if promo.minimum_cart_value
  return if promo.minimum_cart_value > self.line_items_total
end
logger.info "PROMO MIN CART VALUE PASSED"
...

First delete the promotion line item, then make the comparison or it will be 
included
in the sum.

It is still wrong in trunk.

Original comment by edmundo...@gmail.com on 15 Aug 2008 at 1:23

GoogleCodeExporter commented 9 years ago
Aha...makes sense. Fixed in r121

Original comment by subim...@gmail.com on 16 Aug 2008 at 3:08