app/controllers/shop_controller.rb
# the checkout page creates an order upon completion. So before a checkout the basket is attached to the session
# and by filling out all data an order is created with the basket and the session zeroed
the checkout page creates an order upon completion. So before a checkout the basket is attached to the session
and by filling out all data an order is created with the basket and the session zeroed
the checkout page creates an order upon completion . So before a checkout the basket is attached to the session and by filling out all data an order is created with the basket and the session zeroed
def checkout
    basket = current_basket
    if(basket.kori )
      @order = basket.kori
    else
      @order = Order.new :ordered_on => Date.today
      @order.basket = basket
    end
    if(request.post?)
      order_ps = params.require(:order).permit( :email,:name , :street , :city , :phone , :shipment_type )
      @order.assign_attributes(order_ps)
      if (!params[:validation].blank?) and @order.save
        return process_order 
      else
        flash.now.notice = I18n.t(:must_accept) if params[:validation].blank?
      end
    else
      @order.email = current_clerk.email if current_clerk
      @order.shipment_type = "post" 
    end
  end
def checkout basket = current_basket if ( basket . kori ) @order = basket . kori else @order = Order . new :ordered_on => Date . today @order . basket = basket end if ( request . post? ) order_ps = params . require ( :order ) . permit ( :email , :name , :street , :city , :phone , :shipment_type ) @order . assign_attributes ( order_ps ) if ( ! params [ :validation ] . blank? ) and @order . save return process_order else flash . now . notice = I18n . t ( :must_accept ) if params [ :validation ] . blank? end else @order . email = current_clerk . email if current_clerk @order . shipment_type = "post" end end
the checkout page creates an order upon completion.
the checkout page creates an order upon completion .
#always redirects # price is 0 automatically