Skip to content

Commit ccf68bb

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #12905: [Backport #12666 into 2.3-develop] Fix incorrect DHL Product codes (by @gwharton) - #12896: Add product ID and SKU to wishlist customer data (by @jameshalsall)
2 parents ed0a849 + 4870115 commit ccf68bb

File tree

5 files changed

+93
-4
lines changed

5 files changed

+93
-4
lines changed

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ public function getDhlProducts($doc)
606606
'L' => __('Express 10:30'),
607607
'G' => __('Domestic economy select'),
608608
'W' => __('Economy select'),
609-
'I' => __('Break bulk economy'),
609+
'I' => __('Domestic express 9:00'),
610610
'N' => __('Domestic express'),
611611
'O' => __('Others'),
612612
'R' => __('Globalmail business'),
@@ -616,7 +616,7 @@ public function getDhlProducts($doc)
616616
];
617617

618618
$nonDocType = [
619-
'1' => __('Customer services'),
619+
'1' => __('Domestic express 12:00'),
620620
'3' => __('Easy shop'),
621621
'4' => __('Jetline'),
622622
'8' => __('Express easy'),

app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,4 +447,67 @@ public function requestToShipmentDataProvider()
447447
]
448448
];
449449
}
450+
451+
/**
452+
* @dataProvider dhlProductsDataProvider
453+
*
454+
* @param string $docType
455+
* @param array $products
456+
*/
457+
public function testGetDhlProducts(string $docType, array $products)
458+
{
459+
$this->assertEquals($products, $this->model->getDhlProducts($docType));
460+
}
461+
462+
/**
463+
* @return array
464+
*/
465+
public function dhlProductsDataProvider() : array
466+
{
467+
return [
468+
'doc' => [
469+
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_DOC,
470+
'products' => [
471+
'2' => 'Easy shop',
472+
'5' => 'Sprintline',
473+
'6' => 'Secureline',
474+
'7' => 'Express easy',
475+
'9' => 'Europack',
476+
'B' => 'Break bulk express',
477+
'C' => 'Medical express',
478+
'D' => 'Express worldwide',
479+
'U' => 'Express worldwide',
480+
'K' => 'Express 9:00',
481+
'L' => 'Express 10:30',
482+
'G' => 'Domestic economy select',
483+
'W' => 'Economy select',
484+
'I' => 'Domestic express 9:00',
485+
'N' => 'Domestic express',
486+
'O' => 'Others',
487+
'R' => 'Globalmail business',
488+
'S' => 'Same day',
489+
'T' => 'Express 12:00',
490+
'X' => 'Express envelope',
491+
]
492+
],
493+
'non-doc' => [
494+
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_NON_DOC,
495+
'products' => [
496+
'1' => 'Domestic express 12:00',
497+
'3' => 'Easy shop',
498+
'4' => 'Jetline',
499+
'8' => 'Express easy',
500+
'P' => 'Express worldwide',
501+
'Q' => 'Medical express',
502+
'E' => 'Express 9:00',
503+
'F' => 'Freight worldwide',
504+
'H' => 'Economy select',
505+
'J' => 'Jumbo box',
506+
'M' => 'Express 10:30',
507+
'V' => 'Europack',
508+
'Y' => 'Express 12:00',
509+
]
510+
]
511+
];
512+
}
450513
}

app/code/Magento/Dhl/i18n/en_US.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ Europack,Europack
2323
"Express 10:30","Express 10:30"
2424
"Domestic economy select","Domestic economy select"
2525
"Economy select","Economy select"
26-
"Break bulk economy","Break bulk economy"
2726
"Domestic express","Domestic express"
2827
Others,Others
2928
"Globalmail business","Globalmail business"
3029
"Same day","Same day"
3130
"Express 12:00","Express 12:00"
3231
"Express envelope","Express envelope"
33-
"Customer services","Customer services"
3432
Jetline,Jetline
3533
"Freight worldwide","Freight worldwide"
3634
"Jumbo box","Jumbo box"
@@ -81,3 +79,5 @@ Size,Size
8179
"Show Method if Not Applicable","Show Method if Not Applicable"
8280
"Sort Order","Sort Order"
8381
Debug,Debug
82+
"Domestic express 9:00","Domestic express 9:00"
83+
"Domestic express 12:00","Domestic express 12:00"

app/code/Magento/Wishlist/CustomerData/Wishlist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
123123
$product = $wishlistItem->getProduct();
124124
return [
125125
'image' => $this->getImageData($product),
126+
'product_sku' => $product->getSku(),
127+
'product_id' => $product->getId(),
126128
'product_url' => $this->wishlistHelper->getProductUrl($wishlistItem),
127129
'product_name' => $product->getName(),
128130
'product_price' => $this->block->getProductPriceHtml(

app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public function testGetSectionData()
7777
$imageLabel = 'image_label';
7878
$imageWidth = 'image_width';
7979
$imageHeight = 'image_height';
80+
$productSku = 'product_sku';
81+
$productId = 'product_id';
8082
$productUrl = 'product_url';
8183
$productName = 'product_name';
8284
$productPrice = 'product_price';
@@ -97,6 +99,8 @@ public function testGetSectionData()
9799
'width' => $imageWidth,
98100
'height' => $imageHeight,
99101
],
102+
'product_sku' => $productSku,
103+
'product_id' => $productId,
100104
'product_url' => $productUrl,
101105
'product_name' => $productName,
102106
'product_price' => $productPrice,
@@ -186,6 +190,12 @@ public function testGetSectionData()
186190
->with($itemMock, [])
187191
->willReturn($productUrl);
188192

193+
$productMock->expects($this->once())
194+
->method('getSku')
195+
->willReturn($productSku);
196+
$productMock->expects($this->once())
197+
->method('getId')
198+
->willReturn($productId);
189199
$productMock->expects($this->once())
190200
->method('getName')
191201
->willReturn($productName);
@@ -246,6 +256,8 @@ public function testGetSectionDataWithTwoItems()
246256
$imageLabel = 'image_label';
247257
$imageWidth = 'image_width';
248258
$imageHeight = 'image_height';
259+
$productSku = 'product_sku';
260+
$productId = 'product_id';
249261
$productUrl = 'product_url';
250262
$productName = 'product_name';
251263
$productPrice = 'product_price';
@@ -272,6 +284,8 @@ public function testGetSectionDataWithTwoItems()
272284
'width' => $imageWidth,
273285
'height' => $imageHeight,
274286
],
287+
'product_sku' => $productSku,
288+
'product_id' => $productId,
275289
'product_url' => $productUrl,
276290
'product_name' => $productName,
277291
'product_price' => $productPrice,
@@ -288,6 +302,8 @@ public function testGetSectionDataWithTwoItems()
288302
'width' => $imageWidth,
289303
'height' => $imageHeight,
290304
],
305+
'product_sku' => $productSku,
306+
'product_id' => $productId,
291307
'product_url' => $productUrl,
292308
'product_name' => $productName,
293309
'product_price' => $productPrice,
@@ -375,6 +391,14 @@ public function testGetSectionDataWithTwoItems()
375391
->method('getName')
376392
->willReturn($productName);
377393

394+
$productMock->expects($this->exactly(2))
395+
->method('getId')
396+
->willReturn($productId);
397+
398+
$productMock->expects($this->exactly(2))
399+
->method('getSku')
400+
->willReturn($productSku);
401+
378402
$this->sidebarMock->expects($this->exactly(2))
379403
->method('getProductPriceHtml')
380404
->with(

0 commit comments

Comments
 (0)