views:

120

answers:

0

I need a checkout process devoid of a delivery and payment step (working on a store which accept cash on delivery so I need only the address step.) I am using Spree 0.10.2

Things I have tried: In the site_extension.rb added the following state machine

Checkout.state_machines[:state] = StateMachine::Machine.new(Checkout, :initial => 'address') do 
      after_transition :to => 'complete', :do => :complete_order 
      before_transition :to => 'complete', :do => :process_payment 
      event :next do 
        transition :to => 'complete', :from => 'address' 
      end 
    end 

The unwanted steps are removed (at least visually) but when I submit the address it throws up the following error.

IndexError in CheckoutsController#update "payment" is an invalid name

Looking at the trace and couple of similar errors later, I decide to blindly override two methods from checkouts_controller.rb in site_extension.rb to do nothing (since they deal with payment I presume)

 def clear_payments_if_in_payment_state 
 end

 def object_params 
 end

Doing this throws validation errors on all the fields of delivery and billing address. I vaguely have a notion that I need to override a couple of methods from checkouts_controller.rb. If this notion is right then what are those methods.