Sha256: 39efc607031a41c6afc761effbfd5a2d030a808fa4166a1ffa962eca1ec24c1a

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 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 }
      fire_event('spree.order.contents_changed')
      respond_with(@order) do |format|
        format.html do
          if params.has_key?(:checkout)
            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.3 app/controllers/spree/orders_controller_decorator.rb