简体   繁体   English

狂欢删除帐单邮寄地址

[英]Spree remove billing address

How would I remove billing (or shipping) address in Spree checkout routine? 如何在Spree结帐例程中删除结算(或送货)地址? I'm using spree 1.3 我正在使用spree 1.3

You can remove the shipping address by removing the delivery step from your checkout_flow definition by putting this code inside your application at app/models/spree/order_decorator.rb : 您可以通过在app/models/spree/order_decorator.rb将此代码放入应用程序中来删除checkout_flow定义中的交付步骤来删除送货地址:

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

By not having the delivery step there, Spree won't ask for a delivery address or delivery information for an order. 如果没有交货步骤,Spree将不会要求订单的送货地址或送货信息。

I have an alternate for this, if you are using spree-core 如果你使用的是spree-core,我有一个替代品

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

So now, you have to remove "ship" name from _error_messages.html.erb, then It will not show this kind of error. 所以现在,您必须从_error_messages.html.erb中删除“ship”名称,然后它不会显示此类错误。

Make some following changes in your spree/shared/_error_message file: 在spree / shared / _error_message文件中进行以下更改:

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

Remember, make changes also in error count accordingly using loop here. 请记住,在此处使用循环相应地更改错误计数。 Currently I have no use of it, so made it comment 目前我没有使用它,所以发表评论

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


I have also made comment on same question on github and stackoverflow- https://github.com/spree/spree/issues/2571#issuecomment-13769093 我也在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 https://stackoverflow.com/questions/14891781/how-to-remove-the-shipping-address-validation-in-spree-checkout-process/14957973#comment20997203_14957973

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM