Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit b1e26d5

Browse files
authored
Merge pull request #3469 from magento-tsg/2.2-develop-pr58
[TSG] Backporting for 2.2 (pr58) (2.2.8)
2 parents d3dcc9d + 4ef6d0b commit b1e26d5

File tree

8 files changed

+56
-45
lines changed

8 files changed

+56
-45
lines changed

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,11 @@ public function getSku($product)
310310
$selectionIds = $this->serializer->unserialize($customOption->getValue());
311311
if (!empty($selectionIds)) {
312312
$selections = $this->getSelectionsByIds($selectionIds, $product);
313-
foreach ($selections->getItems() as $selection) {
314-
$skuParts[] = $selection->getSku();
313+
foreach ($selectionIds as $selectionId) {
314+
$entity = $selections->getItemByColumnValue('selection_id', $selectionId);
315+
if (isset($entity) && $entity->getEntityId()) {
316+
$skuParts[] = $entity->getSku();
317+
}
315318
}
316319
}
317320
}

app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ public function testGetSkuWithoutType()
15951595
->disableOriginalConstructor()
15961596
->getMock();
15971597
$selectionItemMock = $this->getMockBuilder(\Magento\Framework\DataObject::class)
1598-
->setMethods(['getSku', '__wakeup'])
1598+
->setMethods(['getSku', 'getEntityId', '__wakeup'])
15991599
->disableOriginalConstructor()
16001600
->getMock();
16011601

@@ -1623,9 +1623,12 @@ public function testGetSkuWithoutType()
16231623
->will($this->returnValue($serializeIds));
16241624
$selectionMock = $this->getSelectionsByIdsMock($selectionIds, $productMock, 5, 6);
16251625
$selectionMock->expects(($this->any()))
1626-
->method('getItems')
1627-
->will($this->returnValue([$selectionItemMock]));
1628-
$selectionItemMock->expects($this->any())
1626+
->method('getItemByColumnValue')
1627+
->will($this->returnValue($selectionItemMock));
1628+
$selectionItemMock->expects($this->at(0))
1629+
->method('getEntityId')
1630+
->will($this->returnValue(1));
1631+
$selectionItemMock->expects($this->once())
16291632
->method('getSku')
16301633
->will($this->returnValue($itemSku));
16311634

app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ abstract class AbstractAction
126126
*/
127127
private $queryGenerator;
128128

129+
/**
130+
* Current store id.
131+
* @var int
132+
*/
133+
private $currentStoreId = 0;
134+
129135
/**
130136
* @param ResourceConnection $resource
131137
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -167,6 +173,7 @@ protected function reindex()
167173
{
168174
foreach ($this->storeManager->getStores() as $store) {
169175
if ($this->getPathFromCategoryId($store->getRootCategoryId())) {
176+
$this->currentStoreId = $store->getId();
170177
$this->reindexRootCategory($store);
171178
$this->reindexAnchorCategories($store);
172179
$this->reindexNonAnchorCategories($store);
@@ -594,7 +601,7 @@ protected function getTemporaryTreeIndexTableName()
594601
if (empty($this->tempTreeIndexTableName)) {
595602
$this->tempTreeIndexTableName = $this->connection->getTableName('temp_catalog_category_tree_index')
596603
. '_'
597-
. substr(md5(time() . random_int(0, 999999999)), 0, 8);
604+
. substr(sha1(time() . random_int(0, 999999999)), 0, 8);
598605
}
599606

600607
return $this->tempTreeIndexTableName;
@@ -649,30 +656,47 @@ protected function makeTempCategoryTreeIndex()
649656
}
650657

651658
/**
652-
* Populate the temporary category tree index table
659+
* Populate the temporary category tree index table.
653660
*
654661
* @param string $temporaryName
662+
* @return void
655663
* @since 101.0.0
656664
*/
657665
protected function fillTempCategoryTreeIndex($temporaryName)
658666
{
659-
$offset = 0;
660-
$limit = 500;
661-
662-
$categoryTable = $this->getTable('catalog_category_entity');
663-
664-
$categoriesSelect = $this->connection->select()
665-
->from(
666-
['c' => $categoryTable],
667-
['entity_id', 'path']
668-
)->limit($limit, $offset);
669-
670-
$categories = $this->connection->fetchAll($categoriesSelect);
667+
$isActiveAttributeId = $this->config->getAttribute(
668+
\Magento\Catalog\Model\Category::ENTITY,
669+
'is_active'
670+
)->getId();
671+
$categoryMetadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\CategoryInterface::class);
672+
$categoryLinkField = $categoryMetadata->getLinkField();
673+
$selects = $this->prepareSelectsByRange(
674+
$this->connection->select()
675+
->from(
676+
['c' => $this->getTable('catalog_category_entity')],
677+
['entity_id', 'path']
678+
)->joinInner(
679+
['ccacd' => $this->getTable('catalog_category_entity_int')],
680+
'ccacd.' . $categoryLinkField . ' = c.' . $categoryLinkField
681+
. ' AND ccacd.store_id = 0' . ' AND ccacd.attribute_id = ' . $isActiveAttributeId,
682+
[]
683+
)->joinLeft(
684+
['ccacs' => $this->getTable('catalog_category_entity_int')],
685+
'ccacs.' . $categoryLinkField . ' = c.' . $categoryLinkField
686+
. ' AND ccacs.attribute_id = ccacd.attribute_id AND ccacs.store_id = '
687+
. $this->currentStoreId,
688+
[]
689+
)->where(
690+
$this->connection->getIfNullSql('ccacs.value', 'ccacd.value') . ' = ?',
691+
1
692+
),
693+
'entity_id'
694+
);
671695

