Skip to content

Commit 4b1000a

Browse files
committed
Merge remote-tracking branch 'origin/AC10721' into AC10721April24
2 parents 04ab6f5 + 4aa21e0 commit 4b1000a

File tree

17 files changed

+1084
-1562
lines changed

17 files changed

+1084
-1562
lines changed

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3MediaGalleryDeleteFolderTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
deleted in S3 and in the local file system."/>
1818
<severity value="CRITICAL"/>
1919
<group value="remote_storage_aws_s3_media_gallery_ui"/>
20-
<skip>
21-
<issueId value="AC-11388">Excluding to make s3 backward compatible with flysystem lib</issueId>
22-
</skip>
2320
</annotations>
2421

2522
<before>

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3MediaGalleryDeleteImageTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
in S3 and in the local file system."/>
1818
<severity value="CRITICAL"/>
1919
<group value="remote_storage_aws_s3_media_gallery_ui"/>
20-
<skip>
21-
<issueId value="AC-11388">Excluding to make s3 backward compatible with flysystem lib</issueId>
22-
</skip>
2320
</annotations>
2421

2522
<before>

app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,9 +1912,7 @@ protected function _saveTitles(array $titles)
19121912
if (!isset($existingOptionIds[$optionId]) && count($storeInfo) > 0) {
19131913
$storeInfo = [Store::DEFAULT_STORE_ID => reset($storeInfo)] + $storeInfo;
19141914
}
1915-
//for use default
1916-
$uniqStoreInfo = array_unique($storeInfo);
1917-
foreach ($uniqStoreInfo as $storeId => $title) {
1915+
foreach ($storeInfo as $storeId => $title) {
19181916
$titleRows[] = ['option_id' => $optionId, 'store_id' => $storeId, 'title' => $title];
19191917
}
19201918
}

app/code/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function aroundAddFieldToFilter(
5555
}
5656
}
5757

58-
$fieldName = $subject->getConnection()->quoteIdentifier($field);
58+
$fieldName = $subject->getConnection()->quoteIdentifier('main_table.' . $field);
5959
$condition = $subject->getConnection()->prepareSqlCondition($fieldName, $condition);
6060
$subject->getSelect()->where($condition, null, Select::TYPE_CONDITION);
6161

app/code/Magento/Sales/etc/adminhtml/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</arguments>
5050
<plugin name="orderGridExportFilterColumnPlugin" type="Magento\Sales\Plugin\Model\Export\OrderGridExportFilterColumn"/>
5151
</type>
52-
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
52+
<type name="Magento\Sales\Model\ResourceModel\Order\Grid\Collection">
5353
<plugin name="orderGridCollectionFilterPlugin" type="Magento\Sales\Plugin\Model\ResourceModel\Order\OrderGridCollectionFilter"/>
5454
</type>
5555
<type name="Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\DataProvider\ProductCollection">

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Catalog\Model\Product\Image\NotLoadInfoImageException;
99
use Magento\Customer\CustomerData\SectionSourceInterface;
1010
use Magento\Framework\App\ObjectManager;
11+
use Magento\Store\Model\StoreManagerInterface;
1112

1213
/**
1314
* Wishlist section
@@ -17,7 +18,7 @@ class Wishlist implements SectionSourceInterface
1718
/**
1819
* @var string
1920
*/
20-
const SIDEBAR_ITEMS_NUMBER = 3;
21+
public const SIDEBAR_ITEMS_NUMBER = 3;
2122

2223
/**
2324
* @var \Magento\Wishlist\Helper\Data
@@ -44,19 +45,26 @@ class Wishlist implements SectionSourceInterface
4445
*/
4546
private $itemResolver;
4647

