spree-contrib / spree-multi-domain

Multiple Spree stores on different domains - single unified backed for processing orders
https://guides.spreecommerce.org
194 stars 191 forks source link

product options / taxons not updated if more than 1 #148

Open blset opened 8 years ago

blset commented 8 years ago

Hello

In the backoffice, with lastest spree-0b99e882892b 3.1 and spree-multi-domain-5017b56aee41

a product is not updated correctly from the back office if more than one entry in the taxons or options field

after some research, it looks like Spree::Admin::ProductsController#update is never visited, because of the decorator products_controller_decorator.rb


  def update
    store_ids = params[:product][:store_ids]
    if store_ids.present?
      params[:product][:store_ids] = store_ids.split(',')
    end
    super
  end

in fact the super calls Spree::Admin::ResourcesController (because of super) and not Spree::Admin::ProductsController#update

for that reason the necessary code below is never visited

if params[:product][:taxon_ids].present?
          params[:product][:taxon_ids] = params[:product][:taxon_ids].split(',')
        end
        if params[:product][:option_type_ids].present?
          params[:product][:option_type_ids] = params[:product][:option_type_ids].split(',')
        end

thanks