我们如何在magento2.x中为所有商店修改或添加或删除某些国家/地区名称?
使用magento2.x中的以下代码,我可以找到具有名称的国家列表我们如何在magento2.x中为所有商店修改或添加或删除某些国家/地区名称?,magento2,Magento2,使用magento2.x中的以下代码,我可以找到具有名称的国家列表 <?php namespace Readymate\Samplemodule\Block; class HelloWorld extends \Magento\Framework\View\Element\Template { protected $_countryCollectionFactory; public function __construct( \M
<?php
namespace Readymate\Samplemodule\Block;
class HelloWorld extends \Magento\Framework\View\Element\Template
{
protected $_countryCollectionFactory;
public function __construct(
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
\Magento\Framework\View\Element\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
$this->_countryCollectionFactory = $countryCollectionFactory;
}
public function getCountryCollection()
{
$collection = $this->_countryCollectionFactory->create()->loadByStore();
return $collection;
}
public function getCountries()
{
return $options = $this->getCountryCollection()
->toOptionArray();
}
}
这里是所有与国家/地区相关的表格,您可以从中删除国家/地区、州,也可以重命名国家/地区和州
国家目录
国家/地区目录
目录\国家\地区\名称
目录\货币\汇率