File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed
app/code/Magento/OfflineShipping Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \OfflineShipping \Setup ;
8
+
9
+ use Magento \Framework \Setup \ModuleContextInterface ;
10
+ use Magento \Framework \Setup \ModuleDataSetupInterface ;
11
+ use Magento \Framework \Setup \UpgradeDataInterface ;
12
+ use Magento \Quote \Model \Quote \Address ;
13
+
14
+ /**
15
+ * Upgrade Data script.
16
+ */
17
+ class UpgradeData implements UpgradeDataInterface
18
+ {
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public function upgrade (ModuleDataSetupInterface $ setup , ModuleContextInterface $ context )
23
+ {
24
+ $ setup ->startSetup ();
25
+ if ($ context ->getVersion () && version_compare ($ context ->getVersion (), '2.0.1 ' ) < 0 ) {
26
+ $ this ->updateQuoteShippingAddresses ($ setup );
27
+ }
28
+ $ setup ->endSetup ();
29
+ }
30
+
31
+ /**
32
+ * Replace Null with '0' for free_shipping in quote shipping addresses.
33
+ *
34
+ * @param ModuleDataSetupInterface $setup
35
+ * @return void
36
+ */
37
+ private function updateQuoteShippingAddresses (ModuleDataSetupInterface $ setup )
38
+ {
39
+ $ setup ->getConnection ()->update (
40
+ $ setup ->getTable ('quote_address ' ),
41
+ ['free_shipping ' => 0 ],
42
+ [
43
+ 'address_type = ? ' => Address::ADDRESS_TYPE_SHIPPING ,
44
+ new \Zend_Db_Expr ('free_shipping IS NULL ' ),
45
+ ]
46
+ );
47
+ }
48
+ }
Original file line number Diff line number Diff line change 6
6
*/
7
7
-->
8
8
<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
9
- <module name =" Magento_OfflineShipping" setup_version =" 2.0.0 " >
9
+ <module name =" Magento_OfflineShipping" setup_version =" 2.0.1 " >
10
10
<sequence >
11
11
<module name =" Magento_Store" />
12
12
<module name =" Magento_Sales" />
You can’t perform that action at this time.
0 commit comments