Skip to content

Commit 466bdea

Browse files
author
Roman Lytvynenko
committed
Merge branch 'MC-30099' of https://github.com/magento-tango/magento2ce into Tango-PR-01-15-2020_23
2 parents b62507a + 5a47b03 commit 466bdea

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
use Magento\Store\Model\Store;
1515

1616
/**
17-
* Class Product
17+
* Rule product condition data model
18+
*
1819
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1920
*/
2021
class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct
@@ -250,7 +251,7 @@ protected function addNotGlobalAttribute(
250251
public function getMappedSqlField()
251252
{
252253
$result = '';
253-
if (in_array($this->getAttribute(), ['category_ids', 'sku'])) {
254+
if (in_array($this->getAttribute(), ['category_ids', 'sku', 'attribute_set_id'])) {
254255
$result = parent::getMappedSqlField();
255256
} elseif (isset($this->joinedAttributes[$this->getAttribute()])) {
256257
$result = $this->joinedAttributes[$this->getAttribute()];

app/code/Magento/CatalogWidget/Test/Unit/Model/Rule/Condition/ProductTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,7 @@ public function testGetMappedSqlFieldSku()
102102
{
103103
$this->model->setAttribute('sku');
104104
$this->assertEquals('e.sku', $this->model->getMappedSqlField());
105+
$this->model->setAttribute('attribute_set_id');
106+
$this->assertEquals('e.attribute_set_id', $this->model->getMappedSqlField());
105107
}
106108
}

app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ public function getMappedSqlField()
625625
$mappedSqlField = $this->getEavAttributeTableAlias() . '.value';
626626
} elseif ($this->getAttribute() == 'category_ids') {
627627
$mappedSqlField = 'e.entity_id';
628+
} elseif ($this->getAttribute() == 'attribute_set_id') {
629+
$mappedSqlField = 'e.attribute_set_id';
628630
} else {
629631
$mappedSqlField = parent::getMappedSqlField();
630632
}

app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ public function testGetMappedSqlField()
282282
{
283283
$this->_condition->setAttribute('category_ids');
284284
$this->assertEquals('e.entity_id', $this->_condition->getMappedSqlField());
285+
$this->_condition->setAttribute('attribute_set_id');
286+
$this->assertEquals('e.attribute_set_id', $this->_condition->getMappedSqlField());
285287
}
286288

287289
/**
@@ -329,7 +331,7 @@ public function testPrepareValueOptions(
329331
->willReturn($attributeObjectFrontendInput);
330332
$attributeObjectMock->method('getSource')->willReturn($attrObjectSourceMock);
331333

332-
$entityTypeMock = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel\Type::class)
334+
$entityTypeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class)
333335
->setMethods(['getId'])
334336
->disableOriginalConstructor()
335337
->getMock();

0 commit comments

Comments
 (0)