【问题标题】:Magento: Cart, Payment method orderingMagento:购物车,付款方式订购
【发布时间】:2015-11-27 10:21:37
【问题描述】:

我运行的是 1.9.x,有 3 种不同的付款方式,亚马逊付款、paypal express、sage pay 和继续购物按钮。在购物车页面上,我试图重新排序这些在结帐类型 UL 中的显示方式。

我目前有以下我认为是默认的

<ul class="checkout-types">
        <li><?php if($this->getContinueShoppingUrl()): ?>
                                <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue btn-inline" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
                            <?php endif; ?></li>
        <?php foreach ($this->getMethods('top_methods') as $method): ?>
            <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
             <li><?php echo $methodHtml; ?></li>
            <?php endif; ?>
        <?php endforeach; ?>
        </ul>

我的目标是让进入单页结帐按钮的立即付款按钮出现在继续购物按钮之后,然后是亚马逊和贝宝。我花了几个小时查看代码,但似乎找不到更改 $method 数组排序顺序的方法。

【问题讨论】:

    标签: php magento


    【解决方案1】:

    getMethods($name) 方法实际上将用于排序到布局文件中的配置。

    作为布局中的别名top_methods 的示例,它将从系统中的 XML 文件中查找该句柄上的所有更新,如果是 PayPal,它将是,考虑到 RWD 是您正在使用的软件包app/design/frontend/rwd/default/layout/paypal.xml

    这是它的 xml 块部分:

        <block type="paypal/express_shortcut" name="checkout.cart.methods.paypal_express.top" before="checkout.cart.methods.onepage.top" template="paypal/express/shortcut.phtml">
            <action method="setIsQuoteAllowed"><value>1</value></action>
            <action method="setShowOrPosition"><value>after</value></action>
        </block>
    

    在此默认主题配置中,paypal express checkout 放置在checkout.cart.methods.onepage.top 块之前,该块被配置为top_methods 中的最后一个块after="-"

        <block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
                <label>Payment Methods Before Checkout Button</label>
                <block type="checkout/onepage_link" name="checkout.cart.methods.onepage.top" template="checkout/onepage/link.phtml" after="-" />
        </block>
    

    总之,您需要做的是检查您正在使用的付款方式的 XML 布局文件,以及set the before and after depending on the sort you need。如果您启用了缓存,则需要刷新它并且您应该得到预期的结果。

    一个例子是:

    Change display order of checkout buttons in Magento

    【讨论】:

      【解决方案2】:

      将以下内容添加到结帐布局中对问题进行了排序

      before="checkout.cart.methods.amazonpayments_pay.top"
      

      【讨论】:

        猜你喜欢
        • 2013-05-22
        • 2013-01-30
        • 1970-01-01
        • 2023-04-02
        • 1970-01-01
        • 1970-01-01
        • 2012-03-06
        • 2018-03-01
        • 1970-01-01
        相关资源
        最近更新 更多