Skip to content

Commit 9897ef6

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - magento-engcom/magento2ce#1297: [EngCom Team] Batch 12. Forwardports to 2.3-develop (by @magento-engcom-team) - magento-engcom/magento2ce#1289: [EngCom Team] Batch 7. Forwardports to 2.3-develop (by @magento-engcom-team) Fixed GitHub Issues: - #7241: No option to start with blank option for prefix and suffix in checkout. (reported by @spyrule) has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch Related commits: 1. 21cfb6a 2. d173193 3. b5a4ee4 4. f6570bd 5. b32bdc9 6. 3c6d9be 7. d4c7ca0 8. 07fa73a 9. 60426c6 10. 14f85e9 11. 72b3991 12. 5483dc7 13. f442a76 14. af9f7cb 15. 8b4ad90 16. 9354bb9 17. 9c9ed91 18. 4a422f6 19. b6473f6 20. 0c12a7a - #11946: Layer navigation showing wrong product count (reported by @sunilit42) has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch Related commits: 1. 21cfb6a 2. d173193 3. b5a4ee4 4. f6570bd 5. b32bdc9 6. 3c6d9be 7. d4c7ca0 8. 07fa73a 9. 60426c6 10. 14f85e9 11. 72b3991 12. 5483dc7 13. f442a76 14. af9f7cb 15. 8b4ad90 16. 9354bb9 17. 9c9ed91 18. 4a422f6 19. b6473f6 20. 0c12a7a - #12206: Tracking link returns 404 page in admin panel (reported by @catstantin) has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch Related commits: 1. 21cfb6a 2. d173193 3. b5a4ee4 4. f6570bd 5. b32bdc9 6. 3c6d9be 7. d4c7ca0 8. 07fa73a 9. 60426c6 10. 14f85e9 11. 72b3991 12. 5483dc7 13. f442a76 14. af9f7cb 15. 8b4ad90 16. 9354bb9 17. 9c9ed91 18. 4a422f6 19. b6473f6 20. 0c12a7a - #12506: Fixup typo getDispretionPath -> getDispersionPath (reported by @PascalBrouwers) has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch Related commits: 1. 21cfb6a 2. d173193 3. b5a4ee4 4. f6570bd 5. b32bdc9 6. 3c6d9be 7. d4c7ca0 8. 07fa73a 9. 60426c6 10. 14f85e9 11. 72b3991 12. 5483dc7 13. f442a76 14. af9f7cb 15. 8b4ad90 16. 9354bb9 17. 9c9ed91 18. 4a422f6 19. b6473f6 20. 0c12a7a - #12632: Magento Connect no longer exist (reported by @miguelbalparda) has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch Related commits: 1. 21cfb6a 2. d173193 3. b5a4ee4 4. f6570bd 5. b32bdc9 6. 3c6d9be 7. d4c7ca0 8. 07fa73a 9. 60426c6 10. 14f85e9 11. 72b3991 12. 5483dc7 13. f442a76 14. af9f7cb 15. 8b4ad90 16. 9354bb9 17. 9c9ed91 18. 4a422f6 19. b6473f6 20. 0c12a7a - #12713: Currency symbol overlaps entered attribute option's price while creating Configurable Product (reported by @alena-marchenko) has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch Related commits: 1. 21cfb6a 2. d173193 3. b5a4ee4 4. f6570bd 5. b32bdc9 6. 3c6d9be 7. d4c7ca0 8. 07fa73a 9. 60426c6 10. 14f85e9 11. 72b3991 12. 5483dc7 13. f442a76 14. af9f7cb 15. 8b4ad90 16. 9354bb9 17. 9c9ed91 18. 4a422f6 19. b6473f6 20. 0c12a7a - #3596: Notice: Undefined index: value in /app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php on line 72 (reported by @gnusmus) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05 - #10014: Newsletter subscriptions status not isolated between multi stores (reported by @mikelevy300) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05 - #10477: Cart price rule has failed if use dropdown attribute (reported by @minosss) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05 - #10628: Color attribute swatches are not visible if sorting is enabled (reported by @akashkarev) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05 - #11140: Going to '/admin' while using storecodes in url and a different adminhtml url will throw exception (reported by @koenner01) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05 - #11532: Duplicate Simple Product Throws Error: Undefined offset: 0 in SaveHandler.php on line 122 (reported by @lee586) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05 - #11832: Create order (on Customer edit page) - not working from admin environment (reported by @psbhanu) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05 - #11941: Invoice for products that use qty decimal rounds down to whole number (reported by @ralbin) has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch Related commits: 1. b415941 2. 7369261 3. dce1c66 4. 95ed67e 5. 05fcdd1 6. 8b1a297 7. 90addb7 8. d5c9eef 9. 6ec6271 10. f0af87e 11. 2497062 12. 1f7347f 13. 0d151c4 14. 07982fd 15. 617da6c 16. 39ed21f 17. 9aa036d 18. fda37ef 19. 47b1091 20. ef6bada 21. 809ec05
2 parents ca1a5de + 469a283 commit 9897ef6

