Skip to content

Commit 76ecca8

Browse files
committed
Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-58265
2 parents 80a2a6f + c4cec78 commit 76ecca8

File tree

49 files changed

+2174
-326
lines changed

Some content is hidden

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

49 files changed

+2174
-326
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Category.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class Category extends \Magento\Backend\App\Action
3131
*/
3232
protected function _initCategory($getRootInstead = false)
3333
{
34-
$categoryId = (int)$this->getRequest()->getParam('id', false);
34+
$categoryId = $this->resolveCategoryId();
3535
$storeId = (int)$this->getRequest()->getParam('store');
3636
$category = $this->_objectManager->create(\Magento\Catalog\Model\Category::class);
3737
$category->setStoreId($storeId);
@@ -62,6 +62,18 @@ protected function _initCategory($getRootInstead = false)
6262
return $category;
6363
}
6464

65+
/**
66+
* Resolve Category Id (from get or from post)
67+
*
68+
* @return int
69+
*/
70+
private function resolveCategoryId()
71+
{
72+
$categoryId = (int)$this->getRequest()->getParam('id', false);
73+
74+
return $categoryId ?: (int)$this->getRequest()->getParam('entity_id', false);
75+
}
76+
6577
/**
6678
* Build response for ajax request
6779
*

app/code/Magento/Catalog/Controller/Adminhtml/Category/Move.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function execute()
8080
}
8181

8282
if (!$error) {
83-
$this->messageManager->addSuccess(__('You moved the category'));
83+
$this->messageManager->addSuccess(__('You moved the category.'));
8484
}
8585

8686
$block->setMessages($this->messageManager->getMessages(true));

app/code/Magento/Catalog/Helper/Product/Compare.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,9 @@ public function getRemoveUrl()
228228
*/
229229
public function getPostDataRemove($product)
230230
{
231-
$listCleanUrl = $this->getEncodedUrl($this->_getUrl('catalog/product_compare'));
232231
$data = [
233-
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $listCleanUrl,
234-
'product' => $product->getId()
232+
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => '',
233+
'product' => $product->getId(),
235234
];
236235
return $this->postHelper->getPostData($this->getRemoveUrl(), $data);
237236
}
@@ -253,9 +252,8 @@ public function getClearListUrl()
253252
*/
254253
public function getPostDataClearList()
255254
{
256-
$refererUrl = $this->_getRequest()->getServer('HTTP_REFERER');
257255
$params = [
258-
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlEncoder->encode($refererUrl)
256+
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => '',
259257
];
260258
return $this->postHelper->getPostData($this->getClearListUrl(), $params);
261259
}

app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88
class Full extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractAction
99
{
10+
/**
11+
* Whether to use main or temporary index table
12+
*
13+
* @var bool
14+
*/
15+
protected $useTempTable = false;
16+
1017
/**
1118
* Refresh entities index
1219
*

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,22 @@ protected function initializeProductData(array $productData, $createNew)
313313
*/
314314
private function assignProductToWebsites(\Magento\Catalog\Model\Product $product)
315315
{
316+
$websiteIds = $product->getWebsiteIds();
317+
316318
if (!$this->storeManager->hasSingleStore()) {
317-
if ($this->storeManager->getStore()->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) {
318-
$websiteIds = array_keys($this->storeManager->getWebsites());
319-
} else {
320-
$websiteIds = [$this->storeManager->getStore()->getWebsiteId()];
321-
}
319+
$websiteIds = array_unique(
320+
array_merge(
321+
$websiteIds,
322+
[$this->storeManager->getStore()->getWebsiteId()]
323+
)
324+
);
325+
}
322326

323-
$product->setWebsiteIds(array_unique(array_merge($product->getWebsiteIds(), $websiteIds)));
327+
if ($this->storeManager->getStore(true)->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) {
328+
$websiteIds = array_keys($this->storeManager->getWebsites());
324329
}
330+
331+
$product->setWebsiteIds($websiteIds);
325332
}
326333

327334
/**

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

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class Category extends AbstractResource
3333
*/
3434
protected $_categoryProductTable;
3535

36+
/**
37+
* @var array[]
38+
*/
39+
private $entitiesWhereAttributesIs;
40+
3641
/**
3742
* Id of 'is_active' category attribute
3843
*
@@ -573,22 +578,29 @@ public function getIsActiveAttributeId()
573578
*/
574579
public function findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValue)
575580
{
576-
$linkField = $this->getLinkField();
577-
$bind = ['attribute_id' => $attribute->getId(), 'value' => $expectedValue];
578-
$selectEntities = $this->getConnection()->select()->from(
579-
['ce' => $this->getTable('catalog_category_entity')],
580-
['entity_id']
581-
)->joinLeft(
582-
['ci' => $attribute->getBackend()->getTable()],
583-
"ci.{$linkField} = ce.{$linkField} AND attribute_id = :attribute_id",
584-
['value']
585-
)->where(
586-
'ci.value = :value'
587-
)->where(
588-
'ce.entity_id IN (?)',
589-
$entityIdsFilter
590-
);
591-
return $this->getConnection()->fetchCol($selectEntities, $bind);
581+
$entityIdsFilterHash = md5(serialize($entityIdsFilter));
582+
583+
if (!isset($this->entitiesWhereAttributesIs[$entityIdsFilterHash][$attribute->getId()][$expectedValue])) {
584+
$linkField = $this->getLinkField();
585+
$bind = ['attribute_id' => $attribute->getId(), 'value' => $expectedValue];
586+
$selectEntities = $this->getConnection()->select()->from(
587+
['ce' => $this->getTable('catalog_category_entity')],
588+
['entity_id']
589+
)->joinLeft(
590+
['ci' => $attribute->getBackend()->getTable()],
591+
"ci.{$linkField} = ce.{$linkField} AND attribute_id = :attribute_id",
592+
['value']
593+
)->where(
594+
'ci.value = :value'
595+
)->where(
596+
'ce.entity_id IN (?)',
597+
$entityIdsFilter
598+
);
599+
$this->entitiesWhereAttributesIs[$entityIdsFilterHash][$attribute->getId()][$expectedValue] =
600+
$this->getConnection()->fetchCol($selectEntities, $bind);
601+
}
602+
603+
return $this->entitiesWhereAttributesIs[$entityIdsFilterHash][$attribute->getId()][$expectedValue];
592604
}
593605

594606
/**

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
use Magento\Framework\App\ResourceConnection;
99

10+
/**
11+
* @deprecated
12+
*/
1013
class MaxHeapTableSizeProcessor
1114
{
1215
/**

app/code/Magento/Catalog/Plugin/Model/Indexer/Category/Product/MaxHeapTableSizeProcessorOnFullReindex.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Catalog\Model\ResourceModel\MaxHeapTableSizeProcessor;
1111
use Psr\Log\LoggerInterface;
1212

13+
/**
14+
* @deprecated
15+
*/
1316
class MaxHeapTableSizeProcessorOnFullReindex
1417
{
1518
/**

0 commit comments

Comments
 (0)