Skip to content

Commit eb49283

Browse files
author
Oleksandr Dubovyk
committed
Merge remote-tracking branch 'origin/develop' into PR
2 parents 05b871b + 01141f4 commit eb49283

File tree

406 files changed

+15983
-4233
lines changed

Some content is hidden

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

406 files changed

+15983
-4233
lines changed

app/code/Magento/Backend/Block/System/Account/Edit/Form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function _prepareForm()
100100
'name' => 'password',
101101
'label' => __('New Password'),
102102
'title' => __('New Password'),
103-
'class' => 'input-text validate-admin-password'
103+
'class' => 'validate-admin-password admin__control-text'
104104
]
105105
);
106106

@@ -110,7 +110,7 @@ protected function _prepareForm()
110110
[
111111
'name' => 'password_confirmation',
112112
'label' => __('Password Confirmation'),
113-
'class' => 'input-text validate-cpassword'
113+
'class' => 'validate-cpassword admin__control-text'
114114
]
115115
);
116116

@@ -138,7 +138,7 @@ protected function _prepareForm()
138138
'label' => __('Your Password'),
139139
'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD,
140140
'title' => __('Your Password'),
141-
'class' => 'input-text validate-current-password required-entry',
141+
'class' => 'validate-current-password required-entry admin__control-text',
142142
'required' => true
143143
]
144144
);

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@
164164
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
165165
<comment>Warning! Enabling this feature is not recommended on production environments because it represents a potential security risk.</comment>
166166
</field>
167-
<field id="minify_html" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
167+
<field id="minify_html" translate="label comment" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
168168
<label>Minify Html</label>
169169
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
170+
<comment>Minification is not applied in developer mode.</comment>
170171
</field>
171172
</group>
172173
<group id="translate_inline" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -193,9 +194,10 @@
193194
<label>Enable JavaScript Bundling</label>
194195
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
195196
</field>
196-
<field id="minify_files" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
197+
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
197198
<label>Minify JavaScript Files</label>
198199
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
200+
<comment>Minification is not applied in developer mode.</comment>
199201
</field>
200202
</group>
201203
<group id="css" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -204,9 +206,10 @@
204206
<label>Merge CSS Files</label>
205207
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
206208
</field>
207-
<field id="minify_files" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
209+
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
208210
<label>Minify CSS Files</label>
209211
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
212+
<comment>Minification is not applied in developer mode.</comment>
210213
</field>
211214
</group>
212215
<group id="image" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="0" showInStore="0">
@@ -411,16 +414,16 @@
411414
</group>
412415
<group id="security" translate="label" type="text" sortOrder="35" showInDefault="1" showInWebsite="0" showInStore="0">
413416
<label>Security</label>
414-
<field id="use_form_key" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
417+
<field id="use_form_key" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
415418
<label>Add Secret Key to URLs</label>
416419
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
417420
<backend_model>Magento\Config\Model\Config\Backend\Admin\Usesecretkey</backend_model>
418421
</field>
419-
<field id="use_case_sensitive_login" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
422+
<field id="use_case_sensitive_login" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
420423
<label>Login is Case Sensitive</label>
421424
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
422425
</field>
423-
<field id="session_lifetime" translate="label comment" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
426+
<field id="session_lifetime" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
424427
<label>Admin Session Lifetime (seconds)</label>
425428
<comment>Values less than 60 are ignored.</comment>
426429
<validate>validate-digits</validate>

app/code/Magento/Backend/view/adminhtml/templates/menu.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
?>
1010

11-
<nav data-mage-init='{"globalNavigation": {}}' class="admin__menu" role="navigation">
11+
<nav data-mage-init='{"globalNavigation": {}}' class="admin__menu">
1212
<?php /* @escapeNotVerified */ echo $block->renderNavigation($block->getMenuModel(), 0, 12); ?>
1313
</nav>
1414

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
*/
77
namespace Magento\Bundle\Model;
88

9+
use Magento\Catalog\Api\Data\ProductInterface;
910
use Magento\Catalog\Api\ProductRepositoryInterface;
1011
use Magento\Framework\Exception\CouldNotSaveException;
1112
use Magento\Framework\Exception\InputException;
13+
use Magento\Framework\Model\Entity\MetadataPool;
1214

