Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento2 在商店视图上设置允许的国家/地区_Magento2_Online Store - Fatal编程技术网

Magento2 在商店视图上设置允许的国家/地区

Magento2 在商店视图上设置允许的国家/地区,magento2,online-store,Magento2,Online Store,在Magento 1.4中,我能够在商店视图级别上设置允许的国家/地区,因此我可以拥有一个网站,每个国家/地区都有一个商店和多个商店视图: 现在在Magento 2中,我只能在网站上设置允许的国家/地区,而不能在商店视图上设置,商店视图设置如下所示: 我为什么要改变这一点?我需要能够为每个商店视图设置不同的商店联系地址,因为我有一个阿根廷人和一个保加利亚人商店视图,所以我想设置不同的地址,但使用相同的网站/商店 不幸的是,我也无法再根据商店视图更改商店联系地址,这也只能在网站级别上使用 我错

在Magento 1.4中,我能够在
商店视图
级别上设置
允许的国家/地区
,因此我可以拥有一个
网站
,每个国家/地区都有一个
商店
和多个
商店视图

现在在Magento 2中,我只能在
网站上设置
允许的国家/地区,而不能在
商店视图上设置
,商店视图设置如下所示:

我为什么要改变这一点?我需要能够为每个
商店视图
设置不同的
商店联系地址
,因为我有一个阿根廷人和一个保加利亚人
商店视图
,所以我想设置不同的地址,但使用相同的
网站
/
商店

不幸的是,我也无法再根据
商店视图更改
商店联系地址
,这也只能在
网站
级别上使用


我错过什么了吗?
商店视图是否有从1.X到2.X的逻辑更改?

我不知道为什么从商店视图的设置中删除了允许的国家/地区选项。但是查看代码表明,如果存在信息,就会使用这些信息。因此,您只需将数据输入核心配置数据(作用域:stores,作用域id:your\u store\u id,value:AT,AB,AC…。

尊重Magento 2标准化的正确答案是重载Magento/Backend/etc/adminhtml的system.xml。 你应该试试: 供应商/ModuleName/etc/adminhtml/system.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="general">
            <group id="country" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Country Options</label>
                <field id="allow" translate="label" type="multiselect" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Allow Countries</label>
                    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
                    <can_be_empty>1</can_be_empty>
                </field>
            </group>
        </section>
    </system>
</config>

国家选择
允许国家
Magento\Directory\Model\Config\Source\Country
1.
记住添加覆盖的模块-Magento_后端

供应商/ModuleName/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_YourModule" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Backend"/>
        </sequence>
    </module>
</config>