狂欢删除帐单邮寄地址

时间:2012-10-21 16:09:11

标签: ruby-on-rails spree

如何在Spree结帐例程中删除结算(或送货)地址?我正在使用spree 1.3

2 个答案:

答案 0 :(得分:7)

您可以通过在checkout_flow将此代码放入您的应用程序中来删除app/models/spree/order_decorator.rb定义中的传送步骤来删除送货地址:

Spree::Order.class_eval do
  checkout_flow do
    go_to_state :address
    go_to_state :payment, :if => lambda { |order| order.payment_required? }
    go_to_state :confirm, :if => lambda { |order| order.confirmation_required? }
    go_to_state :complete
    remove_transition :from => :delivery, :to => :confirm
  end
end

如果没有交货步骤,Spree将不会要求订单的送货地址或送货信息。

答案 1 :(得分:0)

如果您使用的是spree-core

,我还有替代方案

在您的view / spree / checkout / edit文件中,有一个涉及error_messages.html.erb的render语句 = render:partial => 'spree / shared / error_messages',:locals => {:target => @order}

现在,您必须从_error_messages.html.erb中删除“ship”名称,然后它不会显示此类错误。

在spree / shared / _error_message文件中进行以下更改:

-target.errors.full_messages.each do | msg |
-unless(msg.include?(“Ship”))
= msg

请记住,在此处使用循环相应地更改错误计数。 目前我没有使用它,所以发表评论

// = t(:errors_prohibited_this_record_from_being_saved,:count => target.errors.count)

<小时/> 我也在github和stackoverflow上对同一个问题发表了评论 - https://github.com/spree/spree/issues/2571#issuecomment-13769093

https://stackoverflow.com/questions/14891781/how-to-remove-the-shipping-address-validation-in-spree-checkout-process/14957973#comment20997203_14957973