22 private $moduleDataSetup;
29 \
Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
31 $this->moduleDataSetup = $moduleDataSetup;
39 $connection = $this->moduleDataSetup->getConnection();
40 $configDataTable = $this->moduleDataSetup->getTable(
'core_config_data');
41 $oldToNewMethodCodesMap = [
42 'First-Class' =>
'0_FCLE',
43 'First-Class Mail International Large Envelope' =>
'INT_14',
44 'First-Class Mail International Letter' =>
'INT_13',
45 'First-Class Mail International Letters' =>
'INT_13',
46 'First-Class Mail International Package' =>
'INT_15',
47 'First-Class Mail International Parcel' =>
'INT_13',
48 'First-Class Package International Service' =>
'INT_15',
49 'First-Class Mail' =>
'0_FCLE',
50 'First-Class Mail Flat' =>
'0_FCLE',
51 'First-Class Mail Large Envelope' =>
'0_FCLE',
52 'First-Class Mail International' =>
'INT_14',
53 'First-Class Mail Letter' =>
'0_FCL',
54 'First-Class Mail Parcel' =>
'0_FCP',
55 'First-Class Mail Package' =>
'0_FCP',
56 'First-Class Package Service - Retail' =>
'0_FCP',
58 'Retail Ground' =>
'4',
60 'Library Mail' =>
'7',
61 'Express Mail' =>
'3',
62 'Express Mail PO to PO' =>
'3',
63 'Express Mail Flat Rate Envelope' =>
'13',
64 'Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee' =>
'25',
65 'Express Mail Sunday/Holiday Guarantee' =>
'23',
66 'Express Mail Flat Rate Envelope Hold For Pickup' =>
'27',
67 'Express Mail Hold For Pickup' =>
'2',
68 'Global Express Guaranteed (GXG)' =>
'INT_4',
69 'Global Express Guaranteed Non-Document Rectangular' =>
'INT_6',
70 'Global Express Guaranteed Non-Document Non-Rectangular' =>
'INT_7',
71 'USPS GXG Envelopes' =>
'INT_12',
72 'Express Mail International' =>
'INT_1',
73 'Express Mail International Flat Rate Envelope' =>
'INT_10',
74 'Priority Mail' =>
'1',
75 'Priority Mail Small Flat Rate Box' =>
'28',
76 'Priority Mail Medium Flat Rate Box' =>
'17',
77 'Priority Mail Large Flat Rate Box' =>
'22',
78 'Priority Mail Flat Rate Envelope' =>
'16',
79 'Priority Mail International' =>
'INT_2',
80 'Priority Mail International Flat Rate Envelope' =>
'INT_8',
81 'Priority Mail International Small Flat Rate Box' =>
'INT_16',
82 'Priority Mail International Medium Flat Rate Box' =>
'INT_9',
83 'Priority Mail International Large Flat Rate Box' =>
'INT_11',
87 ->from($configDataTable)
90 [
'carriers/usps/free_method',
'carriers/usps/allowed_methods']
94 foreach ($oldConfigValues as $oldValue) {
95 if (stripos($oldValue[
'path'],
'free_method') !==
false 96 && isset($oldToNewMethodCodesMap[$oldValue[
'value']])
98 $newValue = $oldToNewMethodCodesMap[$oldValue[
'value']];
99 }
elseif (stripos($oldValue[
'path'],
'allowed_methods') !==
false) {
106 $newValue = implode(
',', $newValuesList);
111 if ($newValue && $newValue != $oldValue[
'value']) {
112 $whereConfigId =
$connection->quoteInto(
'config_id = ?', $oldValue[
'config_id']);
113 $connection->update($configDataTable, [
'value' => $newValue], $whereConfigId);
elseif(isset( $params[ 'redirect_parent']))
__construct(\Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup)