Skip to content

Commit

Permalink
Merge pull request magento#3469 from magento-tsg/2.2-develop-pr58
Browse files Browse the repository at this point in the history
[TSG] Backporting for 2.2 (pr58) (2.2.8)
  • Loading branch information
xmav authored Nov 20, 2018
2 parents d3dcc9d + 4ef6d0b commit b1e26d5
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 45 deletions.
7 changes: 5 additions & 2 deletions app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,11 @@ public function getSku($product)
$selectionIds = $this->serializer->unserialize($customOption->getValue());
if (!empty($selectionIds)) {
$selections = $this->getSelectionsByIds($selectionIds, $product);
foreach ($selections->getItems() as $selection) {
$skuParts[] = $selection->getSku();
foreach ($selectionIds as $selectionId) {
$entity = $selections->getItemByColumnValue('selection_id', $selectionId);
if (isset($entity) && $entity->getEntityId()) {
$skuParts[] = $entity->getSku();
}
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ public function testGetSkuWithoutType()
->disableOriginalConstructor()
->getMock();
$selectionItemMock = $this->getMockBuilder(\Magento\Framework\DataObject::class)
->setMethods(['getSku', '__wakeup'])
->setMethods(['getSku', 'getEntityId', '__wakeup'])
->disableOriginalConstructor()
->getMock();

Expand Down Expand Up @@ -1623,9 +1623,12 @@ public function testGetSkuWithoutType()
->will($this->returnValue($serializeIds));
$selectionMock = $this->getSelectionsByIdsMock($selectionIds, $productMock, 5, 6);
$selectionMock->expects(($this->any()))
->method('getItems')
->will($this->returnValue([$selectionItemMock]));
$selectionItemMock->expects($this->any())
->method('getItemByColumnValue')
->will($this->returnValue($selectionItemMock));
$selectionItemMock->expects($this->at(0))
->method('getEntityId')
->will($this->returnValue(1));
$selectionItemMock->expects($this->once())
->method('getSku')
->will($this->returnValue($itemSku));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ abstract class AbstractAction
*/
private $queryGenerator;

/**
* Current store id.
* @var int
*/
private $currentStoreId = 0;

/**
* @param ResourceConnection $resource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
Expand Down Expand Up @@ -167,6 +173,7 @@ protected function reindex()
{
foreach ($this->storeManager->getStores() as $store) {
if ($this->getPathFromCategoryId($store->getRootCategoryId())) {
$this->currentStoreId = $store->getId();
$this->reindexRootCategory($store);
$this->reindexAnchorCategories($store);
$this->reindexNonAnchorCategories($store);
Expand Down Expand Up @@ -594,7 +601,7 @@ protected function getTemporaryTreeIndexTableName()
if (empty($this->tempTreeIndexTableName)) {
$this->tempTreeIndexTableName = $this->connection->getTableName('temp_catalog_category_tree_index')
. '_'
. substr(md5(time() . random_int(0, 999999999)), 0, 8);
. substr(sha1(time() . random_int(0, 999999999)), 0, 8);
}

return $this->tempTreeIndexTableName;
Expand Down Expand Up @@ -649,30 +656,47 @@ protected function makeTempCategoryTreeIndex()
}

/**
* Populate the temporary category tree index table
* Populate the temporary category tree index table.
*
* @param string $temporaryName
* @return void
* @since 101.0.0
*/
protected function fillTempCategoryTreeIndex($temporaryName)
{
$offset = 0;
$limit = 500;

$categoryTable = $this->getTable('catalog_category_entity');

$categoriesSelect = $this->connection->select()
->from(
['c' => $categoryTable],
['entity_id', 'path']
)->limit($limit, $offset);

$categories = $this->connection->fetchAll($categoriesSelect);
$isActiveAttributeId = $this->config->getAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'is_active'
)->getId();
$categoryMetadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\CategoryInterface::class);
$categoryLinkField = $categoryMetadata->getLinkField();
$selects = $this->prepareSelectsByRange(
$this->connection->select()
->from(
['c' => $this->getTable('catalog_category_entity')],
['entity_id', 'path']
)->joinInner(
['ccacd' => $this->getTable('catalog_category_entity_int')],
'ccacd.' . $categoryLinkField . ' = c.' . $categoryLinkField
. ' AND ccacd.store_id = 0' . ' AND ccacd.attribute_id = ' . $isActiveAttributeId,
[]
)->joinLeft(
['ccacs' => $this->getTable('catalog_category_entity_int')],
'ccacs.' . $categoryLinkField . ' = c.' . $categoryLinkField
. ' AND ccacs.attribute_id = ccacd.attribute_id AND ccacs.store_id = '
. $this->currentStoreId,
[]
)->where(
$this->connection->getIfNullSql('ccacs.value', 'ccacd.value') . ' = ?',
1
),
'entity_id'
);

while ($categories) {
foreach ($selects as $select) {
$values = [];

foreach ($categories as $category) {
foreach ($this->connection->fetchAll($select) as $category) {
foreach (explode('/', $category['path']) as $parentId) {
if ($parentId !== $category['entity_id']) {
$values[] = [$parentId, $category['entity_id']];
Expand All @@ -683,15 +707,6 @@ protected function fillTempCategoryTreeIndex($temporaryName)
if (count($values) > 0) {
$this->connection->insertArray($temporaryName, ['parent_id', 'child_id'], $values);
}

$offset += $limit;
$categoriesSelect = $this->connection->select()
->from(
['c' => $categoryTable],
['entity_id', 'path']
)->limit($limit, $offset);

$categories = $this->connection->fetchAll($categoriesSelect);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function setUp()
'isLockedAttribute'
])->getMockForAbstractClass();
$this->storeMock = $this->getMockBuilder(StoreInterface::class)
->setMethods(['load', 'getId', 'getConfig'])
->setMethods(['load', 'getId', 'getConfig', 'getBaseCurrency', 'getBaseCurrencyCode'])
->getMockForAbstractClass();
$this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ define([

this.itemId = this.itemId || 'orderLevel';
model = new GiftMessage(this.itemId);
giftOptions.addOption(model);
this.model = model;
this.isResultBlockVisible();
giftOptions.addOption(model);

this.model.getObservable('isClear').subscribe(function (value) {
if (value == true) { //eslint-disable-line eqeqeq
self.formBlockVisibility(false);
self.model.getObservable('alreadyAdded')(true);
}
});

this.isResultBlockVisible();
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<!-- Disabled child configurable product -->
<scrollToTopOfPage stepKey="scrollToShowEnableDisableControl"/>
<click selector="{{AdminProductFormSection.enableProductAttributeLabel}}" stepKey="clickDisableProduct"/>
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
<waitForPageLoad stepKey="waitForProductPageSaved"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@
box-sizing: border-box;
width: 100%;
}

.ie10 &,
.ie11 & {
height: 100%;
}
}

.navigation ul {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,6 @@
box-sizing: border-box;
width: 100%;
}

.ie10 &,
.ie11 & {
height: 100%;
}
}

.page-footer {
Expand Down

0 comments on commit b1e26d5

Please sign in to comment.