From a505f916f3756e2a528ce010bce910cad28dc9b1 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Sat, 23 Apr 2011 02:15:57 -0300 Subject: [PATCH] Controller and fixes --- plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb b/plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb index e948347..00a5f21 100644 --- a/plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb +++ b/plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb @@ -114,9 +114,9 @@ class ShoppingCartPluginProfileController < ProfileController render :text => { :ok => false, :error => { - :code => 1, - :message => _("Can't join items from different enterprises.") - } + :code => 1, + :message => _("Can't join items from different enterprises.") + } }.to_json return false end @@ -128,9 +128,9 @@ class ShoppingCartPluginProfileController < ProfileController render :text => { :ok => false, :error => { - :code => 2, - :message => _("There is no cart.") - } + :code => 2, + :message => _("There is no cart.") + } }.to_json return false end @@ -144,9 +144,9 @@ class ShoppingCartPluginProfileController < ProfileController render :text => { :ok => false, :error => { - :code => 3, - :message => _("This enterprise doesn't have this product.") - } + :code => 3, + :message => _("This enterprise doesn't have this product.") + } }.to_json return nil end @@ -158,9 +158,9 @@ class ShoppingCartPluginProfileController < ProfileController render :text => { :ok => false, :error => { - :code => 4, - :message => _("The cart doesn't have this product.") - } + :code => 4, + :message => _("The cart doesn't have this product.") + } }.to_json return false end @@ -172,14 +172,16 @@ class ShoppingCartPluginProfileController < ProfileController render :text => { :ok => false, :error => { - :code => 5, - :message => _("Invalid quantity.") - } + :code => 5, + :message => _("Invalid quantity.") + } }.to_json return false end true end + def get_price(product) + float_to_currency( product.discount ? product.price_with_discount : product.price ) + end end - -- libgit2 0.21.2