From 0d27287bb8c3e2fc29414d65dba2a34ead0dd8ed Mon Sep 17 00:00:00 2001 From: James Halsall Date: Wed, 27 Dec 2017 16:43:10 +0000 Subject: [PATCH 1/2] Add product ID and SKU to wishlist customer data --- .../Wishlist/CustomerData/Wishlist.php | 2 ++ .../Test/Unit/CustomerData/WishlistTest.php | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/app/code/Magento/Wishlist/CustomerData/Wishlist.php b/app/code/Magento/Wishlist/CustomerData/Wishlist.php index 6933efc2aa540..14d651f43afdc 100644 --- a/app/code/Magento/Wishlist/CustomerData/Wishlist.php +++ b/app/code/Magento/Wishlist/CustomerData/Wishlist.php @@ -123,6 +123,8 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem) $product = $wishlistItem->getProduct(); return [ 'image' => $this->getImageData($product), + 'product_sku' => $product->getSku(), + 'product_id' => $product->getId(), 'product_url' => $this->wishlistHelper->getProductUrl($wishlistItem), 'product_name' => $product->getName(), 'product_price' => $this->block->getProductPriceHtml( diff --git a/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php b/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php index 9ecd58b44f0e5..be31cb8f8d0c5 100644 --- a/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php @@ -77,6 +77,8 @@ public function testGetSectionData() $imageLabel = 'image_label'; $imageWidth = 'image_width'; $imageHeight = 'image_height'; + $productSku = 'product_sku'; + $productId = 'product_id'; $productUrl = 'product_url'; $productName = 'product_name'; $productPrice = 'product_price'; @@ -97,6 +99,8 @@ public function testGetSectionData() 'width' => $imageWidth, 'height' => $imageHeight, ], + 'product_sku' => $productSku, + 'product_id' => $productId, 'product_url' => $productUrl, 'product_name' => $productName, 'product_price' => $productPrice, @@ -186,6 +190,12 @@ public function testGetSectionData() ->with($itemMock, []) ->willReturn($productUrl); + $productMock->expects($this->once()) + ->method('getSku') + ->willReturn($productSku); + $productMock->expects($this->once()) + ->method('getId') + ->willReturn($productId); $productMock->expects($this->once()) ->method('getName') ->willReturn($productName); @@ -246,6 +256,8 @@ public function testGetSectionDataWithTwoItems() $imageLabel = 'image_label'; $imageWidth = 'image_width'; $imageHeight = 'image_height'; + $productSku = 'product_sku'; + $productId = 'product_id'; $productUrl = 'product_url'; $productName = 'product_name'; $productPrice = 'product_price'; @@ -272,6 +284,8 @@ public function testGetSectionDataWithTwoItems() 'width' => $imageWidth, 'height' => $imageHeight, ], + 'product_sku' => $productSku, + 'product_id' => $productId, 'product_url' => $productUrl, 'product_name' => $productName, 'product_price' => $productPrice, @@ -288,6 +302,8 @@ public function testGetSectionDataWithTwoItems() 'width' => $imageWidth, 'height' => $imageHeight, ], + 'product_sku' => $productSku, + 'product_id' => $productId, 'product_url' => $productUrl, 'product_name' => $productName, 'product_price' => $productPrice, @@ -375,6 +391,14 @@ public function testGetSectionDataWithTwoItems() ->method('getName') ->willReturn($productName); + $productMock->expects($this->exactly(2)) + ->method('getId') + ->willReturn($productId); + + $productMock->expects($this->exactly(2)) + ->method('getSku') + ->willReturn($productSku); + $this->sidebarMock->expects($this->exactly(2)) ->method('getProductPriceHtml') ->with( From f3409beab826ef9a112ab77662a71948648e1105 Mon Sep 17 00:00:00 2001 From: gwharton Date: Thu, 28 Dec 2017 11:13:16 +0000 Subject: [PATCH 2/2] Updated Incorrect product codes in DHL module. Updated Incorrect product codes in DHL module. --- app/code/Magento/Dhl/Model/Carrier.php | 4 +- .../Dhl/Test/Unit/Model/CarrierTest.php | 63 +++++++++++++++++++ app/code/Magento/Dhl/i18n/en_US.csv | 4 +- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 45a97e2287827..9a26efee744d5 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -606,7 +606,7 @@ public function getDhlProducts($doc) 'L' => __('Express 10:30'), 'G' => __('Domestic economy select'), 'W' => __('Economy select'), - 'I' => __('Break bulk economy'), + 'I' => __('Domestic express 9:00'), 'N' => __('Domestic express'), 'O' => __('Others'), 'R' => __('Globalmail business'), @@ -616,7 +616,7 @@ public function getDhlProducts($doc) ]; $nonDocType = [ - '1' => __('Customer services'), + '1' => __('Domestic express 12:00'), '3' => __('Easy shop'), '4' => __('Jetline'), '8' => __('Express easy'), diff --git a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php index 0f0d784813dfc..6fa063d2c273b 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php @@ -447,4 +447,67 @@ public function requestToShipmentDataProvider() ] ]; } + + /** + * @dataProvider dhlProductsDataProvider + * + * @param string $docType + * @param array $products + */ + public function testGetDhlProducts(string $docType, array $products) + { + $this->assertEquals($products, $this->model->getDhlProducts($docType)); + } + + /** + * @return array + */ + public function dhlProductsDataProvider() : array + { + return [ + 'doc' => [ + 'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_DOC, + 'products' => [ + '2' => 'Easy shop', + '5' => 'Sprintline', + '6' => 'Secureline', + '7' => 'Express easy', + '9' => 'Europack', + 'B' => 'Break bulk express', + 'C' => 'Medical express', + 'D' => 'Express worldwide', + 'U' => 'Express worldwide', + 'K' => 'Express 9:00', + 'L' => 'Express 10:30', + 'G' => 'Domestic economy select', + 'W' => 'Economy select', + 'I' => 'Domestic express 9:00', + 'N' => 'Domestic express', + 'O' => 'Others', + 'R' => 'Globalmail business', + 'S' => 'Same day', + 'T' => 'Express 12:00', + 'X' => 'Express envelope', + ] + ], + 'non-doc' => [ + 'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_NON_DOC, + 'products' => [ + '1' => 'Domestic express 12:00', + '3' => 'Easy shop', + '4' => 'Jetline', + '8' => 'Express easy', + 'P' => 'Express worldwide', + 'Q' => 'Medical express', + 'E' => 'Express 9:00', + 'F' => 'Freight worldwide', + 'H' => 'Economy select', + 'J' => 'Jumbo box', + 'M' => 'Express 10:30', + 'V' => 'Europack', + 'Y' => 'Express 12:00', + ] + ] + ]; + } } diff --git a/app/code/Magento/Dhl/i18n/en_US.csv b/app/code/Magento/Dhl/i18n/en_US.csv index 90ec8b5f17a22..a5532c2cea963 100644 --- a/app/code/Magento/Dhl/i18n/en_US.csv +++ b/app/code/Magento/Dhl/i18n/en_US.csv @@ -23,14 +23,12 @@ Europack,Europack "Express 10:30","Express 10:30" "Domestic economy select","Domestic economy select" "Economy select","Economy select" -"Break bulk economy","Break bulk economy" "Domestic express","Domestic express" Others,Others "Globalmail business","Globalmail business" "Same day","Same day" "Express 12:00","Express 12:00" "Express envelope","Express envelope" -"Customer services","Customer services" Jetline,Jetline "Freight worldwide","Freight worldwide" "Jumbo box","Jumbo box" @@ -81,3 +79,5 @@ Size,Size "Show Method if Not Applicable","Show Method if Not Applicable" "Sort Order","Sort Order" Debug,Debug +"Domestic express 9:00","Domestic express 9:00" +"Domestic express 12:00","Domestic express 12:00"