Skip to content

Commit dd9fce3

Browse files
committed
MAGETWO-67577: quote_shipping_rate table contents are different depending on whether Magento was upgraded vs installed
1 parent 821d40d commit dd9fce3

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

app/code/Magento/CustomerSampleData/Model/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,6 @@ protected function convertRowData($row, $data)
268268
protected function getRegionId($address)
269269
{
270270
$country = $this->countryFactory->create()->loadByCode($address['country_id']);
271-
return $country->getRegionCollection()->addFieldToFilter('name', $address['region'])->getFirstItem()->getId();
271+
return $country->getRegionCollection()->addFieldToFilter('default_name', $address['region'])->getFirstItem()->getId();
272272
}
273273
}

app/code/Magento/OfflineShippingSampleData/Model/Tablerate.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\OfflineShippingSampleData\Model;
77

88
use Magento\Framework\Setup\SampleData\Context as SampleDataContext;
9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\Config\App\Config\Type\System as SystemConfig;
911

1012
/**
1113
* Class Tablerate
@@ -57,14 +59,20 @@ class Tablerate
5759
*/
5860
protected $storeManager;
5961

62+
/**
63+
* @var SystemConfig
64+
*/
65+
private $systemConfig;
66+
6067
/**
6168
* @param SampleDataContext $sampleDataContext
6269
* @param \Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate $tablerate
63-
* @param \Magento\Framework\App\ResourceModel $resource
70+
* @param \Magento\Framework\App\ResourceConnection $resource
6471
* @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
6572
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
6673
* @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
6774
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
75+
* @param SystemConfig|null $systemConfig
6876
*/
6977
public function __construct(
7078
SampleDataContext $sampleDataContext,
@@ -73,7 +81,8 @@ public function __construct(
7381
\Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory,
7482
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
7583
\Magento\Framework\App\Config\Storage\WriterInterface $configWriter,
76-
\Magento\Store\Model\StoreManagerInterface $storeManager
84+
\Magento\Store\Model\StoreManagerInterface $storeManager,
85+
SystemConfig $systemConfig = null
7786
) {
7887
$this->fixtureManager = $sampleDataContext->getFixtureManager();
7988
$this->csvReader = $sampleDataContext->getCsvReader();
@@ -83,6 +92,7 @@ public function __construct(
8392
$this->cacheTypeList = $cacheTypeList;
8493
$this->configWriter = $configWriter;
8594
$this->storeManager = $storeManager;
95+
$this->systemConfig = $systemConfig ?: ObjectManager::getInstance()->get(SystemConfig::class);
8696
}
8797

8898
/**
@@ -138,6 +148,7 @@ public function install(array $fixtures)
138148
$this->configWriter->save('carriers/tablerate/active', 1);
139149
$this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
140150
$this->cacheTypeList->cleanType('config');
151+
$this->systemConfig->clean();
141152
}
142153

143154
/**

0 commit comments

Comments
 (0)