app/controllers/spree/admin/zoned_controller.rb in spree_zoned-0.5.23 vs app/controllers/spree/admin/zoned_controller.rb in spree_zoned-0.5.24
- old
+ new
@@ -14,10 +14,12 @@
def reorder
country = session[:zoned] && session[:zoned][:prd_country]
return if !country || country.to_i >= 0
country = country.to_i
params[:positions].each do |id, index|
- Spree::Zoned::Product.find_or_create_by_spree_product_id_and_spree_country_id(id, country).update_attributes :orderno => index.to_i
+ zp = Spree::Zoned::Product.find_or_create_by_spree_product_id_and_spree_country_id(id, country)
+ zp.orderno = index.to_i unless !zp.orderno.nil? && zp.orderno < 0
+ zp.save
end
respond_to do |format|
format.html { redirect_to admin_products_url }
format.js { render :text => 'Ok' }
end