【发布时间】:2015-10-13 07:33:37
【问题描述】:
目前我正在尝试对 Magento 的 Paypal Express 扩展进行一些更改。我正在尝试删除评论页面,因为它没有必要。
这里已经描述了它是如何完成的: Magento: easy way to remove "paypal/express/review" step
但当您启用协议时,它将不起作用。 这就是问题所在:
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
【问题讨论】:
-
您使用的是哪个版本的 Magento?