File tree

52 files changed

+1281
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1281
-191
lines changed

app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ private function mergeCategoryLinks($newCategoryPositions, $oldCategoryPositions
119119

120120
if ($key === false) {
121121
$result[] = $newCategoryPosition;
122-
} elseif ($oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']) {
122+
} elseif (isset($oldCategoryPositions[$key])
123+
&& $oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']
124+
) {
123125
$result[] = $newCategoryPositions[$key];
124126
unset($oldCategoryPositions[$key]);
125127
}

app/code/Magento/Catalog/Model/Product/Gallery/Processor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function addImage(
149149
}
150150

151151
$fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($pathinfo['basename']);
152-
$dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName);
152+
$dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName);
153153
$fileName = $dispretionPath . '/' . $fileName;
154154

155155
$fileName = $this->getNotDuplicatedFilename($fileName, $dispretionPath);

app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function validate($processingParams, $option)
150150
$extension = pathinfo(strtolower($fileInfo['name']), PATHINFO_EXTENSION);
151151

152152
$fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($fileInfo['name']);
153-
$dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName);
153+
$dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName);
154154

155155
$filePath = $dispersion;
156156

app/code/Magento/Catalog/Model/ResourceModel/Config.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ public function getAttributesUsedForSortBy()
149149
['main_table' => $this->getTable('eav_attribute')]
150150
)->join(
151151
['additional_table' => $this->getTable('catalog_eav_attribute')],
152-
'main_table.attribute_id = additional_table.attribute_id',
153-
[]
152+
'main_table.attribute_id = additional_table.attribute_id'
154153
)->joinLeft(
155154
['al' => $this->getTable('eav_attribute_label')],
156155
'al.attribute_id = main_table.attribute_id AND al.store_id = ' . $this->getStoreId(),

app/code/Magento/Catalog/Test/Unit/Model/Category/Link/SaveHandlerTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,21 @@ public function getCategoryDataProvider()
197197
],
198198
[], //affected category_ids
199199
],
200+
[
201+
[3], //model category_ids
202+
[
203+
['category_id' => 3, 'position' => 20],
204+
['category_id' => 4, 'position' => 30],
205+
], // dto category links
206+
[
207+
['category_id' => 3, 'position' => 10],
208+
],
209+
[
210+
['category_id' => 3, 'position' => 20],
211+
['category_id' => 4, 'position' => 30],
212+
],
213+
[3, 4], //affected category_ids
214+
],
200215
];
201216
}
202217

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\Unit\Model\ResourceModel;
8+
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
10+
11+
/**
12+
* Test for Magento\Catalog\Model\ResourceModel\Config
13+
*/
14+
class ConfigTest extends \PHPUnit\Framework\TestCase
15+
{
16+
/**
17+
* @var \Magento\Catalog\Model\ResourceModel\Config
18+
*/
19+
private $model;
20+
21+
/**
22+
* @var \PHPUnit_Framework_MockObject_MockObject
23+
*/
24+
private $resource;
25+
26+
/**
27+
* @var \PHPUnit_Framework_MockObject_MockObject
28+
*/
29+
private $storeManager;
30+
31+
/**
32+
* @var \PHPUnit_Framework_MockObject_MockObject
33+
*/
34+
private $eavConfig;
35+
36+
protected function setUp()
37+
{
38+
$objectManager = new ObjectManager($this);
39+
40+
$this->resource = $this->createMock(\Magento\Framework\App\ResourceConnection::class);
41+
$this->storeManager = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class);
42+
$this->eavConfig = $this->createMock(\Magento\Eav\Model\Config::class);
43+
44+
$this->model = $objectManager->getObject(
45+
\Magento\Catalog\Model\ResourceModel\Config::class,
46+
[
47+
'resource' => $this->resource,
48+
'storeManager' => $this->storeManager,
49+
'eavConfig' => $this->eavConfig,
50+
]
51+
);
52+
53+
parent::setUp();
54+
}
55+
56+
public function testGetAttributesUsedForSortBy()
57+
{
58+
$expression = 'someExpression';
59+
$storeId = 1;
60+
$entityTypeId = 4;
61+
62+
$connectionMock = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class);
63+
$selectMock = $this->createMock(\Magento\Framework\DB\Select::class);
64+
$storeMock = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class);
65+
$entityTypeMock = $this->createMock(\Magento\Eav\Model\Entity\Type::class);
66+
67+
$this->resource->expects($this->atLeastOnce())->method('getConnection')->willReturn($connectionMock);
68+
69+
$connectionMock->expects($this->once())->method('getCheckSql')
70+
->with('al.value IS NULL', 'main_table.frontend_label', 'al.value')
71+
->willReturn($expression);
72+
$connectionMock->expects($this->atLeastOnce())->method('select')->willReturn($selectMock);
73+
74+
$this->resource->expects($this->exactly(3))->method('getTableName')->withConsecutive(
75+
['eav_attribute'],
76+
['catalog_eav_attribute'],
77+
['eav_attribute_label']
78+
)->willReturnOnConsecutiveCalls('eav_attribute', 'catalog_eav_attribute', 'eav_attribute_label');
79+
80+
$this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock);
81+
$storeMock->expects($this->once())->method('getId')->willReturn($storeId);
82+
83+
$this->eavConfig->expects($this->once())->method('getEntityType')->willReturn($entityTypeMock);
84+
$entityTypeMock->expects($this->once())->method('getId')->willReturn($entityTypeId);
85+
86+
$selectMock->expects($this->once())->method('from')
87+
->with(['main_table' => 'eav_attribute'])->willReturn($selectMock);
88+
$selectMock->expects($this->once())->method('join')->with(
89+
['additional_table' => 'catalog_eav_attribute'],
90+
'main_table.attribute_id = additional_table.attribute_id'
91+
)->willReturn($selectMock);
92+
$selectMock->expects($this->once())->method('joinLeft')
93+
->with(
94+
['al' => 'eav_attribute_label'],
95+
'al.attribute_id = main_table.attribute_id AND al.store_id = ' . $storeId,
96+
['store_label' => $expression]
97+
)->willReturn($selectMock);
98+
$selectMock->expects($this->exactly(2))->method('where')->withConsecutive(
99+
['main_table.entity_type_id = ?', $entityTypeId],
100+
['additional_table.used_for_sort_by = ?', 1]
101+
)->willReturn($selectMock);
102+
103+
$connectionMock->expects($this->once())->method('fetchAll')->with($selectMock);
104+
105+
$this->model->getAttributesUsedForSortBy();
106+
}
107+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CatalogInventory\Observer;
8+
9+
use Magento\Catalog\Model\Product;
10+
use Magento\Catalog\Model\ResourceModel\Product\Collection;
11+
use Magento\CatalogInventory\Api\StockConfigurationInterface;
12+
use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory;
13+
use Magento\CatalogInventory\Api\StockItemRepositoryInterface;
14+
use Magento\Framework\Event\Observer;
15+
use Magento\Framework\Event\ObserverInterface;
16+
17+
/**
18+
* Add Stock items to product collection.
19+
*/
20+
class AddStockItemsObserver implements ObserverInterface
21+
{
22+
/**
23+
* @var StockItemCriteriaInterfaceFactory
24+
*/
25+
private $criteriaInterfaceFactory;
26+
27+
/**
28+
* @var StockItemRepositoryInterface
29+
*/
30+
private $stockItemRepository;
31+
32+
/**
33+
* @var StockConfigurationInterface
34+
*/
35+
private $stockConfiguration;
36+
37+
/**
38+
* AddStockItemsObserver constructor.
39+
*
40+
* @param StockItemCriteriaInterfaceFactory $criteriaInterfaceFactory
41+
* @param StockItemRepositoryInterface $stockItemRepository
42+
* @param StockConfigurationInterface $stockConfiguration
43+
*/
44+
public function __construct(
45+
StockItemCriteriaInterfaceFactory $criteriaInterfaceFactory,
46+
StockItemRepositoryInterface $stockItemRepository,
47+
StockConfigurationInterface $stockConfiguration
48+
) {
49+
$this->criteriaInterfaceFactory = $criteriaInterfaceFactory;
50+
$this->stockItemRepository = $stockItemRepository;
51+
$this->stockConfiguration = $stockConfiguration;
52+
}
53+
54+
/**
55+
* Add stock items to products in collection.
56+
*
57+
* @param Observer $observer
58+
* @return void
59+
*/
60+
public function execute(Observer $observer)
61+
{
62+
/** @var Collection $productCollection */
63+
$productCollection = $observer->getData('collection');
64+
$productIds = array_keys($productCollection->getItems());
65+
$criteria = $this->criteriaInterfaceFactory->create();
66+
$criteria->setProductsFilter($productIds);
67+
$criteria->setScopeFilter($this->stockConfiguration->getDefaultScopeId());
68+
$stockItemCollection = $this->stockItemRepository->getList($criteria);
69+
foreach ($stockItemCollection->getItems() as $item) {
70+
/** @var Product $product */
71+
$product = $productCollection->getItemById($item->getProductId());
72+
$productExtension = $product->getExtensionAttributes();
73+
$productExtension->setStockItem($item);
74+
$product->setExtensionAttributes($productExtension);
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)