Commit a505f916f3756e2a528ce010bce910cad28dc9b1
1 parent
181617fe
Exists in
master
and in
29 other branches
Controller and fixes
* Feature: - Controller for cart
Showing
1 changed file
with
18 additions
and
16 deletions
Show diff stats
plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb
@@ -114,9 +114,9 @@ class ShoppingCartPluginProfileController < ProfileController | @@ -114,9 +114,9 @@ class ShoppingCartPluginProfileController < ProfileController | ||
114 | render :text => { | 114 | render :text => { |
115 | :ok => false, | 115 | :ok => false, |
116 | :error => { | 116 | :error => { |
117 | - :code => 1, | ||
118 | - :message => _("Can't join items from different enterprises.") | ||
119 | - } | 117 | + :code => 1, |
118 | + :message => _("Can't join items from different enterprises.") | ||
119 | + } | ||
120 | }.to_json | 120 | }.to_json |
121 | return false | 121 | return false |
122 | end | 122 | end |
@@ -128,9 +128,9 @@ class ShoppingCartPluginProfileController < ProfileController | @@ -128,9 +128,9 @@ class ShoppingCartPluginProfileController < ProfileController | ||
128 | render :text => { | 128 | render :text => { |
129 | :ok => false, | 129 | :ok => false, |
130 | :error => { | 130 | :error => { |
131 | - :code => 2, | ||
132 | - :message => _("There is no cart.") | ||
133 | - } | 131 | + :code => 2, |
132 | + :message => _("There is no cart.") | ||
133 | + } | ||
134 | }.to_json | 134 | }.to_json |
135 | return false | 135 | return false |
136 | end | 136 | end |
@@ -144,9 +144,9 @@ class ShoppingCartPluginProfileController < ProfileController | @@ -144,9 +144,9 @@ class ShoppingCartPluginProfileController < ProfileController | ||
144 | render :text => { | 144 | render :text => { |
145 | :ok => false, | 145 | :ok => false, |
146 | :error => { | 146 | :error => { |
147 | - :code => 3, | ||
148 | - :message => _("This enterprise doesn't have this product.") | ||
149 | - } | 147 | + :code => 3, |
148 | + :message => _("This enterprise doesn't have this product.") | ||
149 | + } | ||
150 | }.to_json | 150 | }.to_json |
151 | return nil | 151 | return nil |
152 | end | 152 | end |
@@ -158,9 +158,9 @@ class ShoppingCartPluginProfileController < ProfileController | @@ -158,9 +158,9 @@ class ShoppingCartPluginProfileController < ProfileController | ||
158 | render :text => { | 158 | render :text => { |
159 | :ok => false, | 159 | :ok => false, |
160 | :error => { | 160 | :error => { |
161 | - :code => 4, | ||
162 | - :message => _("The cart doesn't have this product.") | ||
163 | - } | 161 | + :code => 4, |
162 | + :message => _("The cart doesn't have this product.") | ||
163 | + } | ||
164 | }.to_json | 164 | }.to_json |
165 | return false | 165 | return false |
166 | end | 166 | end |
@@ -172,14 +172,16 @@ class ShoppingCartPluginProfileController < ProfileController | @@ -172,14 +172,16 @@ class ShoppingCartPluginProfileController < ProfileController | ||
172 | render :text => { | 172 | render :text => { |
173 | :ok => false, | 173 | :ok => false, |
174 | :error => { | 174 | :error => { |
175 | - :code => 5, | ||
176 | - :message => _("Invalid quantity.") | ||
177 | - } | 175 | + :code => 5, |
176 | + :message => _("Invalid quantity.") | ||
177 | + } | ||
178 | }.to_json | 178 | }.to_json |
179 | return false | 179 | return false |
180 | end | 180 | end |
181 | true | 181 | true |
182 | end | 182 | end |
183 | 183 | ||
184 | + def get_price(product) | ||
185 | + float_to_currency( product.discount ? product.price_with_discount : product.price ) | ||
186 | + end | ||
184 | end | 187 | end |
185 | - |