My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 97: discount is duplicated if you enter a free item then a discount promotion
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Aug 2008


 
Reported by rogerpack2005, Jun 11, 2008
What steps will reproduce the problem?
1. on the checkout sequence, enter a working 'free item' code 
2. hit back
3. enter a discount code

What is the expected output? What do you see instead?
should have just the discount code.  instead has it twice

What version of the product are you using? On what operating system?
1.0a2

Please provide any additional information below.

appears that adding reload

    self.promotion_line_item.destroy if self.promotion_line_item
    self.reload # take that promo out

to about line 60 of order.rb fixes it.
Jun 13, 2008
#1 edmundo...@gmail.com
Is a little funny you be able to reproduce that, I saw the code is strange some time
ago but could not make it give me errors.

The problem here is not exactly the reload, but items in a collection are not
supposed to be erased that way. There are methods that rails adds to manipulate items
in a collection when you associate things, its prefered instead of just nuke a
reference. 

This is the right way to do it:

self.order_line_items.delete(self.promotion_line_item) if self.promotion_line_item

Another thing: this line is supposed to be above the "minimum cart value" comparison,
to not include promotions in the total to decide if a promotion should be accepted
(another teoric problem that I could not reproduce).

As I didn't finished the tests for some controllers, at the time I saw that I though
that something in the controller was making it don't give errors, I will try to
reproduce it again to include these patches that I already have.
Jun 14, 2008
#2 edmundo...@gmail.com
Again, I cannot reproduce it using the user interface, using Firefox I'm not allowed
to hit the submit button the second time, after hitted back button. I can only press
it again if I go back changing the url to point to the first step again (checkout).
Using IE6 I can press the button but the previous promotion is discarded.

Im using 1.0.a3 but there was no change in the set_promo_code method from 1.0.a2.
Aug 11, 2008
Project Member #3 subim...@gmail.com
Added in the change edmundo mentioned just to ensure the reference is deleted in the
proper manner. r113
Status: Fixed

Powered by Google Project Hosting