Skip to content

Commit 87d1676

Browse files
ENGCOM-5084: [Backport] #22779 Remove hardcoded height for admin textarea field #22783
- Merge Pull Request #22783 from serhiyzhovnir/magento2:2.2-develop-PR-port-22779 - Merged commits: 1. 2b8e142 2. c4411b4 3. 6e88af6
2 parents 24a12ec + 6e88af6 commit 87d1676

File tree

48 files changed

+1292
-167
lines changed

Some content is hidden

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

48 files changed

+1292
-167
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
- [ ] Pull request has a meaningful description of its purpose
3636
- [ ] All commits are accompanied by meaningful commit messages
3737
- [ ] All new or changed code is covered with unit/integration tests (if applicable)
38-
- [ ] All automated tests passed successfully (all builds on Travis CI are green)
38+
- [ ] All automated tests passed successfully (all builds are green)
File renamed without changes.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.2-develop)](https://travis-ci.org/magento/magento2)
21
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
32
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
43
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)

app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminSlideOutDialogSection">
12-
<element name="closeButton" type="button" selector=".modal-slide._show [data-role='closeBtn']" timeout="30"/>
12+
<element name="closeButton" type="button" selector=".modal-slide._show [data-role=&quot;closeBtn&quot;]" timeout="30"/>
1313
<element name="cancelButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Cancel']" timeout="30"/>
1414
<element name="doneButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Done']" timeout="30"/>
1515
<element name="saveButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Save']" timeout="30"/>

app/code/Magento/Catalog/Block/Product/View.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ public function getAddToCartUrl($product, $additional = [])
169169
}
170170

171171
/**
172-
* Get JSON encoded configuration array which can be used for JS dynamic
173-
* price calculation depending on product options
172+
* Get JSON encoded configuration which can be used for JS dynamic price calculation depending on product options
174173
*
175174
* @return string
176175
*/
@@ -254,6 +253,7 @@ public function hasRequiredOptions()
254253
* instantly.
255254
*
256255
* @return bool
256+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
257257
*/
258258
public function isStartCustomization()
259259
{
@@ -262,6 +262,7 @@ public function isStartCustomization()
262262

263263
/**
264264
* Get default qty - either as preconfigured, or as 1.
265+
*
265266
* Also restricts it by minimal qty.
266267
*
267268
* @param null|\Magento\Catalog\Model\Product $product
@@ -323,10 +324,7 @@ public function getQuantityValidators()
323324
public function getIdentities()
324325
{
325326
$identities = $this->getProduct()->getIdentities();
326-
$category = $this->_coreRegistry->registry('current_category');
327-
if ($category) {
328-
$identities[] = Category::CACHE_TAG . '_' . $category->getId();
329-
}
327+
330328
return $identities;
331329
}
332330

app/code/Magento/Catalog/Model/Product/Option/Type/Select.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
2929
*/
3030
protected $string;
3131

32+
/**
33+
* @var array
34+
*/
35+
private $singleSelectionTypes;
36+
3237
/**
3338
* @param \Magento\Checkout\Model\Session $checkoutSession
3439
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
3540
* @param \Magento\Framework\Stdlib\StringUtils $string
3641
* @param \Magento\Framework\Escaper $escaper
3742
* @param array $data
43+
* @param array $singleSelectionTypes
3844
*/
3945
public function __construct(
4046
\Magento\Checkout\Model\Session $checkoutSession,
4147
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
4248
\Magento\Framework\Stdlib\StringUtils $string,
4349
\Magento\Framework\Escaper $escaper,
44-
array $data = []
50+
array $data = [],
51+
array $singleSelectionTypes = []
4552
) {
4653
$this->string = $string;
4754
$this->_escaper = $escaper;
4855
parent::__construct($checkoutSession, $scopeConfig, $data);
56+
57+
$this->singleSelectionTypes = $singleSelectionTypes ?: [
58+
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
59+
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
60+
];
4961
}
5062

5163
/**
@@ -301,10 +313,6 @@ public function getOptionSku($optionValue, $skuDelimiter)
301313
*/
302314
protected function _isSingleSelection()
303315
{
304-
$single = [
305-
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
306-
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
307-
];
308-
return in_array($this->getOption()->getType(), $single);
316+
return in_array($this->getOption()->getType(), $this->singleSelectionTypes, true);
309317
}
310318
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,26 +1570,9 @@ public function addAttributeToFilter($attribute, $condition = null, $joinType =
15701570
$this->_allIdsCache = null;
15711571

15721572
if (is_string($attribute) && $attribute == 'is_saleable') {
1573-
$columns = $this->getSelect()->getPart(\Magento\Framework\DB\Select::COLUMNS);
1574-
foreach ($columns as $columnEntry) {
1575-
list($correlationName, $column, $alias) = $columnEntry;
1576-
if ($alias == 'is_saleable') {
1577-
if ($column instanceof \Zend_Db_Expr) {
1578-
$field = $column;
1579-
} else {
1580-
$connection = $this->getSelect()->getConnection();
1581-
if (empty($correlationName)) {
1582-
$field = $connection->quoteColumnAs($column, $alias, true);
1583-
} else {
1584-
$field = $connection->quoteColumnAs([$correlationName, $column], $alias, true);
1585-
}
1586-
}
1587-
$this->getSelect()->where("{$field} = ?", $condition);
1588-
break;
1589-
}
1590-
}
1591-
1592-
return $this;
1573+
$this->addIsSaleableAttributeToFilter($condition);
1574+
} elseif (is_string($attribute) && $attribute == 'tier_price') {
1575+
$this->addTierPriceAttributeToFilter($attribute, $condition);
15931576
} else {
15941577
return parent::addAttributeToFilter($attribute, $condition, $joinType);
15951578
}
@@ -2469,4 +2452,71 @@ public function getPricesCount()
24692452

24702453
return $this->_pricesCount;
24712454
}
2455+
2456+
/**
2457+
* Add is_saleable attribute to filter
2458+
*
2459+
* @param array|null $condition
2460+
* @return $this
2461+
*/
2462+
private function addIsSaleableAttributeToFilter($condition)
2463+
{
2464+
$columns = $this->getSelect()->getPart(Select::COLUMNS);
2465+
foreach ($columns as $columnEntry) {
2466+
list($correlationName, $column, $alias) = $columnEntry;
2467+
if ($alias == 'is_saleable') {
2468+
if ($column instanceof \Zend_Db_Expr) {
2469+
$field = $column;
2470+
} else {
2471+
$connection = $this->getSelect()->getConnection();
2472+
if (empty($correlationName)) {
2473+
$field = $connection->quoteColumnAs($column, $alias, true);
2474+
} else {
2475+
$field = $connection->quoteColumnAs([$correlationName, $column], $alias, true);
2476+
}
2477+
}
2478+
$this->getSelect()->where("{$field} = ?", $condition);
2479+
break;
2480+
}
2481+
}
2482+
2483+
return $this;
2484+
}
2485+
2486+
/**
2487+
* Add tier price attribute to filter
2488+
*
2489+
* @param string $attribute
2490+
* @param array|null $condition
2491+
* @return $this
2492+
*/
2493+
private function addTierPriceAttributeToFilter($attribute, $condition)
2494+
{
2495+
$attrCode = $attribute;
2496+
$connection = $this->getConnection();
2497+
$attrTable = $this->_getAttributeTableAlias($attrCode);
2498+
$entity = $this->getEntity();
2499+
$fKey = 'e.' . $this->getEntityPkName($entity);
2500+
$pKey = $attrTable . '.' . $this->getEntityPkName($entity);
2501+
$attribute = $entity->getAttribute($attrCode);
2502+
$attrFieldName = $attrTable . '.value';
2503+
$fKey = $connection->quoteColumnAs($fKey, null);
2504+
$pKey = $connection->quoteColumnAs($pKey, null);
2505+
2506+
$condArr = ["{$pKey} = {$fKey}"];
2507+
$this->getSelect()->join(
2508+
[$attrTable => $this->getTable('catalog_product_entity_tier_price')],
2509+
'(' . implode(') AND (', $condArr) . ')',
2510+
[$attrCode => $attrFieldName]
2511+
);
2512+
$this->removeAttributeToSelect($attrCode);
2513+
$this->_filterAttributes[$attrCode] = $attribute->getId();
2514+
$this->_joinFields[$attrCode] = ['table' => '', 'field' => $attrFieldName];
2515+
$field = $this->_getAttributeTableAlias($attrCode) . '.value';
2516+
$conditionSql = $this->_getConditionSql($field, $condition);
2517+
$this->getSelect()->where($conditionSql, null, Select::TYPE_CONDITION);
2518+
$this->_totalRecords = null;
2519+
2520+
return $this;
2521+
}
24722522
}

