购物车价格规则中未包含所有付款方式


Answers:


10

打开文件供应商/magento/module-payment/Helper/data.php

在第268行,将这一行

$data['active'] = 1;

如果您不想更改核心文件,而需要覆盖该文件,请遵循以下代码

转到Vendor / Extension / etc / di.xml并将以下代码写入di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Payment\Helper\Data" type="Vendor\Extension\Helper\Data"/>
</config>

下一步是在Vendor \ Extension \ Helper \ Data.php中创建Data.php文件

<?php
namespace Vendor\Extension\Helper;

use Magento\Payment\Helper\Data as MainHelper;

class Data extends MainHelper
{
    public function getPaymentMethodList($sorted = true, $asLabelValue = false, $withGroups = false, $store = null)
    {
        $methods = [];
        $groups = [];
        $groupRelations = [];


        foreach ($this->getPaymentMethods() as $code => $data) {

            $data['active'] = 1;

            if (!empty($data['active'])) {
                $storedTitle = $this->getMethodInstance($code)->getConfigData('title', $store);
                if (isset($storedTitle)) {
                    $methods[$code] = $storedTitle;
                } elseif (isset($data['title'])) {
                    $methods[$code] = $data['title'];
                }
            }
            if ($asLabelValue && $withGroups && isset($data['group'])) {
                $groupRelations[$code] = $data['group'];
            }
        }
        if ($asLabelValue && $withGroups) {
            $groups = $this->_paymentConfig->getGroups();
            foreach ($groups as $code => $title) {
                $methods[$code] = $title;
            }
        }
        if ($sorted) {
            asort($methods);
        }
        if ($asLabelValue) {
            $labelValues = [];
            foreach ($methods as $code => $title) {
                $labelValues[$code] = [];
            }
            foreach ($methods as $code => $title) {
                if (isset($groups[$code])) {
                    $labelValues[$code]['label'] = $title;
                    if (!isset($labelValues[$code]['value'])) {
                        $labelValues[$code]['value'] = null;
                    }
                } elseif (isset($groupRelations[$code])) {
                    unset($labelValues[$code]);
                    $labelValues[$groupRelations[$code]]['value'][$code] = ['value' => $code, 'label' => $title];
                } else {
                    $labelValues[$code] = ['value' => $code, 'label' => $title];
                }
            }

            return $labelValues;
        }


        return $methods;
    }
}

无法正常工作,我无法编辑核心文件。
— Magecode

在Magento 2.3.1中,我们可以使用付款方式创建规则,但是为什么条件选择中没有所有付款方式呢?
— Magecode

它的工作对我来说,你可以分享你把确切的截图,如果你不想编辑核心文件比你重写文件和变革
— 夹具帕尔马



5

您可以使用下面的链接

https://magento.stackexchange.com/a/128606/70565

希望对您有用。


在Magento 2.3.1中,我们可以使用付款方式创建规则,但是为什么条件选择中没有所有付款方式呢?
— Magecode

我已经签入了magento 231版本,因为该付款方式条件不可用。
— Sweety Masmiya

您是否使用任何扩展功能或默认的magento功能?
— Sweety Masmiya

默认的Magento功能
— Magecode

我已签入默认的magento 231版本,因为该付款方式条件不可用。
— Sweety Masmiya
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.