Sha256: 0e94df4192d15421c479c1eea57314a1f2e539b02dfa75eb74f3a1993c8cfd45

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

Spree::OrdersController.class_eval do

  def update
    @order = current_order
    unless @order
      flash[:error] = t(:order_not_found)
      redirect_to root_path and return
    end

    if @order.update_attributes(params[:order])
      render :edit and return unless apply_coupon_code

      @order.line_items = @order.line_items.select {|li| li.quantity > 0 }
      @order.restart_checkout_flow
      fire_event('spree.order.contents_changed')
      respond_with(@order) do |format|
        format.html do
          if params.has_key?(:checkout)
            @order.next_transition.run_callbacks if @order.cart?
            redirect_to checkout_state_path(@order.checkout_steps.first)
          else
            redirect_to cart_path
          end
        end
      end
    else
      respond_with(@order)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_promo-1.3.5 app/controllers/spree/orders_controller_decorator.rb