【问题标题】:Magento paypal express review page and agreementsMagento paypal 快递评论页面和协议
【发布时间】: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?

标签: magento paypal review


【解决方案1】:

在您的 config.xml 中,删除模块名称后的空格

<Sandfox_RemovePaypalExpressReviewStep before="Mage_Paypal">Sandfox_RemovePaypalExpressReviewStep </Sandfox_RemovePaypalExpressReviewStep>

应该改为

<Sandfox_RemovePaypalExpressReviewStep before="Mage_Paypal">Sandfox_RemovePaypalExpressReviewStep</Sandfox_RemovePaypalExpressReviewStep>

【讨论】:

  • 感谢您对 Rakesh 的回复,但它并没有解决问题。
  • 那之后你清除缓存了吗?如果是,我怀疑您在这个问题中遗漏的内容一定有问题。您可以将完整的 config.xml 文件添加到问题中吗?
  • 是的,我清除了 Magento 后端和目录 var/cache 中的缓存。我更新了上面的 config.xml - 现在它是完整的文件。我发布了我的技术环境规范。感谢您的回复
【解决方案2】:

您不能扩展 Abstract 类。你需要复制到本地/法师...

【讨论】:

    猜你喜欢
    • 2015-07-08
    • 1970-01-01
    • 2015-10-09
    • 2011-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-25
    • 2013-03-15
    相关资源
    最近更新 更多