diff --git a/plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb b/plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb index 9e7bf2b..9b2a0fa 100644 --- a/plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb +++ b/plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb @@ -4,8 +4,7 @@ class ShoppingCartPluginMyprofileController < MyProfileController def edit if request.post? begin - profile.shopping_cart = params[:shopping_cart] == '1' ? true : false - profile.save! + profile.update_attributes!(params[:profile_attr]) session[:notice] = _('Option updated successfully.') rescue Exception => exception session[:notice] = _('Option wasn\'t updated successfully.') diff --git a/plugins/shopping_cart/db/migrate/20110513112133_add_shopping_cart_delivery_to_profile.rb b/plugins/shopping_cart/db/migrate/20110513112133_add_shopping_cart_delivery_to_profile.rb new file mode 100644 index 0000000..b123733 --- /dev/null +++ b/plugins/shopping_cart/db/migrate/20110513112133_add_shopping_cart_delivery_to_profile.rb @@ -0,0 +1,12 @@ +class AddShoppingCartDeliveryToProfile < ActiveRecord::Migration + + def self.up + add_column :profiles, :shopping_cart_delivery, :boolean, :default => false + add_column :profiles, :shopping_cart_delivery_price, :decimal, :default => 0 + end + + def self.down + remove_column :profiles, :shopping_cart_delivery + remove_column :profiles, :shopping_cart_delivery_price + end +end diff --git a/plugins/shopping_cart/lib/shopping_cart_plugin/cart_helper.rb b/plugins/shopping_cart/lib/shopping_cart_plugin/cart_helper.rb index 2ece9c7..59a66d4 100644 --- a/plugins/shopping_cart/lib/shopping_cart_plugin/cart_helper.rb +++ b/plugins/shopping_cart/lib/shopping_cart_plugin/cart_helper.rb @@ -15,8 +15,20 @@ module ShoppingCartPlugin::CartHelper float_to_currency_cart(items.map { |id, quantity| sell_price(Product.find(id)) * quantity}.sum, environment) end - def items_table(items, environment, by_mail = false) - '
<%=_('Here are the products you bought:')%>
- <%= items_table(@items, @environment, true) %> + <%= items_table(@items, @supplier, true) %>
--
diff --git a/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb b/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
index 13cb3f8..5464470 100644
--- a/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
+++ b/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
@@ -21,7 +21,7 @@
<%=_('And here are the items bought by this customer:')%>
- <%= items_table(@items, @environment, true) %> + <%= items_table(@items, @supplier, true) %>
--
diff --git a/plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb b/plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb
index a9f124c..687455f 100644
--- a/plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb
+++ b/plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb
@@ -1,8 +1,10 @@