From 7aeb9f682b0363875bcc6c3cf48d8ac1e2418c1c Mon Sep 17 00:00:00 2001 From: wsajason Date: Fri, 11 Aug 2017 09:34:15 +0100 Subject: [PATCH] 20.4.5 SHQ16-2178 set address type on new quote --- CHANGELOG.MD | 287 ++++++++++++++---- src/Model/Carrier/Shipper.php | 2 +- .../Checkout/ShippingInformationPlugin.php | 1 + .../Quote/ShippingMethodManagementPlugin.php | 99 ++++++ src/Setup/UpgradeData.php | 6 +- src/etc/config.xml | 2 +- src/etc/di.xml | 6 + 7 files changed, 338 insertions(+), 65 deletions(-) create mode 100644 src/Plugin/Quote/ShippingMethodManagementPlugin.php diff --git a/CHANGELOG.MD b/CHANGELOG.MD index ae1812a8..bf23df3e 100755 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,92 +1,259 @@ # Change Log -## 20.0.23 -SHQ16-1395 remove references to carrier group factory +## [20.4.5](https://github.com/webshopapps/module-shipper/tree/20.4.5) (2017-08-11) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.4.4...20.4.5) -## 20.0.24 -SHQ16-1543 belts and braces check on quote item before accessing +**Merged pull requests:** -## 20.0.25 -SHQ16-1582 display pickup location and time slot in order view, SHQ16-1682 Changed version to placeholder +- SHQ16-2178 existing checkout for 0 [\#51](https://github.com/webshopapps/module-shipper/pull/51) ([wsagen](https://github.com/wsagen)) +- SHQ16-2178 Move set address type on quote address to main ShipperHQ module [\#50](https://github.com/webshopapps/module-shipper/pull/50) ([wsagen](https://github.com/wsagen)) -## 20.0.26 -SHQ16-745 eCommerce cart in request corrected +## [20.4.4](https://github.com/webshopapps/module-shipper/tree/20.4.4) (2017-08-08) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.4.3...20.4.4) -## 20.1.0 -SHQ16-1619 Config flag to ignore requests if zip code blank +**Merged pull requests:** -## 20.1.1 -SHQ16-1731 corrected function name, SHQ16-1730 resolved package helper constructor, SHQ16-1730 resolved constructor on package helper +- Develop [\#49](https://github.com/webshopapps/module-shipper/pull/49) ([wsajosh](https://github.com/wsajosh)) +- SHQ16-2200 Added in master packing boxes attribute to mapping [\#48](https://github.com/webshopapps/module-shipper/pull/48) ([wsajosh](https://github.com/wsajosh)) +- SHQ16-2178 reset validation and address type on customer address if i… [\#47](https://github.com/webshopapps/module-shipper/pull/47) ([wsagen](https://github.com/wsagen)) +- SHQ16-2178 reset session values when not set [\#46](https://github.com/webshopapps/module-shipper/pull/46) ([wsagen](https://github.com/wsagen)) +- SHQ16-2178 Support editable address type on customer address [\#45](https://github.com/webshopapps/module-shipper/pull/45) ([wsagen](https://github.com/wsagen)) +- SHQ16-2190 refresh of about section on config [\#44](https://github.com/webshopapps/module-shipper/pull/44) ([wsagen](https://github.com/wsagen)) +- SHQ16-2190 amend about us section on configuration page [\#43](https://github.com/webshopapps/module-shipper/pull/43) ([wsagen](https://github.com/wsagen)) +- SHQ16-2190 amend about us section on configuration page [\#42](https://github.com/webshopapps/module-shipper/pull/42) ([wsagen](https://github.com/wsagen)) +- SHQ16-2179 correct tags in html [\#41](https://github.com/webshopapps/module-shipper/pull/41) ([wsagen](https://github.com/wsagen)) -## 20.1.2 -SHQ16-1739 modify usage of checkout session, Updated issue reference in readme +## [20.4.3](https://github.com/webshopapps/module-shipper/tree/20.4.3) (2017-07-25) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.4.2...20.4.3) -## 20.1.3 -SHQ16-1745 handle exception on addresses without region +## [20.4.2](https://github.com/webshopapps/module-shipper/tree/20.4.2) (2017-07-18) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.4.1...20.4.2) -## 20.1.4 -SHQ16-992 implemented caching of rates using cache +**Merged pull requests:** -## 20.1.5 -Updated README with latest github issues +- SHQ16-2159 add custom admin shipping when o rates returned [\#40](https://github.com/webshopapps/module-shipper/pull/40) ([wsagen](https://github.com/wsagen)) -## 20.1.6 -SHQ16-1774 record order packages +## [20.4.1](https://github.com/webshopapps/module-shipper/tree/20.4.1) (2017-07-13) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.4.0...20.4.1) -## 20.1.7 -SHQ16-1708 display notification when credentials invalid in admin, SHQ16-1859 allow extension of shipper mapper functions +**Merged pull requests:** -## 20.1.8 -SHQ16-1851 removed columns from sales order grid until we find a solution +- SHQ16-2154 clean up step to remove duplicates from shq order grid table [\#39](https://github.com/webshopapps/module-shipper/pull/39) ([wsagen](https://github.com/wsagen)) -## 20.1.9 -SHQ16-992 implement config switch for caching rates +## [20.4.0](https://github.com/webshopapps/module-shipper/tree/20.4.0) (2017-07-06) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.9...20.4.0) -## 20.2.0 -SHQ16-992 implement config switch for cached rates +**Merged pull requests:** -## 20.2.1 -SHQ16-1902 use stored address type in subsequent requests +- Develop [\#38](https://github.com/webshopapps/module-shipper/pull/38) ([wsajosh](https://github.com/wsajosh)) +- SHQ16-2141 UPS LTL use carrier code as type [\#37](https://github.com/webshopapps/module-shipper/pull/37) ([wsajosh](https://github.com/wsajosh)) -## 20.2.2 -SHQ16-1922 save package detail on first pass through checkout, set carrier code when settings are shqshared, SHQ16-1927 pass store id when retrieving quote +## [20.3.9](https://github.com/webshopapps/module-shipper/tree/20.3.9) (2017-07-03) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.8...20.3.9) -## 20.2.3 -SHQ16-1925 Resolved issue with merged rates not showing +**Merged pull requests:** -## 20.2.4 -SHQ16-594 populate shipperhq_location in request +- SHQ16-2123 Upgrade script to remove migration attribute groups [\#36](https://github.com/webshopapps/module-shipper/pull/36) ([wsagen](https://github.com/wsagen)) -## 20.3.0 -SHQ16-1851_A reinstate order grid columns +## [20.3.8](https://github.com/webshopapps/module-shipper/tree/20.3.8) (2017-06-29) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.7...20.3.8) -## 20.3.1 -SHQ16-1851_A reinstate order grid columns +**Merged pull requests:** -## 20.3.2 -SHQ16-1968 save packages when carrier and name is duplicated +- SHQ16-2123 resolve issue with install and upgrade when database has b… [\#34](https://github.com/webshopapps/module-shipper/pull/34) ([wsagen](https://github.com/wsagen)) -## 20.3.3 -SHQ16-2002 Fixed issue with SHQ using wrong stores API credentials within admin +## [20.3.7](https://github.com/webshopapps/module-shipper/tree/20.3.7) (2017-06-26) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.6...20.3.7) -## 20.3.4 -SHQ16-2002 Fixed issue with SHQ using wrong stores API credentials within admin +**Merged pull requests:** -## 20.3.5 -SHQ16-2004 - custom admin shipping and SHQ16-2029 - code sniffer changes +- SHQ16-2117 resolved issue with Authorize.net and custom admin shipping [\#33](https://github.com/webshopapps/module-shipper/pull/33) ([wsagen](https://github.com/wsagen)) +- Develop [\#32](https://github.com/webshopapps/module-shipper/pull/32) ([wsajosh](https://github.com/wsajosh)) +- SHQ16-2098 Fix for region being null in request [\#31](https://github.com/webshopapps/module-shipper/pull/31) ([wsajosh](https://github.com/wsajosh)) -## 20.4.0 -SHQ16-2032 and SHQ16-2041 pickup date is used as start when it's today, otherwise use start date, SHQ16-2041 extended unit tests, SHQ16-2029 changes from code sniffer review +## [20.3.6](https://github.com/webshopapps/module-shipper/tree/20.3.6) (2017-06-15) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.5...20.3.6) -## 20.5.0 -SHQ16-1967 Accessorials in M2 +**Merged pull requests:** -## 20.5.1 -Corrected version number display +- Develop [\#30](https://github.com/webshopapps/module-shipper/pull/30) ([wsajosh](https://github.com/wsajosh)) +- SHQ16-2087 M2 slow sales order grid improvements [\#29](https://github.com/webshopapps/module-shipper/pull/29) ([wsajosh](https://github.com/wsajosh)) +- Develop [\#28](https://github.com/webshopapps/module-shipper/pull/28) ([wsajosh](https://github.com/wsajosh)) +- M2-35 Dim comments always being logged out [\#27](https://github.com/webshopapps/module-shipper/pull/27) ([wsajosh](https://github.com/wsajosh)) +- Bringing Production up to date [\#26](https://github.com/webshopapps/module-shipper/pull/26) ([wsajason](https://github.com/wsajason)) +- SHQ16-1967 Support for accessorials [\#25](https://github.com/webshopapps/module-shipper/pull/25) ([wsagen](https://github.com/wsagen)) +- Develop [\#24](https://github.com/webshopapps/module-shipper/pull/24) ([wsajosh](https://github.com/wsajosh)) +- M2-32 SQL error when re-running the SQL script. [\#23](https://github.com/webshopapps/module-shipper/pull/23) ([wsajosh](https://github.com/wsajosh)) -## 20.5.2 -SHQ16-2117 resolved issue with Authorize.net and custom admin shipping -## 20.5.9 -SHQ16-2178 prevent display of address type and validation result on front end, SHQ16-2200 Added in master packing boxes attribute to mapping +## [20.3.5](https://github.com/webshopapps/module-shipper/tree/20.3.5) (2017-05-05) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.3...20.3.5) +## [20.3.3](https://github.com/webshopapps/module-shipper/tree/20.3.3) (2017-05-05) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.2...20.3.3) +**Merged pull requests:** + +- SHQ16-2004 [\#22](https://github.com/webshopapps/module-shipper/pull/22) ([wsagen](https://github.com/wsagen)) +- SHQ16-2004 Carrier for admin shipping [\#21](https://github.com/webshopapps/module-shipper/pull/21) ([wsagen](https://github.com/wsagen)) +- SHQ16-2029 changes recommended by code sniffer tool [\#20](https://github.com/webshopapps/module-shipper/pull/20) ([wsagen](https://github.com/wsagen)) +- SHQ16-2024 refactored checkout shipping information plugin [\#19](https://github.com/webshopapps/module-shipper/pull/19) ([wsagen](https://github.com/wsagen)) + +## [20.3.2](https://github.com/webshopapps/module-shipper/tree/20.3.2) (2017-04-07) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.1...20.3.2) + +**Merged pull requests:** + +- Shq16 2002 [\#18](https://github.com/webshopapps/module-shipper/pull/18) ([wsajason](https://github.com/wsajason)) +- SHQ16-2002 Fixed issue with SHQ using wrong stores API credentials wi… [\#16](https://github.com/webshopapps/module-shipper/pull/16) ([wsajosh](https://github.com/wsajosh)) + +## [20.3.1](https://github.com/webshopapps/module-shipper/tree/20.3.1) (2017-03-22) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.3.0...20.3.1) + +**Merged pull requests:** + +- SHQ16-1968 save packages when carrier and name is duplicated [\#15](https://github.com/webshopapps/module-shipper/pull/15) ([wsagen](https://github.com/wsagen)) + +## [20.3.0](https://github.com/webshopapps/module-shipper/tree/20.3.0) (2017-03-09) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.2.4...20.3.0) + +**Merged pull requests:** + +- SHQ16-1851\_A reinstate order grid columns [\#14](https://github.com/webshopapps/module-shipper/pull/14) ([wsagen](https://github.com/wsagen)) + +## [20.2.4](https://github.com/webshopapps/module-shipper/tree/20.2.4) (2017-03-07) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.2.3...20.2.4) + +**Merged pull requests:** + +- SHQ16-594 populate shipperhq\_location in request [\#13](https://github.com/webshopapps/module-shipper/pull/13) ([wsagen](https://github.com/wsagen)) +- SHQ16-1880 handle for pickup [\#12](https://github.com/webshopapps/module-shipper/pull/12) ([wsagen](https://github.com/wsagen)) + +## [20.2.3](https://github.com/webshopapps/module-shipper/tree/20.2.3) (2017-02-23) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.2.2...20.2.3) + +**Merged pull requests:** + +- =SHQ16-1925 Resolved issue with merged rates not showing [\#11](https://github.com/webshopapps/module-shipper/pull/11) ([wsajosh](https://github.com/wsajosh)) +- =SHQ16-1925 Resolved issue with merged rates not showing [\#10](https://github.com/webshopapps/module-shipper/pull/10) ([wsajosh](https://github.com/wsajosh)) + +## [20.2.2](https://github.com/webshopapps/module-shipper/tree/20.2.2) (2017-02-22) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.2.1...20.2.2) + +**Merged pull requests:** + +- SHQ16-1927 pass store id when retrieving quote [\#9](https://github.com/webshopapps/module-shipper/pull/9) ([wsagen](https://github.com/wsagen)) +- SHQ16-1922 save package detail on first pass through checkout, set ca… [\#8](https://github.com/webshopapps/module-shipper/pull/8) ([wsagen](https://github.com/wsagen)) + +## [20.2.1](https://github.com/webshopapps/module-shipper/tree/20.2.1) (2017-02-13) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.2.0...20.2.1) + +## [20.2.0](https://github.com/webshopapps/module-shipper/tree/20.2.0) (2017-02-13) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.9...20.2.0) + +**Merged pull requests:** + +- SHQ16-1902 use stored address type in subsequent requests [\#7](https://github.com/webshopapps/module-shipper/pull/7) ([wsagen](https://github.com/wsagen)) + +## [20.1.9](https://github.com/webshopapps/module-shipper/tree/20.1.9) (2017-02-02) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.8...20.1.9) + +**Merged pull requests:** + +- SHQ16-992 implement config switch for caching rates [\#6](https://github.com/webshopapps/module-shipper/pull/6) ([wsagen](https://github.com/wsagen)) + +## [20.1.8](https://github.com/webshopapps/module-shipper/tree/20.1.8) (2017-01-24) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.7...20.1.8) + +**Merged pull requests:** + +- SHQ16-1851 removed columns from sales order grid until we find a solu… [\#5](https://github.com/webshopapps/module-shipper/pull/5) ([wsagen](https://github.com/wsagen)) +- SHQ16-1859 allow extension of shipper mapper functions [\#4](https://github.com/webshopapps/module-shipper/pull/4) ([wsagen](https://github.com/wsagen)) + +## [20.1.7](https://github.com/webshopapps/module-shipper/tree/20.1.7) (2016-12-14) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.6...20.1.7) + +## [20.1.6](https://github.com/webshopapps/module-shipper/tree/20.1.6) (2016-11-29) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.5...20.1.6) + +## [20.1.5](https://github.com/webshopapps/module-shipper/tree/20.1.5) (2016-11-28) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.4...20.1.5) + +## [20.1.4](https://github.com/webshopapps/module-shipper/tree/20.1.4) (2016-11-17) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.3...20.1.4) + +## [20.1.3](https://github.com/webshopapps/module-shipper/tree/20.1.3) (2016-11-15) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.2...20.1.3) + +## [20.1.2](https://github.com/webshopapps/module-shipper/tree/20.1.2) (2016-11-08) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.1...20.1.2) + +## [20.1.1](https://github.com/webshopapps/module-shipper/tree/20.1.1) (2016-10-31) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.1.0...20.1.1) + +## [20.1.0](https://github.com/webshopapps/module-shipper/tree/20.1.0) (2016-10-24) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.26...20.1.0) + +**Merged pull requests:** + +- Develop [\#3](https://github.com/webshopapps/module-shipper/pull/3) ([wsajason](https://github.com/wsajason)) + +## [20.0.26](https://github.com/webshopapps/module-shipper/tree/20.0.26) (2016-10-14) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.25...20.0.26) + +## [20.0.25](https://github.com/webshopapps/module-shipper/tree/20.0.25) (2016-10-14) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.24...20.0.25) + +## [20.0.24](https://github.com/webshopapps/module-shipper/tree/20.0.24) (2016-09-19) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.23...20.0.24) + +## [20.0.23](https://github.com/webshopapps/module-shipper/tree/20.0.23) (2016-09-06) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.22...20.0.23) + +## [20.0.22](https://github.com/webshopapps/module-shipper/tree/20.0.22) (2016-09-05) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.21...20.0.22) + +## [20.0.21](https://github.com/webshopapps/module-shipper/tree/20.0.21) (2016-09-02) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.20...20.0.21) + +## [20.0.20](https://github.com/webshopapps/module-shipper/tree/20.0.20) (2016-08-19) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.19...20.0.20) + +## [20.0.19](https://github.com/webshopapps/module-shipper/tree/20.0.19) (2016-08-18) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/20.0.18...20.0.19) + +## [20.0.18](https://github.com/webshopapps/module-shipper/tree/20.0.18) (2016-08-15) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.2.5...20.0.18) + +**Merged pull requests:** + +- SHQ16-1239 Updated ecommerceCart to indicate is magento 2 [\#2](https://github.com/webshopapps/module-shipper/pull/2) ([wsakaren](https://github.com/wsakaren)) +- Dev [\#1](https://github.com/webshopapps/module-shipper/pull/1) ([wsagen](https://github.com/wsagen)) + +## [1.2.5](https://github.com/webshopapps/module-shipper/tree/1.2.5) (2016-04-07) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.2.3...1.2.5) + +## [1.2.3](https://github.com/webshopapps/module-shipper/tree/1.2.3) (2016-03-16) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.2.4...1.2.3) + +## [1.2.4](https://github.com/webshopapps/module-shipper/tree/1.2.4) (2016-03-16) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.2.2...1.2.4) + +## [1.2.2](https://github.com/webshopapps/module-shipper/tree/1.2.2) (2016-03-09) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.2.1...1.2.2) + +## [1.2.1](https://github.com/webshopapps/module-shipper/tree/1.2.1) (2016-03-09) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.2.0...1.2.1) + +## [1.2.0](https://github.com/webshopapps/module-shipper/tree/1.2.0) (2016-03-08) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.1.1...1.2.0) + +## [1.1.1](https://github.com/webshopapps/module-shipper/tree/1.1.1) (2016-02-25) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.1.0...1.1.1) + +## [1.1.0](https://github.com/webshopapps/module-shipper/tree/1.1.0) (2015-12-11) +[Full Changelog](https://github.com/webshopapps/module-shipper/compare/1.0.0...1.1.0) + +## [1.0.0](https://github.com/webshopapps/module-shipper/tree/1.0.0) (2015-11-27) + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/src/Model/Carrier/Shipper.php b/src/Model/Carrier/Shipper.php index b0d524da..ec4b0680 100755 --- a/src/Model/Carrier/Shipper.php +++ b/src/Model/Carrier/Shipper.php @@ -319,7 +319,7 @@ public function setRequest(\Magento\Quote\Model\Quote\Address\RateRequest $reque $existing = $this->getExistingValidation($key); //SHQ16-1902 $validate = true; - if (is_array($existing)) { + if (is_array($existing) && count($existing) > 0) { if (isset($existing['key']) && $existing['key'] == $key) { $validate = false; } diff --git a/src/Plugin/Checkout/ShippingInformationPlugin.php b/src/Plugin/Checkout/ShippingInformationPlugin.php index 08df8a3a..74ef8dea 100644 --- a/src/Plugin/Checkout/ShippingInformationPlugin.php +++ b/src/Plugin/Checkout/ShippingInformationPlugin.php @@ -149,6 +149,7 @@ public function aroundSaveAddressInformation( $extAttributes = $addressInformation->getShippingAddress()->getExtensionAttributes(); //push out event so other modules can save their data - in future add carrier_group_id + //Observers add to additionalDetail object $this->eventManager->dispatch( 'shipperhq_additional_detail_checkout', ['address_extn_attributes' => $extAttributes, 'additional_detail'=> $additionalDetail, diff --git a/src/Plugin/Quote/ShippingMethodManagementPlugin.php b/src/Plugin/Quote/ShippingMethodManagementPlugin.php new file mode 100644 index 00000000..478df4d5 --- /dev/null +++ b/src/Plugin/Quote/ShippingMethodManagementPlugin.php @@ -0,0 +1,99 @@ +quoteRepository = $quoteRepository; + $this->shipperLogger = $shipperLogger; + $this->addressRepository = $addressRepository; + + } + + /** + *Add customers address type to shipping address on quote + * + * @param \Magento\Quote\Model\ShippingMethodManagement $subject + * @param callable $proceed + * @param $cartId + * @param int $addressId + * @return \Magento\Quote\Api\Data\ShippingMethodInterface[] + * + */ + public function aroundEstimateByAddressId(\Magento\Quote\Model\ShippingMethodManagement $subject, $proceed, $cartId, $addressId) + { + /** @var \Magento\Quote\Model\Quote $quote */ + $quote = $this->quoteRepository->getActive($cartId); + + // no methods applicable for empty carts or carts with virtual products + if ($quote->isVirtual() || 0 == $quote->getItemsCount()) { + return $proceed($cartId, $addressId); + } + $address = $this->addressRepository->getById($addressId); + + if($custom = $address->getCustomAttributes()) { + foreach ($custom as $custom_attribute) { + if($custom_attribute->getAttributeCode() == 'destination_type') { + $quote->getShippingAddress()->setData('destination_type', $custom_attribute->getValue()); + } elseif ($custom_attribute->getAttributeCode() == 'validation_status') { + $quote->getShippingAddress()->setData('validation_status', $custom_attribute->getValue()); + } + } + } + + return $proceed($cartId, $addressId); + } +} diff --git a/src/Setup/UpgradeData.php b/src/Setup/UpgradeData.php index 165dddc9..4c4d6833 100755 --- a/src/Setup/UpgradeData.php +++ b/src/Setup/UpgradeData.php @@ -108,7 +108,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $this->installAttributes($catalogSetup); } //v 1.0.3 - if ($context->getVersion() && version_compare($context->getVersion(), '1.0.3') < 0) { + if (version_compare($context->getVersion(), '1.0.3') < 0) { $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_availability_date', [ 'type' => 'datetime', 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime', @@ -134,7 +134,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]); $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); - if ($context->getVersion() && version_compare($context->getVersion(), '1.0.5') < 0) { + if (version_compare($context->getVersion(), '1.0.5') < 0) { $destinationTypeAttr = [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -192,7 +192,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface } //1.0.7 - if ($context->getVersion() && version_compare($context->getVersion(), '1.0.7') < 0) { + if (version_compare($context->getVersion(), '1.0.7') < 0) { $dispatchDateAttr = [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'visible' => false, diff --git a/src/etc/config.xml b/src/etc/config.xml index 30e3df33..bdbc2b57 100755 --- a/src/etc/config.xml +++ b/src/etc/config.xml @@ -56,7 +56,7 @@ This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us. 30 0 - 20.5.9 + #GIT_TAG# diff --git a/src/etc/di.xml b/src/etc/di.xml index 7716f9a3..df17b518 100755 --- a/src/etc/di.xml +++ b/src/etc/di.xml @@ -70,4 +70,10 @@ Magento\Checkout\Model\Session\Proxy + + + \ No newline at end of file