Commit a505f916f3756e2a528ce010bce910cad28dc9b1

Authored by Rodrigo Souto
1 parent 181617fe

Controller and fixes

* Feature:
    - Controller for cart
plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb
... ... @@ -114,9 +114,9 @@ class ShoppingCartPluginProfileController < ProfileController
114 114 render :text => {
115 115 :ok => false,
116 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 120 }.to_json
121 121 return false
122 122 end
... ... @@ -128,9 +128,9 @@ class ShoppingCartPluginProfileController < ProfileController
128 128 render :text => {
129 129 :ok => false,
130 130 :error => {
131   - :code => 2,
132   - :message => _("There is no cart.")
133   - }
  131 + :code => 2,
  132 + :message => _("There is no cart.")
  133 + }
134 134 }.to_json
135 135 return false
136 136 end
... ... @@ -144,9 +144,9 @@ class ShoppingCartPluginProfileController < ProfileController
144 144 render :text => {
145 145 :ok => false,
146 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 150 }.to_json
151 151 return nil
152 152 end
... ... @@ -158,9 +158,9 @@ class ShoppingCartPluginProfileController < ProfileController
158 158 render :text => {
159 159 :ok => false,
160 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 164 }.to_json
165 165 return false
166 166 end
... ... @@ -172,14 +172,16 @@ class ShoppingCartPluginProfileController < ProfileController
172 172 render :text => {
173 173 :ok => false,
174 174 :error => {
175   - :code => 5,
176   - :message => _("Invalid quantity.")
177   - }
  175 + :code => 5,
  176 + :message => _("Invalid quantity.")
  177 + }
178 178 }.to_json
179 179 return false
180 180 end
181 181 true
182 182 end
183 183  
  184 + def get_price(product)
  185 + float_to_currency( product.discount ? product.price_with_discount : product.price )
  186 + end
184 187 end
185   -
... ...