Closed GoogleCodeExporter closed 8 years ago
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
Original comment by RyanSid...@googlemail.com
on 9 Oct 2009 at 4:35
Original comment by subim...@gmail.com
on 4 May 2010 at 7:18
Is this happening with the current 1.1 release? I can't reproduce it on trunk.
Original comment by subim...@gmail.com
on 5 May 2010 at 6:32
Original comment by subim...@gmail.com
on 5 May 2010 at 6:33
Original issue reported on code.google.com by
pramod.b...@gmail.com
on 1 Oct 2009 at 4:06