Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit ab18b6c

Browse files
committed
MAGETWO-72305: USPS First-Class Mail Parcel method no longer displaying checkout
- Moved update for shipping methods with outdated format to upgrade data script
1 parent 240e2cc commit ab18b6c

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

app/code/Magento/Usps/Setup/InstallData.php renamed to app/code/Magento/Usps/Setup/UpgradeData.php

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,29 @@
66

77
namespace Magento\Usps\Setup;
88

9-
use Magento\Framework\Setup\InstallDataInterface;
109
use Magento\Framework\Setup\ModuleContextInterface;
1110
use Magento\Framework\Setup\ModuleDataSetupInterface;
11+
use Magento\Framework\Setup\UpgradeDataInterface;
1212

13-
/**
14-
* @codeCoverageIgnore
15-
*/
16-
class InstallData implements InstallDataInterface
13+
class UpgradeData implements UpgradeDataInterface
1714
{
1815
/**
19-
* {@inheritdoc}
16+
* @inheritdoc
17+
*/
18+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
19+
{
20+
if (version_compare($context->getVersion(), '2.0.1', '<')) {
21+
$this->updateAllowedMethods($setup);
22+
}
23+
}
24+
25+
/**
26+
* Replaces titles of allowed shipping methods to their codes.
27+
*
28+
* @param ModuleDataSetupInterface $setup
29+
* @return void
2030
*/
21-
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
31+
private function updateAllowedMethods(ModuleDataSetupInterface $setup)
2232
{
2333
$installer = $setup;
2434
$configDataTable = $installer->getTable('core_config_data');
@@ -69,12 +79,12 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
6979
'Priority Mail International Large Flat Rate Box' => 'INT_11',
7080
];
7181

72-
$select = $connection->select()->from(
73-
$configDataTable
74-
)->where(
75-
'path IN (?)',
76-
['carriers/usps/free_method', 'carriers/usps/allowed_methods']
77-
);
82+
$select = $connection->select()
83+
->from($configDataTable)
84+
->where(
85+
'path IN (?)',
86+
['carriers/usps/free_method', 'carriers/usps/allowed_methods']
87+
);
7888
$oldConfigValues = $connection->fetchAll($select);
7989

8090
foreach ($oldConfigValues as $oldValue) {

app/code/Magento/Usps/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Usps" setup_version="2.0.0">
9+
<module name="Magento_Usps" setup_version="2.0.1">
1010
</module>
1111
</config>

0 commit comments

Comments
 (0)