重写Mage_Paypal_Model_Express_Checkout
我遇到了一个问题,即运输选项无法进入 PayPal Express 审核页面。如果买家输入了免运费优惠券,然后使用PayPal Express,当他们从PP网站返回时,提交订单的评论页面没有免运费选项。
我找到了一个线程,其中通过向 Mage_Paypal_Model_Express_Checkout 类添加代码来回答。此更改有效,但修改核心代码是禁忌,因此我尝试重写该类,但遇到了麻烦。我以前重写过核心类,但是这个有点不同,我无法弄清楚。有人能指出我正确的方向吗?
这是我的 config.xml 的内容。这看起来合适吗?
<config>
<modules>
<VPS_Paypal>
<version>0.1.0</version>
</VPS_Paypal>
</modules>
<global>
<models>
<paypal>
<rewrite>
<express_checkout>
<class>VPS_Paypal_Model_Express_Checkout</class>
</express_checkout>
</rewrite>
</paypal>
</models>
</global>
</config>
I have run into a problem where shipping options are not making it to the PayPal Express review page. If the buyer enters a free shipping coupon and then uses PayPal Express, when they return from the PP website, the review page where the submit the order doesn't have the free shipping option.
I found a thread where this was answered by adding code to the Mage_Paypal_Model_Express_Checkout class. This change works, but modifying core code is a no-no, so I'm trying to rewrite the class and I'm having trouble. I've rewritten core classes before, but this one is different somehow and I can't figure it out. Can someone point me in the right direction?
here's the contents of my config.xml. Does this look right?
<config>
<modules>
<VPS_Paypal>
<version>0.1.0</version>
</VPS_Paypal>
</modules>
<global>
<models>
<paypal>
<rewrite>
<express_checkout>
<class>VPS_Paypal_Model_Express_Checkout</class>
</express_checkout>
</rewrite>
</paypal>
</models>
</global>
</config>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有测试过这个,但根据类名,我认为将其添加到您的配置部分会起作用:
您的自定义类应该扩展 Mage_Paypal_Model_Express_Checkout 并且仅覆盖您想要更改的方法。
I haven't tested this, but based on the class name I would think that adding this to the section of your config would work:
Your custom class should extend Mage_Paypal_Model_Express_Checkout and only override the method you want to change.