在magento中的Mage_Tax_Model_Calculation::getRate中获取客户
我已经覆盖了 Mage_Tax_model_Calculation::getRate
,因此我不想对某些客户征税。我没有为他们设立特殊的客户类别。
我的客户模型中有一个自定义字段,我想在加载客户模型后检查该字段,如果该字段有值,我不会向他征税,否则我会调用 parent::getRate($request )
是否可以在函数中得到它。
I have overwritten the Mage_Tax_model_Calculation::getRate
, so that I want to not tax certain customers. I do not have a special customer class for them.
I have a custom field in my customer model, which I want to check after I am able to load my customer model and if this field has a value I do not tax him, otherwise I call parent::getRate($request)
Is it possible to get that in the function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试这样的事情:
希望有帮助!
谢谢,
乔
编辑:好点;)
查看 adminhtml 代码,它似乎远不如普通客户代码有用。我希望能够致电 Mage::register 但没有发生。我找到了一个可能的解决方案,尽管在 Magento 中加载会话似乎有副作用。见上文。
重新编辑:将您的修复纳入后代。
Try something like this:
Hope that helps!
Thanks,
Joe
EDIT: good point ;)
Looking through the adminhtml code, it seems to be far less useful than the normal customer code. I was hoping for a call to Mage::register but that's not happening. I found a possible solution, though loading sessions in Magento seems to have side effects. See above.
RE-EDIT: to incorporate your fixes for posterity.
尝试加载当前登录的客户:
干杯,
京东
Try this to load the current logged-in customer:
Cheers,
JD