caboose-cms 0.5.130 → 0.5.131
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/cart.js +2 -2
- data/app/controllers/caboose/cart_controller.rb +3 -3
- data/app/models/caboose/discount.rb +5 -1
- data/app/models/caboose/order.rb +1 -0
- data/app/models/caboose/schema.rb +3 -0
- data/app/models/caboose/variant.rb +3 -5
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjNiOTM0OWM1OWM3N2NjYTFhMTE2Zjc3NTM2ZGIwYzJlYmNlMDhmNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTU1YjI5YTBkZGQ2NGNhZjhiOWQ2ZGM2MThmNjMzNjZmZTBlNjRiOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjM2N2YzZGU1Nzk5N2RkMGI4Mzc3MzNhNDY4NWYzN2I5NzlkMDViNWFjZGQ3
|
10
|
+
N2RhYTAzNTM5ZjM3NjZlNDg0MDVjODdkZTgzYWFjMzE5MjgyYThjMTFiNDRi
|
11
|
+
MjIzODBkZjM1YzVmZTY0YjNmMjBiNTJmYzBlNmJmZDQ5MjQwMjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Yzg2NmMwOTI2MTFiYmZjMjdhNWRhZDcwMzNmYjk3YmMxYzhkYjJjYjI3MzY3
|
14
|
+
NTFkNmZhMmY5Mzk4MGY3NTIzMDcyOGJlZWQ1YzJmOGMyZTlkNTYyZjk3Yzlk
|
15
|
+
OTUwYjcxYmZhMmVkMjE1MjE3NDAwODdhNjU2YmY4NjBhZjljYzM=
|
@@ -101,12 +101,12 @@ Cart.prototype = {
|
|
101
101
|
|
102
102
|
tbody.append($('<tr/>')
|
103
103
|
.append(gctd)
|
104
|
-
.append($('<td/>').css('text-align', 'right').html('
|
104
|
+
.append($('<td/>').css('text-align', 'right').html('-$' + parseFloat(d.amount).toFixed(2)))
|
105
105
|
);
|
106
106
|
});
|
107
107
|
if (that.order.custom_discount && that.order.custom_discount > 0)
|
108
108
|
{
|
109
|
-
tbody.append($('<tr/>')
|
109
|
+
tbody.append($('<tr/>')
|
110
110
|
.append($('<td/>').css('text-align', 'right').attr('colspan', 4).html('Discount'))
|
111
111
|
.append($('<td/>').css('text-align', 'right').html('$' + parseFloat(that.order.custom_discount).toFixed(2)))
|
112
112
|
);
|
@@ -86,7 +86,7 @@ module Caboose
|
|
86
86
|
resp = StdClass.new
|
87
87
|
code = params[:code].strip
|
88
88
|
gc = GiftCard.where("lower(code) = ?", code.downcase).first
|
89
|
-
|
89
|
+
|
90
90
|
if gc.nil? then resp.error = "Invalid gift card code."
|
91
91
|
elsif gc.status != GiftCard::STATUS_ACTIVE then resp.error = "That gift card is not active."
|
92
92
|
elsif gc.date_available && DateTime.now.utc < self.date_available then resp.error = "That gift card is not active yet."
|
@@ -96,9 +96,9 @@ module Caboose
|
|
96
96
|
elsif Discount.where(:order_id => @order.id, :gift_card_id => gc.id).exists? then resp.error = "That gift card has already been applied to this order."
|
97
97
|
else
|
98
98
|
# Determine how much the discount will be
|
99
|
-
d = Discount.new(:order_id => @order.id, :gift_card_id => gc.id, :amount => 0.0)
|
99
|
+
d = Discount.new(:order_id => @order.id, :gift_card_id => gc.id, :amount => 0.0)
|
100
100
|
case gc.card_type
|
101
|
-
when GiftCard::CARD_TYPE_AMOUNT then d.amount = (@order.total
|
101
|
+
when GiftCard::CARD_TYPE_AMOUNT then d.amount = (@order.total >= gc.balance ? gc.balance : @order.total)
|
102
102
|
when GiftCard::CARD_TYPE_PERCENTAGE then d.amount = @order.subtotal * gc.total
|
103
103
|
when GiftCard::CARD_TYPE_NO_SHIPPING then d.amount = @order.shipping
|
104
104
|
when GiftCard::CARD_TYPE_NO_TAX then d.amount = @order.tax
|
data/app/models/caboose/order.rb
CHANGED
@@ -39,11 +39,9 @@ module Caboose
|
|
39
39
|
:cylinder,
|
40
40
|
:shipping_unit_value
|
41
41
|
|
42
|
-
after_initialize
|
43
|
-
|
44
|
-
|
45
|
-
self.price = 0.00 if self.price.nil?
|
46
|
-
self.sale_price = 0.00 if self.sale_price.nil?
|
42
|
+
after_initialize do |v|
|
43
|
+
v.price = 0.00 if v.price.nil?
|
44
|
+
v.sale_price = 0.00 if v.sale_price.nil?
|
47
45
|
end
|
48
46
|
|
49
47
|
#
|
data/lib/caboose/version.rb
CHANGED