Skip to content

Commit 9593749

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-94892
2 parents 7132343 + 80469a6 commit 9593749

File tree

165 files changed

+4304
-1471
lines changed

Some content is hidden

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

165 files changed

+4304
-1471
lines changed

app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<% if (data.items.length) { %>
4343
<% _.each(data.items, function(value){ %>
4444
<li class="item"
45-
<%- data.optionData(value) %>
45+
<%= data.optionData(value) %>
4646
>
4747
<a href="<%- value.url %>" class="title"><%- value.name %></a>
4848
<span class="type"><%- value.type %></span>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCreateApiDynamicBundleProductActionGroup">
12+
<arguments>
13+
<argument name="productName" defaultValue="Api Dynamic Bundle Product" type="string"/>
14+
</arguments>
15+
<!--Create 4 simple products-->
16+
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
17+
<field key="price">4.99</field>
18+
</createData>
19+
<createData entity="SimpleProduct2" stepKey="simpleProduct2">
20+
<field key="price">2.89</field>
21+
</createData>
22+
<createData entity="SimpleProduct2" stepKey="simpleProduct3">
23+
<field key="price">7.33</field>
24+
</createData>
25+
<createData entity="SimpleProduct2" stepKey="simpleProduct4">
26+
<field key="price">18.25</field>
27+
</createData>
28+
<!-- Create the bundle product based -->
29+
<createData entity="ApiBundleProduct" stepKey="createBundleProduct">
30+
<field key="name">{{productName}}</field>
31+
</createData>
32+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1_1">
33+
<requiredEntity createDataKey="createBundleProduct"/>
34+
<field key="required">false</field>
35+
</createData>
36+
<createData entity="CheckboxOption" stepKey="createBundleOption1_2">
37+
<requiredEntity createDataKey="createBundleProduct"/>
38+
</createData>
39+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
40+
<requiredEntity createDataKey="createBundleProduct"/>
41+
<requiredEntity createDataKey="createBundleOption1_1"/>
42+
<requiredEntity createDataKey="simpleProduct1"/>
43+
</createData>
44+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
45+
<requiredEntity createDataKey="createBundleProduct"/>
46+
<requiredEntity createDataKey="createBundleOption1_1"/>
47+
<requiredEntity createDataKey="simpleProduct2"/>
48+
</createData>
49+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct3">
50+
<requiredEntity createDataKey="createBundleProduct"/>
51+
<requiredEntity createDataKey="createBundleOption1_2"/>
52+
<requiredEntity createDataKey="simpleProduct3"/>
53+
</createData>
54+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct4">
55+
<requiredEntity createDataKey="createBundleProduct"/>
56+
<requiredEntity createDataKey="createBundleOption1_2"/>
57+
<requiredEntity createDataKey="simpleProduct4"/>
58+
</createData>
59+
</actionGroup>
60+
<actionGroup name="AdminCreateApiFixedBundleProductActionGroup">
61+
<arguments>
62+
<argument name="productName" defaultValue="Api Fixed Bundle Product" type="string"/>
63+
</arguments>
64+
<!--Create 4 simple products-->
65+
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
66+
<field key="price">4.99</field>
67+
</createData>
68+
<createData entity="SimpleProduct2" stepKey="simpleProduct2">
69+
<field key="price">2.89</field>
70+
</createData>
71+
<createData entity="SimpleProduct2" stepKey="simpleProduct3">
72+
<field key="price">7.33</field>
73+
</createData>
74+
<createData entity="SimpleProduct2" stepKey="simpleProduct4">
75+
<field key="price">18.25</field>
76+
</createData>
77+
<!-- Create the bundle product based -->
78+
<createData entity="ApiFixedBundleProduct" stepKey="createBundleProduct">
79+
<field key="name">{{productName}}</field>
80+
</createData>
81+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1_1">
82+
<requiredEntity createDataKey="createBundleProduct"/>
83+
<field key="required">false</field>
84+
</createData>
85+
<createData entity="CheckboxOption" stepKey="createBundleOption1_2">
86+
<requiredEntity createDataKey="createBundleProduct"/>
87+
</createData>
88+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
89+
<requiredEntity createDataKey="createBundleProduct"/>
90+
<requiredEntity createDataKey="createBundleOption1_1"/>
91+
<requiredEntity createDataKey="simpleProduct1"/>
92+
</createData>
93+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
94+
<requiredEntity createDataKey="createBundleProduct"/>
95+
<requiredEntity createDataKey="createBundleOption1_1"/>
96+
<requiredEntity createDataKey="simpleProduct2"/>
97+
</createData>
98+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct3">
99+
<requiredEntity createDataKey="createBundleProduct"/>
100+
<requiredEntity createDataKey="createBundleOption1_2"/>
101+
<requiredEntity createDataKey="simpleProduct3"/>
102+
</createData>
103+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct4">
104+
<requiredEntity createDataKey="createBundleProduct"/>
105+
<requiredEntity createDataKey="createBundleOption1_2"/>
106+
<requiredEntity createDataKey="simpleProduct4"/>
107+
</createData>
108+
</actionGroup>
109+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,19 @@
6060
<requiredEntity type="custom_attribute">CustomAttributeDynamicPrice</requiredEntity>
6161
<requiredEntity type="custom_attribute">CustomAttributePriceViewRange</requiredEntity>
6262
</entity>
63+
<entity name="ApiFixedBundleProduct" type="product2">
64+
<data key="name" unique="suffix">Api Fixed Bundle Product</data>
65+
<data key="sku" unique="suffix">api-fixed-bundle-product</data>
66+
<data key="type_id">bundle</data>
67+
<data key="attribute_set_id">4</data>
68+
<data key="price">1.23</data>
69+
<data key="visibility">4</data>
70+
<data key="status">1</data>
71+
<data key="urlKey" unique="suffix">api-fixed-bundle-product</data>
72+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
73+
<requiredEntity type="custom_attribute">ApiProductDescription</requiredEntity>
74+
<requiredEntity type="custom_attribute">ApiProductShortDescription</requiredEntity>
75+
<requiredEntity type="custom_attribute">CustomAttributeFixPrice</requiredEntity>
76+
<requiredEntity type="custom_attribute">CustomAttributePriceView</requiredEntity>
77+
</entity>
6378
</entities>

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
7272

7373
const CACHE_TAG = 'cat_c';
7474

75+
/**
76+
* Category Store Id
77+
*/
78+
const STORE_ID = 'store_id';
79+
7580
/**#@-*/
7681
protected $_eventPrefix = 'catalog_category';
7782

@@ -564,12 +569,12 @@ public function getStoreIds()
564569
*
565570
* If store id is underfined for category return current active store id
566571
*
567-
* @return integer
572+
* @return int
568573
*/
569574
public function getStoreId()
570575
{
571-
if ($this->hasData('store_id')) {
572-
return (int)$this->_getData('store_id');
576+
if ($this->hasData(self::STORE_ID)) {
577+
return (int)$this->_getData(self::STORE_ID);
573578
}
574579
return (int)$this->_storeManager->getStore()->getId();
575580
}
@@ -585,7 +590,7 @@ public function setStoreId($storeId)
585590
if (!is_numeric($storeId)) {
586591
$storeId = $this->_storeManager->getStore($storeId)->getId();
587592
}
588-
$this->setData('store_id', $storeId);
593+
$this->setData(self::STORE_ID, $storeId);
589594
$this->getResource()->setStoreId($storeId);
590595
return $this;
591596
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,39 +56,36 @@ public function __construct(
5656
* @return \Magento\Catalog\Model\Indexer\Product\Flat
5757
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
5858
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
59+
* @SuppressWarnings(PHPMD.NPathComplexity)
5960
*/
6061
public function write($storeId, $productId, $valueFieldSuffix = '')
6162
{
6263
$flatTable = $this->_productIndexerHelper->getFlatTableName($storeId);
64+
$entityTableName = $this->_productIndexerHelper->getTable('catalog_product_entity');
6365

6466
$attributes = $this->_productIndexerHelper->getAttributes();
6567
$eavAttributes = $this->_productIndexerHelper->getTablesStructure($attributes);
6668
$updateData = [];
6769
$describe = $this->_connection->describeTable($flatTable);
70+
$metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class);
71+
$linkField = $metadata->getLinkField();
6872

6973
foreach ($eavAttributes as $tableName => $tableColumns) {
7074
$columnsChunks = array_chunk($tableColumns, self::ATTRIBUTES_CHUNK_SIZE, true);
7175

7276
foreach ($columnsChunks as $columns) {
7377
$select = $this->_connection->select();
74-
$selectValue = $this->_connection->select();
75-
$keyColumns = [
76-
'entity_id' => 'e.entity_id',
77-
'attribute_id' => 't.attribute_id',
78-
'value' => $this->_connection->getIfNullSql('`t2`.`value`', '`t`.`value`'),
79-
];
80-
81-
if ($tableName != $this->_productIndexerHelper->getTable('catalog_product_entity')) {
78+
79+
if ($tableName != $entityTableName) {
8280
$valueColumns = [];
8381
$ids = [];
8482
$select->from(
85-
['e' => $this->_productIndexerHelper->getTable('catalog_product_entity')],
86-
$keyColumns
87-
);
88-
89-
$selectValue->from(
90-
['e' => $this->_productIndexerHelper->getTable('catalog_product_entity')],
91-
$keyColumns
83+
['e' => $entityTableName],
84+
[
85+
'entity_id' => 'e.entity_id',
86+
'attribute_id' => 't.attribute_id',
87+
'value' => $this->_connection->getIfNullSql('`t2`.`value`', '`t`.`value`'),
88+
]
9289
);
9390

9491
/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
@@ -97,8 +94,7 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
9794
$ids[$attribute->getId()] = $columnName;
9895
}
9996
}
100-
$linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField();
101-
$select->joinLeft(
97+
$select->joinInner(
10298
['t' => $tableName],
10399
sprintf('e.%s = t.%s ', $linkField, $linkField) . $this->_connection->quoteInto(
104100
' AND t.attribute_id IN (?)',
@@ -116,8 +112,6 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
116112
[]
117113
)->where(
118114
'e.entity_id = ' . $productId
119-
)->where(
120-
't.attribute_id IS NOT NULL'
121115
);
122116
$cursor = $this->_connection->query($select);
123117
while ($row = $cursor->fetch(\Zend_Db::FETCH_ASSOC)) {
@@ -157,7 +151,7 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
157151
$columnNames[] = 'attribute_set_id';
158152
$columnNames[] = 'type_id';
159153
$select->from(
160-
['e' => $this->_productIndexerHelper->getTable('catalog_product_entity')],
154+
['e' => $entityTableName],
161155
$columnNames
162156
)->where(
163157
'e.entity_id = ' . $productId
@@ -175,7 +169,9 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
175169

176170
if (!empty($updateData)) {
177171
$updateData += ['entity_id' => $productId];
178-
$updateData += ['row_id' => $productId];
172+
if ($linkField !== $metadata->getIdentifierField()) {
173+
$updateData += [$linkField => $productId];
174+
}
179175
$updateFields = [];
180176
foreach ($updateData as $key => $value) {
181177
$updateFields[$key] = $key;
@@ -187,6 +183,8 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
187183
}
188184

189185
/**
186+
* Get MetadataPool instance
187+
*
190188
* @return \Magento\Framework\EntityManager\MetadataPool
191189
*/
192190
private function getMetadataPool()

0 commit comments

Comments
 (0)