1315
/**
1416
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -45,14 +47,20 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
4547
*/
4648
protected $dataObjectHelper;
4749

50+
/**
51+
* @var MetadataPool
52+
*/
53+
protected $metadataPool;
54+
4855
/**
4956
* @param ProductRepositoryInterface $productRepository
5057
* @param \Magento\Bundle\Api\Data\LinkInterfaceFactory $linkFactory
51-
* @param \Magento\Bundle\Model\ResourceModel\BundleFactory $bundleFactory
5258
* @param \Magento\Bundle\Model\SelectionFactory $bundleSelection
59+
* @param \Magento\Bundle\Model\ResourceModel\BundleFactory $bundleFactory
5360
* @param \Magento\Bundle\Model\ResourceModel\Option\CollectionFactory $optionCollection
5461
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
5562
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
63+
* @param MetadataPool $metadataPool
5664
*/
5765
public function __construct(
5866
ProductRepositoryInterface $productRepository,
@@ -61,7 +69,8 @@ public function __construct(
6169
\Magento\Bundle\Model\ResourceModel\BundleFactory $bundleFactory,
6270
\Magento\Bundle\Model\ResourceModel\Option\CollectionFactory $optionCollection,
6371
\Magento\Store\Model\StoreManagerInterface $storeManager,
64-
\Magento\Framework\Api\DataObjectHelper $dataObjectHelper
72+
\Magento\Framework\Api\DataObjectHelper $dataObjectHelper,
73+
MetadataPool $metadataPool
6574
) {
6675
$this->productRepository = $productRepository;
6776
$this->linkFactory = $linkFactory;
@@ -70,6 +79,7 @@ public function __construct(
7079
$this->optionCollection = $optionCollection;
7180
$this->storeManager = $storeManager;
7281
$this->dataObjectHelper = $dataObjectHelper;
82+
$this->metadataPool = $metadataPool;
7383
}
7484

7585
/**
@@ -137,12 +147,12 @@ public function saveChild(
137147
if (!$selectionModel->getId()) {
138148
throw new InputException(__('Can not find product link with id "%1"', [$linkedProduct->getId()]));
139149
}
140-
150+
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
141151
$selectionModel = $this->mapProductLinkToSelectionModel(
142152
$selectionModel,
143153
$linkedProduct,
144154
$linkProductModel->getId(),
145-
$product->getId()
155+
$product->getData($linkField)
146156
);
147157

148158
try {
@@ -221,9 +231,10 @@ public function addChild(
221231
);
222232
}
223233

234+
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
224235
/* @var $resource \Magento\Bundle\Model\ResourceModel\Bundle */
225236
$resource = $this->bundleFactory->create();
226-
$selections = $resource->getSelectionsData($product->getId());
237+
$selections = $resource->getSelectionsData($product->getData($linkField));
227238
/** @var \Magento\Catalog\Model\Product $linkProductModel */
228239
$linkProductModel = $this->productRepository->get($linkedProduct->getSku());
229240
if ($linkProductModel->isComposite()) {
@@ -232,7 +243,7 @@ public function addChild(
232243
if ($selections) {
233244
foreach ($selections as $selection) {
234245
if ($selection['option_id'] == $optionId &&
235-
$selection['product_id'] == $linkProductModel->getId()) {
246+
$selection['product_id'] == $linkProductModel->getEntityId()) {
236247
throw new CouldNotSaveException(
237248
__(
238249
'Child with specified sku: "%1" already assigned to product: "%2"',
@@ -242,19 +253,18 @@ public function addChild(
242253
}
243254
}
244255
}
245-
246256
$selectionModel = $this->bundleSelection->create();
247257
$selectionModel = $this->mapProductLinkToSelectionModel(
248258
$selectionModel,
249259
$linkedProduct,
250-
$linkProductModel->getId(),
251-
$product->getId()
260+
$linkProductModel->getEntityId(),
261+
$product->getData($linkField)
252262
);
253263
$selectionModel->setOptionId($optionId);
254264

255265
try {
256266
$selectionModel->save();
257-
$resource->addProductRelation($product->getId(), $linkProductModel->getId());
267+
$resource->addProductRelation($product->getData($linkField), $linkProductModel->getEntityId());
258268
} catch (\Exception $e) {
259269
throw new CouldNotSaveException(__('Could not save child: "%1"', $e->getMessage()), $e);
260270
}
@@ -293,10 +303,11 @@ public function removeChild($sku, $optionId, $childSku)
293303
__('Requested bundle option product doesn\'t exist')
294304
);
295305
}
306+
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
296307
/* @var $resource \Magento\Bundle\Model\ResourceModel\Bundle */
297308
$resource = $this->bundleFactory->create();
298-
$resource->dropAllUnneededSelections($product->getId(), $excludeSelectionIds);
299-
$resource->removeProductRelations($product->getId(), array_unique($usedProductIds));
309+
$resource->dropAllUnneededSelections($product->getData($linkField), $excludeSelectionIds);
310+
$resource->removeProductRelations($product->getData($linkField), array_unique($usedProductIds));
300311

301312
return true;
302313
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function afterGetIdentities(
3232
CatalogProduct $product,
3333
array $identities
3434
) {
35-
foreach ($this->type->getParentIdsByChild($product->getId()) as $parentId) {
35+
foreach ($this->type->getParentIdsByChild($product->getEntityId()) as $parentId) {
3636
$identities[] = CatalogProduct::CACHE_TAG . '_' . $parentId;
3737
}
3838
return $identities;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ public function getOptionsCollection($product)
425425
/** @var \Magento\Bundle\Model\ResourceModel\Option\Collection $optionsCollection */
426426
$optionsCollection = $this->_bundleOption->create()
427427
->getResourceCollection();
428-
$optionsCollection->setProductIdFilter($product->getId());
428+
$optionsCollection->setProductIdFilter($product->getEntityId());
429429
$this->setStoreFilter($product->getStoreId(), $product);
430430
$optionsCollection->setPositionOrder();
431431
$storeId = $this->getStoreFilter($product);

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Bundle\Model\ResourceModel\Indexer;
77

8+
use Magento\Catalog\Api\Data\ProductInterface;
9+
810
/**
911
* Bundle products Price indexer resource model
1012
*
@@ -132,7 +134,7 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null)
132134
['customer_group_id']
133135
);
134136
$this->_addWebsiteJoinToSelect($select, true);
135-
$this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', 'e.entity_id');
137+
$this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', "e.entity_id");
136138
$select->columns(
137139
'website_id',
138140
'cw'
@@ -155,9 +157,10 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null)
155157
'=?',
156158
\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
157159
);
158-
$this->_addAttributeToSelect($select, 'status', 'e.entity_id', 'cs.store_id', $statusCond, true);
160+
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
161+
$this->_addAttributeToSelect($select, 'status', "e.$linkField", 'cs.store_id', $statusCond, true);
159162
if ($this->moduleManager->isEnabled('Magento_Tax')) {
160-
$taxClassId = $this->_addAttributeToSelect($select, 'tax_class_id', 'e.entity_id', 'cs.store_id');
163+
$taxClassId = $this->_addAttributeToSelect($select, 'tax_class_id', "e.$linkField", 'cs.store_id');
161164
} else {
162165
$taxClassId = new \Zend_Db_Expr('0');
163166
}
@@ -171,12 +174,12 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null)
171174
}
172175

173176
$priceTypeCond = $connection->quoteInto('=?', $priceType);
174-
$this->_addAttributeToSelect($select, 'price_type', 'e.entity_id', 'cs.store_id', $priceTypeCond);
177+
$this->_addAttributeToSelect($select, 'price_type', "e.$linkField", 'cs.store_id', $priceTypeCond);
175178

176-
$price = $this->_addAttributeToSelect($select, 'price', 'e.entity_id', 'cs.store_id');
177-
$specialPrice = $this->_addAttributeToSelect($select, 'special_price', 'e.entity_id', 'cs.store_id');
178-
$specialFrom = $this->_addAttributeToSelect($select, 'special_from_date', 'e.entity_id', 'cs.store_id');
179-
$specialTo = $this->_addAttributeToSelect($select, 'special_to_date', 'e.entity_id', 'cs.store_id');
179+
$price = $this->_addAttributeToSelect($select, 'price', "e.$linkField", 'cs.store_id');
180+
$specialPrice = $this->_addAttributeToSelect($select, 'special_price', "e.$linkField", 'cs.store_id');
181+
$specialFrom = $this->_addAttributeToSelect($select, 'special_from_date', "e.$linkField", 'cs.store_id');
182+
$specialTo = $this->_addAttributeToSelect($select, 'special_to_date', "e.$linkField", 'cs.store_id');
180183
$curentDate = new \Zend_Db_Expr('cwd.website_date');
181184

182185
$specialExpr = $connection->getCheckSql(
@@ -401,12 +404,17 @@ protected function _calculateBundleSelectionPrice($priceType)
401404
);
402405
}
403406

407+
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
404408
$select = $connection->select()->from(
405409
['i' => $this->_getBundlePriceTable()],
406410
['entity_id', 'customer_group_id', 'website_id']
411+
)->join(
412+
['parent_product' => $this->getTable('catalog_product_entity')],
413+
'parent_product.entity_id = i.entity_id',
414+
[]
407415
)->join(
408416
['bo' => $this->getTable('catalog_product_bundle_option')],
409-
'bo.parent_id = i.entity_id',
417+
"bo.parent_id = parent_product.$linkField",
410418
['option_id']
411419
)->join(
412420
['bs' => $this->getTable('catalog_product_bundle_selection')],
@@ -476,14 +484,14 @@ protected function _prepareBundlePrice($entityIds = null)
476484
protected function _prepareTierPriceIndex($entityIds = null)
477485
{
478486
$connection = $this->getConnection();
479-
487+
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
480488
// remove index by bundle products
481489
$select = $connection->select()->from(
482490
['i' => $this->_getTierPriceIndexTable()],
483491
null
484492
)->join(
485493
['e' => $this->getTable('catalog_product_entity')],
486-
'i.entity_id=e.entity_id',
494+
"i.entity_id=e.$linkField",
487495
[]
488496
)->where(
489497
'e.type_id=?',
@@ -492,13 +500,12 @@ protected function _prepareTierPriceIndex($entityIds = null)
492500
$query = $select->deleteFromSelect('i');
493501
$connection->query($query);
494502

495-
$productIdField = $this->getProductIdFieldName();
496503
$select = $connection->select()->from(
497504
['tp' => $this->getTable('catalog_product_entity_tier_price')],
498-
[$productIdField]
505+
[$linkField]
499506
)->join(
500507
['e' => $this->getTable('catalog_product_entity')],
501-
"tp.{$productIdField} = e.{$productIdField}",
508+
"tp.{$linkField} = e.{$linkField}",
502509
[]
503510
)->join(
504511
['cg' => $this->getTable('customer_group')],
@@ -516,26 +523,16 @@ protected function _prepareTierPriceIndex($entityIds = null)
516523
)->columns(
517524
new \Zend_Db_Expr('MIN(tp.value)')
518525
)->group(
519-
["tp.{$productIdField}", 'cg.customer_group_id', 'cw.website_id']
526+
["tp.{$linkField}", 'cg.customer_group_id', 'cw.website_id']
520527
);
521528

522529
if (!empty($entityIds)) {
523-
$select->where("tp.{$productIdField} IN(?)", $entityIds);
530+
$select->where("tp.{$linkField} IN(?)", $entityIds);
524531
}
525532

526533
$query = $select->insertFromSelect($this->_getTierPriceIndexTable());
527534
$connection->query($query);
528535

529536
return $this;
530537
}
531-
532-
/**
533-
* @return string
534-
*/
535-
protected function getProductIdFieldName()
536-
{
537-
$table = $this->getTable('catalog_product_entity');
538-
$indexList = $this->getConnection()->getIndexList($table);
539-
return $indexList[$this->getConnection()->getPrimaryKeyName($table)]['COLUMNS_LIST'][0];
540-
}
541538
}

0 commit comments

Comments
 (0)