Skip to content

Commit 446d1b6

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into MAGETWO-88615
2 parents c37d702 + 4bffc3a commit 446d1b6

File tree

92 files changed

+1811
-104
lines changed

Some content is hidden

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

92 files changed

+1811
-104
lines changed

app/code/Magento/Backend/Block/GlobalSearch.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function getWidgetInitOptions()
7373
'filterProperty' => 'name',
7474
'preventClickPropagation' => false,
7575
'minLength' => 2,
76+
'submitInputOnEnter' => false,
7677
]
7778
];
7879
}

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
121121
</field>
122122
<field id="template_hints_blocks" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
123-
<label>Add Block Names to Hints</label>
123+
<label>Add Block Class Type to Hints</label>
124124
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
125125
</field>
126126
</group>

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

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -656,25 +656,43 @@ protected function makeTempCategoryTreeIndex()
656656
*/
657657
protected function fillTempCategoryTreeIndex($temporaryName)
658658
{
659-
// This finds all children (cc2) that descend from a parent (cc) by path.
660-
// For example, cc.path may be '1/2', and cc2.path may be '1/2/3/4/5'.
661-
$temporarySelect = $this->connection->select()->from(
662-
['cc' => $this->getTable('catalog_category_entity')],
663-
['parent_id' => 'entity_id']
664-
)->joinInner(
665-
['cc2' => $this->getTable('catalog_category_entity')],
666-
'cc2.path LIKE ' . $this->connection->getConcatSql(
667-
[$this->connection->quoteIdentifier('cc.path'), $this->connection->quote('/%')]
668-
),
669-
['child_id' => 'entity_id']
670-
);
659+
$offset = 0;
660+
$limit = 500;
671661

672-
$this->connection->query(
673-
$temporarySelect->insertFromSelect(
674-
$temporaryName,
675-
['parent_id', 'child_id']
676-
)
677-
);
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);
671+
672+
while ($categories) {
673+
$values = [];
674+
675+
foreach ($categories as $category) {
676+
foreach (explode('/', $category['path']) as $parentId) {
677+
if ($parentId !== $category['entity_id']) {
678+
$values[] = [$parentId, $category['entity_id']];
679+
}
680+
}
681+
}
682+
683+
if (count($values) > 0) {
684+
$this->connection->insertArray($temporaryName, ['parent_id', 'child_id'], $values);
685+
}
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);
695+
}
678696
}
679697

680698
/**

app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
*/
77
namespace Magento\Catalog\Model\Product\Attribute;
88

9-
use Magento\Framework\Exception\InputException;
10-
119
class SetRepository implements \Magento\Catalog\Api\AttributeSetRepositoryInterface
1210
{
1311
/**
@@ -53,7 +51,7 @@ public function __construct(
5351
*/
5452
public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet)
5553
{
56-
$this->validate($attributeSet);
54+
$this->validateBeforeSave($attributeSet);
5755
return $this->attributeSetRepository->save($attributeSet);
5856
}
5957

@@ -127,4 +125,29 @@ protected function validate(\Magento\Eav\Api\Data\AttributeSetInterface $attribu
127125
);
128126
}
129127
}
128+
129+
/**
130+
* Validate attribute set entity type id.
131+
*
132+
* @param \Magento\Eav\Api\Data\AttributeSetInterface $attributeSet
133+
* @return void
134+
* @throws \Magento\Framework\Exception\StateException
135+
* @throws \Magento\Framework\Exception\NoSuchEntityException
136+
* @throws \Magento\Framework\Exception\LocalizedException
137+
*/
138+
private function validateBeforeSave(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet)
139+
{
140+
$productEntityId = $this->eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getId();
141+
$result = $attributeSet->getEntityTypeId() === $productEntityId;
142+
if (!$result && $attributeSet->getAttributeSetId()) {
143+
$existingAttributeSet = $this->attributeSetRepository->get($attributeSet->getAttributeSetId());
144+
$attributeSet->setEntityTypeId($existingAttributeSet->getEntityTypeId());
145+
$result = $existingAttributeSet->getEntityTypeId() === $productEntityId;
146+
}
147+
if (!$result) {
148+
throw new \Magento\Framework\Exception\StateException(
149+
__('Provided Attribute set non product Attribute set.')
150+
);
151+
}
152+
}
130153
}

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected function _prepareColumns()
207207
public function getGridUrl()
208208
{
209209
return $this->getUrl(
210-
'catalog_rule/*/chooser',
210+
'*/*/chooser',
211211
['_current' => true, 'current_grid_id' => $this->getId(), 'collapse' => null]
212212
);
213213
}