672-
while ($categories) {
696+
foreach ($selects as $select) {
673697
$values = [];
674698

675-
foreach ($categories as $category) {
699+
foreach ($this->connection->fetchAll($select) as $category) {
676700
foreach (explode('/', $category['path']) as $parentId) {
677701
if ($parentId !== $category['entity_id']) {
678702
$values[] = [$parentId, $category['entity_id']];
@@ -683,15 +707,6 @@ protected function fillTempCategoryTreeIndex($temporaryName)
683707
if (count($values) > 0) {
684708
$this->connection->insertArray($temporaryName, ['parent_id', 'child_id'], $values);
685709
}
686-
687-
$offset += $limit;
688-
$categoriesSelect = $this->connection->select()
689-
->from(
690-
['c' => $categoryTable],
691-
['entity_id', 'path']
692-
)->limit($limit, $offset);
693-
694-
$categories = $this->connection->fetchAll($categoriesSelect);
695710
}
696711
}
697712

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function setUp()
6767
'isLockedAttribute'
6868
])->getMockForAbstractClass();
6969
$this->storeMock = $this->getMockBuilder(StoreInterface::class)
70-
->setMethods(['load', 'getId', 'getConfig'])
70+
->setMethods(['load', 'getId', 'getConfig', 'getBaseCurrency', 'getBaseCurrencyCode'])
7171
->getMockForAbstractClass();
7272
$this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)
7373
->disableOriginalConstructor()

app/code/Magento/GiftMessage/view/frontend/web/js/view/gift-message.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,16 @@ define([
3131

3232
this.itemId = this.itemId || 'orderLevel';
3333
model = new GiftMessage(this.itemId);
34-
giftOptions.addOption(model);
3534
this.model = model;
35+
this.isResultBlockVisible();
36+
giftOptions.addOption(model);
3637

3738
this.model.getObservable('isClear').subscribe(function (value) {
3839
if (value == true) { //eslint-disable-line eqeqeq
3940
self.formBlockVisibility(false);
4041
self.model.getObservable('alreadyAdded')(true);
4142
}
4243
});
43-
44-
this.isResultBlockVisible();
4544
},
4645

4746
/**

app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/>
104104
<waitForPageLoad stepKey="waitForProductPageLoad"/>
105105
<!-- Disabled child configurable product -->
106+
<scrollToTopOfPage stepKey="scrollToShowEnableDisableControl"/>
106107
<click selector="{{AdminProductFormSection.enableProductAttributeLabel}}" stepKey="clickDisableProduct"/>
107108
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
108109
<waitForPageLoad stepKey="waitForProductPageSaved"/>

app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,6 @@
296296
box-sizing: border-box;
297297
width: 100%;
298298
}
299-
300-
.ie10 &,
301-
.ie11 & {
302-
height: 100%;
303-
}
304299
}
305300

306301
.navigation ul {

app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,6 @@
639639
box-sizing: border-box;
640640
width: 100%;
641641
}
642-
643-
.ie10 &,
644-
.ie11 & {
645-
height: 100%;
646-
}
647642
}
648643

649644
.page-footer {

0 commit comments

Comments
 (0)