app/controllers/plugins/ecommerce/front/checkout_controller.rb in camaleon_ecommerce-2.0.1 vs app/controllers/plugins/ecommerce/front/checkout_controller.rb in camaleon_ecommerce-2.0.2

- old
+ new

@@ -30,21 +30,21 @@ def complete_free_order if @cart.free_cart? errors = ecommerce_verify_cart_errors(@cart) if errors.present? flash[:cama_ecommerce][:error] = errors.join('<br>') - redirect_to :back + redirect_to request.referer else hooks_run('plugin_ecommerce_before_complete_free_order', @cart) @cart.set_meta('free_order', true) commerce_mark_cart_received(@cart) hooks_run('plugin_ecommerce_after_complete_free_order', @cart) redirect_to plugins_ecommerce_orders_path end else flash[:cama_ecommerce][:error] = "Invalid complete payment" - redirect_to :back + redirect_to request.referer end end def cart_index @products = @cart.product_items.decorate @@ -72,11 +72,11 @@ return params[:format] == 'json' ? render(json: flash.discard(:cama_ecommerce).to_hash) : (redirect_to action: :cart_index) end unless product.can_added?(qty, params[:variation_id]) flash[:cama_ecommerce][:error] = t('plugins.ecommerce.messages.not_enough_product_qty', product: product.the_variation_title(params[:variation_id]), qty: product.the_qty(params[:variation_id]), default: 'There is not enough products "%{product}" (Available %{qty})') - return params[:format] == 'json' ? render(json: flash.discard(:cama_ecommerce).to_hash) : (redirect_to :back) + return params[:format] == 'json' ? render(json: flash.discard(:cama_ecommerce).to_hash) : (redirect_to request.referer) end @cart.add_product(product, qty, params[:variation_id]) flash[:cama_ecommerce][:notice] = t('plugins.ecommerce.messages.added_product_in_cart', default: 'Product added into cart') params[:format] == 'json' ? render(json: flash.discard(:cama_ecommerce).to_hash) : (redirect_to action: :cart_index) end @@ -119,11 +119,11 @@ if result[:error].present? flash[:cama_ecommerce][:error] = result[:error] if result[:payment_error] flash[:payment_error] = true end - redirect_to :back + redirect_to request.referer else commerce_mark_cart_received(@cart) redirect_to plugins_ecommerce_orders_url end end @@ -151,10 +151,10 @@ cvc: params[:cvCode], ) if res[:error].present? flash[:cama_ecommerce][:error] = res[:error] flash[:payment_error] = true - redirect_to :back + redirect_to request.referer else commerce_mark_cart_received(@cart) redirect_to plugins_ecommerce_orders_url end end