Skip to content

Commit fcf9eed

Browse files
author
Lysenko Olexandr
authored
Merge pull request #3318 from magento-chaika/chaika_october2
[Chaika] Bugfixes
2 parents c515b40 + 1652246 commit fcf9eed

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

app/code/Magento/Catalog/view/frontend/web/js/product/provider.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
define([
77
'underscore',
8+
'jquery',
89
'mageUtils',
910
'uiElement',
1011
'Magento_Catalog/js/product/storage/storage-service',
11-
'Magento_Customer/js/customer-data'
12-
], function (_, utils, Element, storage, customerData) {
12+
'Magento_Customer/js/customer-data',
13+
'Magento_Catalog/js/product/view/product-ids-resolver'
14+
], function (_, $, utils, Element, storage, customerData, productResolver) {
1315
'use strict';
1416

1517
return Element.extend({
@@ -135,11 +137,16 @@ define([
135137
*/
136138
filterIds: function (ids) {
137139
var _ids = {},
138-
currentTime = new Date().getTime() / 1000;
140+
currentTime = new Date().getTime() / 1000,
141+
currentProductIds = productResolver($('#product_addtocart_form'));
139142

140143
_.each(ids, function (id) {
141-
if (currentTime - id['added_at'] < ~~this.idsStorage.lifetime) {
144+
if (
145+
currentTime - id['added_at'] < ~~this.idsStorage.lifetime &&
146+
!_.contains(currentProductIds, id['product_id'])
147+
) {
142148
_ids[id['product_id']] = id;
149+
143150
}
144151
}, this);
145152

app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Review\Model\ResourceModel\Review\Product;
78

89
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
@@ -403,12 +404,20 @@ public function getAllIds($limit = null, $offset = null)
403404
public function getResultingIds()
404405
{
405406
$idsSelect = clone $this->getSelect();
406-
$idsSelect->reset(Select::LIMIT_COUNT);
407-
$idsSelect->reset(Select::LIMIT_OFFSET);
408-
$idsSelect->reset(Select::COLUMNS);
409-
$idsSelect->reset(Select::ORDER);
410-
$idsSelect->columns('rt.review_id');
411-
return $this->getConnection()->fetchCol($idsSelect);
407+
$data = $this->getConnection()
408+
->fetchAll(
409+
$idsSelect
410+
->reset(Select::LIMIT_COUNT)
411+
->reset(Select::LIMIT_OFFSET)
412+
->columns('rt.review_id')
413+
);
414+
415+
return array_map(
416+
function ($value) {
417+
return $value['review_id'];
418+
},
419+
$data
420+
);
412421
}
413422

414423
/**

0 commit comments

Comments
 (0)