My favorites
▼
|
Sign in
substruct
Open-source Ruby on Rails E-Commerce
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
102
attachment: delete_previous_promotion_properly.patch
(1.1 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Index: /home/edmundo/workspace_aptana/trunk/vendor/plugins/substruct/app/models/order.rb
===================================================================
--- /home/edmundo/workspace_aptana/trunk/vendor/plugins/substruct/app/models/order.rb (revision 78)
+++ /home/edmundo/workspace_aptana/trunk/vendor/plugins/substruct/app/models/order.rb (working copy)
@@ -50,16 +50,16 @@
# Make sure it's valid to add
if promo.minimum_cart_value
return if promo.minimum_cart_value > self.total
end
logger.info "PROMO MIN CART VALUE PASSED"
- # Don't allow more than one promotion?
- # This destroys any line items created previously.
- self.promotion_line_item.destroy if self.promotion_line_item
+ # Delete the last line item representing a promotion if any.
+ # We allow only one promotion to be applied.
+ self.order_line_items.delete(self.promotion_line_item) if self.promotion_line_item
- # Assign proper promotion ID
- self.promotion_id = promo.id
+ # Associate the order with the promotion.
+ self.promotion = promo
# Add any line items necessary from promotion.
oli = OrderLineItem.new
Powered by
Google Project Hosting