app/code/Magento/Catalog/Test/Unit/Block/Product/ViewTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,18 @@ public function testGetIdentities()
6767
{
6868
$productTags = ['cat_p_1'];
6969
$product = $this->createMock(\Magento\Catalog\Model\Product::class);
70-
$category = $this->createMock(\Magento\Catalog\Model\Category::class);
7170

7271
$product->expects($this->once())
7372
->method('getIdentities')
7473
->will($this->returnValue($productTags));
75-
$category->expects($this->once())
76-
->method('getId')
77-
->will($this->returnValue(1));
7874
$this->registryMock->expects($this->any())
7975
->method('registry')
8076
->will($this->returnValueMap(
8177
[
8278
['product', $product],
83-
['current_category', $category],
8479
]
8580
)
8681
);
87-
$this->assertEquals(['cat_p_1', 'cat_c_1'], $this->view->getIdentities());
82+
$this->assertEquals($productTags, $this->view->getIdentities());
8883
}
8984
}

app/code/Magento/Catalog/Test/Unit/Model/Product/ProductList/ToolbarMemorizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function getMemorizedDataProvider(): array
197197
/**
198198
* Test method isMemorizingAllowed.
199199
*
200-
* @aram bool|null $variableValue
200+
* @param bool|null $variableValue
201201
* @param bool $flag
202202
* @param bool $expected
203203
* @return void

app/code/Magento/Catalog/etc/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,4 +1164,12 @@
11641164
</argument>
11651165
</arguments>
11661166
</type>
1167+
<type name="Magento\Catalog\Model\Product\Option\Type\Select">
1168+
<arguments>
1169+
<argument name="singleSelectionTypes" xsi:type="array">
1170+
<item name="drop_down" xsi:type="const">Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN</item>
1171+
<item name="radio" xsi:type="const">Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO</item>
1172+
</argument>
1173+
</arguments>
1174+
</type>
11671175
</config>

0 commit comments

Comments
 (0)