From f45f88223e3392804661da8c75e48758fdce5667 Mon Sep 17 00:00:00 2001 From: wsagen Date: Mon, 4 Jul 2016 20:14:38 +0800 Subject: [PATCH 1/4] SHQ16-636 --- composer.json | 2 +- src/Helper/CarrierGroup.php | 6 +-- src/Observer/AbstractRecordOrder.php | 16 +++++++ src/etc/fieldset.xml | 22 ++++++++++ .../adminhtml/layout/sales_order_view.xml | 16 +++++++ .../templates/order/view/items.phtml | 42 +++++++++++++++++++ 6 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 src/view/adminhtml/layout/sales_order_view.xml create mode 100644 src/view/adminhtml/templates/order/view/items.phtml diff --git a/composer.json b/composer.json index 5e5eccc8..93b4a9a9 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "shipperhq/module-shipper", "description": "Magento Shipping integration with ShipperHQ", "type": "magento2-module", - "version": "20.0.10", + "version": "20.0.11", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/src/Helper/CarrierGroup.php b/src/Helper/CarrierGroup.php index 2f157f42..6292cef6 100644 --- a/src/Helper/CarrierGroup.php +++ b/src/Helper/CarrierGroup.php @@ -76,12 +76,11 @@ public function saveCarrierGroupInformation($shippingAddress, $shippingMethod) if(array_key_exists('carrierGroupId', $shipDetails)) { $arrayofShipDetails = []; $arrayofShipDetails[] = $shipDetails; - - $encodedShipDetails = $this->shipperDataHelper->encode($arrayofShipDetails); } else { - $encodedShipDetails = $this->shipperDataHelper->encode($shipDetails); + $arrayofShipDetails = $shipDetails; } + $encodedShipDetails = $this->shipperDataHelper->encode($arrayofShipDetails); $shippingAddress ->setCarrierId($foundRate->getCarrierId()) @@ -96,6 +95,7 @@ public function saveCarrierGroupInformation($shippingAddress, $shippingMethod) $carrierGroupDetail->setData($update); $carrierGroupDetail->save(); //save selected shipping options to items + $this->shipperDataHelper->setShippingOnItems($arrayofShipDetails, $shippingAddress); } return true; } diff --git a/src/Observer/AbstractRecordOrder.php b/src/Observer/AbstractRecordOrder.php index 96bcbd1a..8ad9a510 100644 --- a/src/Observer/AbstractRecordOrder.php +++ b/src/Observer/AbstractRecordOrder.php @@ -110,6 +110,7 @@ protected function recordOrder($order) $shippingAddress = $quote->getShippingAddress(); $carrierType = $shippingAddress->getCarrierType(); $order->setCarrierType($carrierType); + $this->recordOrderItems($order, $quote); if(strstr($order->getCarrierType(), 'shqshared_')) { $original = $order->getCarrierType(); $carrierTypeArray = explode('_', $order->getCarrierType()); @@ -144,5 +145,20 @@ protected function recordOrder($order) } } } + + protected function recordOrderItems($order, $quote) + { + foreach($order->getAllItems() as $orderItem) { + foreach($quote->getAllItems() as $quoteItem) { + if($quoteItem->getId() == $orderItem->getQuoteItemId()) { + $orderItem->setCarriergroupId($quoteItem->getCarriergroupId()); + $orderItem->setCarriergroup($quoteItem->getCarriergroup()); + $orderItem->setCarriergroupShipping($quoteItem->getCarriergroupShipping()); + $orderItem->save(); + } + } + + } + } } diff --git a/src/etc/fieldset.xml b/src/etc/fieldset.xml index f55b2010..035686a7 100644 --- a/src/etc/fieldset.xml +++ b/src/etc/fieldset.xml @@ -24,5 +24,27 @@ +
+ + + + + + + + + +
+
+ + + + + + + + + +
diff --git a/src/view/adminhtml/layout/sales_order_view.xml b/src/view/adminhtml/layout/sales_order_view.xml new file mode 100644 index 00000000..d93d1fbc --- /dev/null +++ b/src/view/adminhtml/layout/sales_order_view.xml @@ -0,0 +1,16 @@ + + + + + + + + + ShipperHQ_Shipper::order/view/items.phtml + + + + + + + \ No newline at end of file diff --git a/src/view/adminhtml/templates/order/view/items.phtml b/src/view/adminhtml/templates/order/view/items.phtml new file mode 100644 index 00000000..66351776 --- /dev/null +++ b/src/view/adminhtml/templates/order/view/items.phtml @@ -0,0 +1,42 @@ + +getOrder() ?> +
+ + + + + + + + + + + + + + + + + + getItemsCollection();?> + + getParentItem()) { + continue; + } else { + $i++; + }?> + + getItemHtml($_item) ?> + getItemExtraInfoHtml($_item) ?> + + +
+
From d31e3ec4883e239c559f03fb64692514745e16d7 Mon Sep 17 00:00:00 2001 From: wsagen Date: Tue, 5 Jul 2016 10:20:19 +0800 Subject: [PATCH 2/4] SHQ16-636 removed layout for now --- .../adminhtml/layout/sales_order_view.xml | 16 ------- .../templates/order/view/items.phtml | 42 ------------------- 2 files changed, 58 deletions(-) delete mode 100644 src/view/adminhtml/layout/sales_order_view.xml delete mode 100644 src/view/adminhtml/templates/order/view/items.phtml diff --git a/src/view/adminhtml/layout/sales_order_view.xml b/src/view/adminhtml/layout/sales_order_view.xml deleted file mode 100644 index d93d1fbc..00000000 --- a/src/view/adminhtml/layout/sales_order_view.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - ShipperHQ_Shipper::order/view/items.phtml - - - - - - - \ No newline at end of file diff --git a/src/view/adminhtml/templates/order/view/items.phtml b/src/view/adminhtml/templates/order/view/items.phtml deleted file mode 100644 index 66351776..00000000 --- a/src/view/adminhtml/templates/order/view/items.phtml +++ /dev/null @@ -1,42 +0,0 @@ - -getOrder() ?> -
- - - - - - - - - - - - - - - - - - getItemsCollection();?> - - getParentItem()) { - continue; - } else { - $i++; - }?> - - getItemHtml($_item) ?> - getItemExtraInfoHtml($_item) ?> - - -
-
From a684ac6e7e00874e552e58735f79215866ca3258 Mon Sep 17 00:00:00 2001 From: wsagen Date: Tue, 5 Jul 2016 10:34:38 +0800 Subject: [PATCH 3/4] SHQ16-636 increment setup version to force run of update scripts --- src/etc/module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/module.xml b/src/etc/module.xml index bddd09e4..c78fdfc1 100755 --- a/src/etc/module.xml +++ b/src/etc/module.xml @@ -34,7 +34,7 @@ */ --> - + From a87971c92901d7796a7a79fdb827c911db849ed7 Mon Sep 17 00:00:00 2001 From: wsagen Date: Tue, 5 Jul 2016 10:36:50 +0800 Subject: [PATCH 4/4] SHQ16-636 record item level carrier group detail --- CHANGELOG.MD | 6 +++++- src/etc/config.xml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 80b39c02..f3e5d0f7 100755 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -51,4 +51,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - SHQ16-1066 - shipping method filtering in shopping cart promotions - SHQ16-1031 - single carrier list shipping logic for admin orders - SHQ16-1189 - carrier validation for all address fields -- SHQ16-1201 - Upgrade data script changes and attribute synch ignore empty value \ No newline at end of file +- SHQ16-1201 - Upgrade data script changes and attribute synch ignore empty value + +## [20.0.13] - 2016-07-05 +### Added +- SHQ16-636 - record item level carrier group detail \ No newline at end of file diff --git a/src/etc/config.xml b/src/etc/config.xml index eae05564..a7363fca 100755 --- a/src/etc/config.xml +++ b/src/etc/config.xml @@ -55,7 +55,7 @@ This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us. 120 0 - 20.0.12 + 20.0.13