app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Ui\DataProvider\AddFilterToCollectionInterface;
1212

1313
/**
14-
* Class AddFulltextFilterToCollection
14+
* Adds FullText search to Product Data Provider
1515
*/
1616
class AddFulltextFilterToCollection implements AddFilterToCollectionInterface
1717
{

app/code/Magento/Checkout/view/frontend/web/js/sidebar.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ define([
105105
self._showItemButton($(event.target));
106106
};
107107

108+
/**
109+
* @param {jQuery.Event} event
110+
*/
111+
events['change ' + this.options.item.qty] = function (event) {
112+
self._showItemButton($(event.target));
113+
};
114+
108115
/**
109116
* @param {jQuery.Event} event
110117
*/

app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<?= $block->escapeHtml($block->getName()) ?><br>
2121
<?= $block->escapeHtml($block->getCustomer()->getEmail()) ?><br>
2222
</p>
23+
<?= $block->getChildHtml('customer.account.dashboard.info.extra'); ?>
2324
</div>
2425
<div class="box-actions">
2526
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('customer/account/edit')) ?>">
@@ -43,8 +44,6 @@
4344
<?= $block->escapeHtml(__('You aren\'t subscribed to our newsletter.')) ?>
4445
<?php endif; ?>
4546
</p>
46-
<?php /* Extensions placeholder */ ?>
47-
<?= $block->getChildHtml('customer.account.dashboard.info.extra') ?>
4847
</div>
4948
<div class="box-actions">
5049
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('newsletter/manage')) ?>"><span><?= $block->escapeHtml(__('Edit')) ?></span></a>

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,9 @@ public function place($token, $shippingMethodCode = null)
809809
case \Magento\Sales\Model\Order::STATE_PROCESSING:
810810
case \Magento\Sales\Model\Order::STATE_COMPLETE:
811811
case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW:
812-
$this->orderSender->send($order);
812+
if (!$order->getEmailSent()) {
813+
$this->orderSender->send($order);
814+
}
813815
$this->_checkoutSession->start();
814816
break;
815817
default:

app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\VersionContro
4545
*/
4646
protected $_quoteConfig;
4747

48+
/**
49+
* @var \Magento\Store\Model\StoreManagerInterface|null
50+
*/
51+
private $storeManager;
52+
4853
/**
4954
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
5055
* @param \Psr\Log\LoggerInterface $logger
@@ -56,6 +61,7 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\VersionContro
5661
* @param \Magento\Quote\Model\Quote\Config $quoteConfig
5762
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
5863
* @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
64+
* @param \Magento\Store\Model\StoreManagerInterface|null $storeManager
5965
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6066
*/
6167
public function __construct(
@@ -68,7 +74,8 @@ public function __construct(
6874
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
6975
\Magento\Quote\Model\Quote\Config $quoteConfig,
7076
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
71-
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
77+
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null,
78+
\Magento\Store\Model\StoreManagerInterface $storeManager = null
7279
) {
7380
parent::__construct(
7481
$entityFactory,
@@ -82,6 +89,10 @@ public function __construct(
8289
$this->_itemOptionCollectionFactory = $itemOptionCollectionFactory;
8390
$this->_productCollectionFactory = $productCollectionFactory;
8491
$this->_quoteConfig = $quoteConfig;
92+
93+
// Backward compatibility constructor parameters
94+
$this->storeManager = $storeManager ?:
95+
\Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Store\Model\StoreManagerInterface::class);
8596
}
8697

8798
/**
@@ -101,7 +112,10 @@ protected function _construct()
101112
*/
102113
public function getStoreId()
103114
{
104-
return (int)$this->_productCollectionFactory->create()->getStoreId();
115+
// Fallback to current storeId if no quote is provided
116+
// (see https://github.com/magento/magento2/commit/9d3be732a88884a66d667b443b3dc1655ddd0721)
117+
return $this->_quote === null ?
118+
(int) $this->storeManager->getStore()->getId() : (int) $this->_quote->getStoreId();
105119
}
106120

107121
/**

0 commit comments

Comments
 (0)