48+
/**
49+
* @var StoreManagerInterface
50+
*/
51+
private $storeManager;
52+
4753
/**
4854
* @param \Magento\Wishlist\Helper\Data $wishlistHelper
4955
* @param \Magento\Wishlist\Block\Customer\Sidebar $block
5056
* @param \Magento\Catalog\Helper\ImageFactory $imageHelperFactory
5157
* @param \Magento\Framework\App\ViewInterface $view
5258
* @param \Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface|null $itemResolver
59+
* @param StoreManagerInterface|null $storeManager
5360
*/
5461
public function __construct(
5562
\Magento\Wishlist\Helper\Data $wishlistHelper,
5663
\Magento\Wishlist\Block\Customer\Sidebar $block,
5764
\Magento\Catalog\Helper\ImageFactory $imageHelperFactory,
5865
\Magento\Framework\App\ViewInterface $view,
59-
\Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface $itemResolver = null
66+
\Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface $itemResolver = null,
67+
StoreManagerInterface $storeManager = null
6068
) {
6169
$this->wishlistHelper = $wishlistHelper;
6270
$this->imageHelperFactory = $imageHelperFactory;
@@ -65,6 +73,7 @@ public function __construct(
6573
$this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(
6674
\Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface::class
6775
);
76+
$this->storeManager = $storeManager ?? ObjectManager::getInstance()->get(StoreManagerInterface::class);
6877
}
6978

7079
/**
@@ -76,6 +85,7 @@ public function getSectionData()
7685
return [
7786
'counter' => $counter,
7887
'items' => $counter ? $this->getItems() : [],
88+
'websiteId' => $this->storeManager->getWebsite()->getId()
7989
];
8090
}
8191

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

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Catalog\Model\Product\Type\AbstractType;
1616
use Magento\Framework\App\ViewInterface;
1717
use Magento\Framework\Pricing\Render;
18+
use Magento\Store\Model\StoreManagerInterface;
1819
use Magento\Wishlist\Block\Customer\Sidebar;
1920
use Magento\Wishlist\CustomerData\Wishlist;
2021
use Magento\Wishlist\CustomerData\Wishlist as WishlistModel;
@@ -23,6 +24,7 @@
2324
use Magento\Wishlist\Model\ResourceModel\Item\Collection;
2425
use PHPUnit\Framework\MockObject\MockObject;
2526
use PHPUnit\Framework\TestCase;
27+
use Magento\Store\Api\Data\WebsiteInterface;
2628

2729
/**
2830
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -47,6 +49,15 @@ class WishlistTest extends TestCase
4749
/** @var ImageBuilder|MockObject */
4850
private $itemResolver;
4951

52+
/** @var StoreManagerInterface|MockObject */
53+
private $storeManagerMock;
54+
55+
/** @var WebsiteInterface|MockObject */
56+
private $websiteMock;
57+
58+
/** @var ImageFactory|MockObject */
59+
private $imageHelperFactory;
60+
5061
protected function setUp(): void
5162
{
5263
$this->wishlistHelperMock = $this->getMockBuilder(Data::class)
@@ -61,24 +72,34 @@ protected function setUp(): void
6172
$this->catalogImageHelperMock = $this->getMockBuilder(Image::class)
6273
->disableOriginalConstructor()
6374
->getMock();
64-
$imageHelperFactory = $this->getMockBuilder(ImageFactory::class)
75+
$this->imageHelperFactory = $this->getMockBuilder(ImageFactory::class)
6576
->disableOriginalConstructor()
6677
->onlyMethods(['create'])
6778
->getMock();
68-
$imageHelperFactory->expects($this->any())
79+
$this->imageHelperFactory->expects($this->any())
6980
->method('create')
7081
->willReturn($this->catalogImageHelperMock);
7182

7283
$this->itemResolver = $this->createMock(
7384
ItemResolverInterface::class
7485
);
7586

87+
$this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)
88+
->disableOriginalConstructor()
89+
->getMockForAbstractClass();
90+
91+
$this->websiteMock = $this->getMockBuilder(WebsiteInterface::class)
92+
->onlyMethods(['getId',])
93+
->disableOriginalConstructor()
94+
->getMockForAbstractClass();
95+
7696
$this->model = new Wishlist(
7797
$this->wishlistHelperMock,
7898
$this->sidebarMock,
79-
$imageHelperFactory,
99+
$this->imageHelperFactory,
80100
$this->viewMock,
81-
$this->itemResolver
101+
$this->itemResolver,
102+
$this->storeManagerMock
82103
);
83104
}
84105

