目前我正在尝试对 Magento 的 Paypal Express 扩展进行一些更改。我正在尝试删除评论页面,因为它是不必要的。
这里已经描述了它是如何完成的: Magento:删除“paypal/express/review”步骤的简单方法
但是启用协议后就不起作用了。 问题是这样的:
app/code/core/Mage/Paypal/Controller/Express/Abstract.php
第 314 至 316 行必须取消注释
if (array_diff($requiredAgreements, $postedAgreements)) {
Mage::throwException(Mage::helper('paypal')->__('Please agree to all the terms and conditions before placing the order.'));
}
app/code/community/Sandfox/RemovePaypalExpressReviewStep/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Sandfox_RemovePaypalExpressReviewStep>
<version>0.1.0</version>
</Sandfox_RemovePaypalExpressReviewStep>
</modules>
<global>
<models>
<sandfox_removepaypalexpressreviewstep>
<class>Sandfox_RemovePaypalExpressReviewStep_Model</class>
</sandfox_removepaypalexpressreviewstep>
<paypal>
<rewrite>
<config>Sandfox_RemovePaypalExpressReviewStep_Model_Config</config>
</rewrite>
</paypal>
</models>
<events>
<controller_action_predispatch_paypal_express_review>
<observers>
<sandfox_removepaypalexpressreviewstep>
<type>singleton</type>
<class>sandfox_removepaypalexpressreviewstep/observer</class>
<method>controllerActionPredispatchPaypalExpressReview</method>
</sandfox_removepaypalexpressreviewstep>
</observers>
</controller_action_predispatch_paypal_express_review>
</events>
</global>
<frontend>
<routers>
<paypal>
<args>
<modules>
<Sandfox_RemovePaypalExpressReviewStep before="Mage_Paypal">Sandfox_RemovePaypalExpressReviewStep</Sandfox_RemovePaypalExpressReviewStep>
</modules>
</args>
</paypal>
</routers>
</frontend>
</config>
现在我尝试重写控制器(它真的是控制器吗?为什么它不在控制器中但有自己的控制器目录?)
app/code/community/Sandfox/RemovePaypalExpressReviewStep/Controller/Express/Abstract.php
<?php
include_once("Mage/Paypal/Controller/Express/Abstract.php");
class Sandfox_RemovePaypalExpressReviewStep_Controller_Express_Abstract extends Mage_Paypal_Controller_Express_Abstract
{
public function placeOrderAction()
{
try {
.
.
.
// if (array_diff($requiredAgreements, $postedAgreements)) {
// Mage::throwException(Mage::helper('paypal')->__('Please agree to all the terms and conditions before placing the order.'));
// }
}
.
.
.
}
目前重写不起作用。有人可以给我提示吗?
技术:
Magento 1.9.2
PHP 5.5
MYSQL 5.6.19
在 config.xml 中,删除模块名称后面的空格
<Sandfox_RemovePaypalExpressReviewStep before="Mage_Paypal">Sandfox_RemovePaypalExpressReviewStep </Sandfox_RemovePaypalExpressReviewStep>
应改为
<Sandfox_RemovePaypalExpressReviewStep before="Mage_Paypal">Sandfox_RemovePaypalExpressReviewStep</Sandfox_RemovePaypalExpressReviewStep>
你不能扩展抽象类。你需要复制到本地/Mage...