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 186: Promotion Bug
1 person starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  subim...@gmail.com
Closed:  May 2010


 
Reported by pramod.b...@gmail.com, Sep 30, 2009
What steps will reproduce the problem?
1. Add a promotion. I added $10 off
2. Apply promo during checkout, and submit. It takes us to shipping page.
3. At this stage, if you click on Continue Shopping and try looking at the
cart, it throws an exception saying item_id is null.


What is the expected output? What do you see instead?
Clicking on cart is expected to show the items in it. Instead it throws
an exception saying accessing "nil".images in /store/show_cart.rhtml.

What version of the product are you using? On what operating system?
OS : Linux 2.6.27-grsec2
App : substruct_rel_1-0-a6

Please provide any additional information below.
Earlier I was not able to use the promotion at all. After some searching, I
found that the issue was fixed at
https://code.google.com/p/substruct/issues/detail?id=140. After applying the
patch, the show cart test failed.

Oct 9, 2009
#1 RyanSid...@googlemail.com
The problem is that the promo code appears to be saved as a cart item and a promotion
doesnt have an "item_id". This only happens if your using the inventory mode switch on.

Here is what you need to modify in the code...

#model/orders.rb 

def check_inventory
	  removed_items = []
    # Promotion codes are stored as order_line_items with a item_id of NULL
    # Need to pick out the items that have an item code first.
    order_items = self.order_line_items.find(:all, :conditions => ['item_id > ?', '0'])
	  order_items.each do |oli|
	    # Find the item in the db, because oli.item is cached.
	    db_item = Item.find(oli.item_id)
	    if oli.quantity > db_item.quantity
	      removed_items << oli.name.clone
	      self.order_items.delete(oli)
      end
    end
    return removed_items

May 4, 2010
Project Member #2 subim...@gmail.com
(No comment was entered for this change.)
Owner: subimage
Labels: -Priority-Medium Priority-High
May 4, 2010
Project Member #3 subim...@gmail.com
Is this happening with the current 1.1 release? I can't reproduce it on trunk.
May 4, 2010
Project Member #4 subim...@gmail.com
(No comment was entered for this change.)
Status: Invalid

Powered by Google Project Hosting