@@ -102,6 +123,14 @@ public function testGetSectionData()
102123
$itemAddParams = ['add_params'];
103124
$itemRemoveParams = ['remove_params'];
104125

126+
$this->storeManagerMock->expects($this->once())
127+
->method('getWebsite')
128+
->willReturn($this->websiteMock);
129+
130+
$this->websiteMock->expects($this->once())
131+
->method('getId')
132+
->willReturn(1);
133+
105134
$result = [
106135
'counter' => __('1 item'),
107136
'items' => [
@@ -124,6 +153,7 @@ public function testGetSectionData()
124153
'delete_item_params' => $itemRemoveParams,
125154
],
126155
],
156+
'websiteId' => 1
127157
];
128158

129159
/** @var Item|MockObject $itemMock */
@@ -288,6 +318,14 @@ public function testGetSectionDataWithTwoItems()
288318
->getMock();
289319
$items = [$itemMock, $itemMock];
290320

321+
$this->storeManagerMock->expects($this->once())
322+
->method('getWebsite')
323+
->willReturn($this->websiteMock);
324+
325+
$this->websiteMock->expects($this->once())
326+
->method('getId')
327+
->willReturn(1);
328+
291329
$result = [
292330
'counter' => __('%1 items', count($items)),
293331
'items' => [
@@ -328,6 +366,7 @@ public function testGetSectionDataWithTwoItems()
328366
'delete_item_params' => $itemRemoveParams,
329367
],
330368
],
369+
'websiteId' => 1
331370
];
332371

333372
$this->wishlistHelperMock->expects($this->once())
@@ -465,9 +504,18 @@ public function testGetSectionDataWithoutItems()
465504
{
466505
$items = [];
467506

507+
$this->storeManagerMock->expects($this->once())
508+
->method('getWebsite')
509+
->willReturn($this->websiteMock);
510+
511+
$this->websiteMock->expects($this->once())
512+
->method('getId')
513+
->willReturn(null);
514+
468515
$result = [
469516
'counter' => null,
470517
'items' => [],
518+
'websiteId' =>null
471519
];
472520

473521
$this->wishlistHelperMock->expects($this->once())

app/code/Magento/Wishlist/view/frontend/web/js/view/wishlist.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,32 @@
55

66
define([
77
'uiComponent',
8-
'Magento_Customer/js/customer-data'
9-
], function (Component, customerData) {
8+
'Magento_Customer/js/customer-data',
9+
'underscore'
10+
], function (Component, customerData, _) {
1011
'use strict';
1112

13+
var wishlistReloaded = false;
14+
1215
return Component.extend({
1316
/** @inheritdoc */
1417
initialize: function () {
1518
this._super();
16-
1719
this.wishlist = customerData.get('wishlist');
20+
if (!wishlistReloaded
21+
&& !_.isEmpty(this.wishlist())
22+
// Expired section names are reloaded on page load.
23+
&& _.indexOf(customerData.getExpiredSectionNames(), 'wishlist') === -1
24+
&& window.checkout
25+
&& window.checkout.websiteId
26+
&& window.checkout.websiteId !== this.wishlist().websiteId
27+
) {
28+
//set count to 0 to prevent "wishlist" blocks and count to show with wrong count and items
29+
this.wishlist().counter = 0;
30+
customerData.invalidate(['wishlist']);
31+
customerData.reload(['wishlist'], false);
32+
wishlistReloaded = true;
33+
}
1834
}
1935
});
2036
});

0 commit comments

Comments
 (0)