Skip to content

Commit e65dac4

Browse files
authored
Merge pull request #2556 from magento-honey-badgers/MAGETWO-91580-Empty-product-attributes-of-dropdown
[honey] Bug fixes
2 parents fb4294a + 25b2780 commit e65dac4

File tree

11 files changed

+159
-6
lines changed

11 files changed

+159
-6
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
?>
1111
<?php $_total = $block->getItems()->getSize() ?>
1212
<?php if ($_total): ?>
13-
<a href="#" class="action print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>">
13+
<a href="#" class="action print hidden-print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>">
1414
<span><?= /* @escapeNotVerified */ __('Print This Page') ?></span>
1515
</a>
1616
<div class="table-wrapper comparison">
@@ -29,7 +29,7 @@
2929
<?php if ($_i++ == 0): ?>
3030
<th scope="row" class="cell label remove"><span><?= /* @escapeNotVerified */ __('Remove Product') ?></span></th>
3131
<?php endif; ?>
32-
<td class="cell remove product">
32+
<td class="cell remove product hidden-print">
3333
<?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?>
3434
<a href="#" data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataRemove($_item) ?>'
3535
class="action delete" title="<?= /* @escapeNotVerified */ __('Remove Product') ?>">
@@ -59,7 +59,7 @@
5959
</strong>
6060
<?= $block->getReviewsSummaryHtml($_item, 'short') ?>
6161
<?= /* @escapeNotVerified */ $block->getProductPrice($_item, '-compare-list-top') ?>
62-
<div class="product-item-actions">
62+
<div class="product-item-actions hidden-print">
6363
<div class="actions-primary">
6464
<?php if ($_item->isSaleable()): ?>
6565
<form data-role="tocart-form" action="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($_item) ?>" method="post">

app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function getValue(\Magento\Framework\DataObject $object)
165165
$options = $opt->getAllOptions();
166166
if ($options) {
167167
foreach ($options as $option) {
168-
if ($option['value'] == $value) {
168+
if ($option['value'] === $value) {
169169
$valueOption = $option['label'];
170170
}
171171
}

app/design/frontend/Magento/blank/web/css/print.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,8 @@
132132
.footer.content {
133133
padding: 0;
134134
}
135+
136+
.hidden-print {
137+
display: none !important;
138+
}
135139
}

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductAttributeData.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,25 @@
7373
<data key="used_for_sort_by">true</data>
7474
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
7575
</entity>
76+
<entity name="productAttributeWithDropdownTwoOptions" type="ProductAttribute">
77+
<data key="attribute_code">testattribute</data>
78+
<data key="frontend_input">select</data>
79+
<data key="scope">global</data>
80+
<data key="is_required">false</data>
81+
<data key="is_unique">false</data>
82+
<data key="is_searchable">true</data>
83+
<data key="is_visible">true</data>
84+
<data key="is_visible_in_advanced_search">true</data>
85+
<data key="is_visible_on_front">true</data>
86+
<data key="is_filterable">true</data>
87+
<data key="is_filterable_in_search">true</data>
88+
<data key="used_in_product_listing">true</data>
89+
<data key="is_used_for_promo_rules">true</data>
90+
<data key="is_comparable">true</data>
91+
<data key="is_used_in_grid">true</data>
92+
<data key="is_visible_in_grid">true</data>
93+
<data key="is_filterable_in_grid">true</data>
94+
<data key="used_for_sort_by">true</data>
95+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
96+
</entity>
7697
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<data key="visibility">4</data>
5252
<data key="status">1</data>
5353
<data key="quantity">1000</data>
54+
<data key="urlKey" unique="suffix">simpleproduct</data>
5455
<data key="weight">1</data>
5556
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
5657
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="StorefrontProductWithEmptyAttributeTest">
12+
<annotations>
13+
<title value="Product attribute is not visible on storefront if it is empty"/>
14+
<description value="Product attribute should not be visible on storefront if it is empty"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MAGETWO-91893"/>
17+
<group value="product"/>
18+
</annotations>
19+
<before>
20+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
21+
<createData entity="productAttributeWithDropdownTwoOptions" stepKey="createProductAttribute"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct">
25+
<argument name="product" value="SimpleProduct"/>
26+
</actionGroup>
27+
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
28+
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
29+
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
30+
</after>
31+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
32+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="amOnAttributeSetPage"/>
33+
<click selector="{{AdminProductAttributeSetGridSection.AttributeSetName('Default')}}" stepKey="chooseDefaultAttributeSet"/>
34+
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
35+
<dragAndDrop selector1="{{UnassignedAttributes.ProductAttributeName('testattribute')}}" selector2="{{Group.FolderName('Product Details')}}" stepKey="moveProductAttributeToGroup"/>
36+
<click selector="{{AttributeSetSection.Save}}" stepKey="saveAttributeSet"/>
37+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear" />
38+
<seeElement selector=".message-success" stepKey="assertSuccess"/>
39+
<actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin">
40+
<argument name="category" value="$$createPreReqCategory$$"/>
41+
<argument name="simpleProduct" value="SimpleProduct"/>
42+
</actionGroup>
43+
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCache"/>
44+
<amOnPage url="{{StorefrontProductPage.url(SimpleProduct.urlKey)}}" stepKey="goProductPageOnStorefront"/>
45+
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
46+
<dontSeeElement selector="//table[@id='product-attribute-specs-table']/tbody/tr/th[contains(text(),'testattribute')]" stepKey="seeAttribute2"/>
47+
</test>
48+
</tests>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11+
<page name="ThemesPageIndex" url="admin/system_design_theme/" area="admin" module="Magento_Theme">
12+
<section name="AdminThemeSection"/>
13+
</page>
14+
</pages>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminThemeSection">
12+
<!--All rows in a specific Column e.g. {{Section.rowsInColumn('columnName')}}-->
13+
<element name="rowsInColumn" type="text" selector="//tr/td[contains(@class, '{{column}}')]" parameterized="true"/>
14+
<!--selector for Theme Title column since it needs to be handled separately-->
15+
<element name="rowsInThemeTitleColumn" type="text" selector="//tbody/tr/td[contains(@class, 'parent_theme')]/preceding-sibling::td"/>
16+
<element name="rowsInColumn" type="text" selector="//tbody/tr/td[contains(@class, '{{column}}')]" parameterized="true"/>
17+
<!--Specific cell e.g. {{Section.gridCell('Name')}}-->
18+
<element name="gridCell" type="text" selector="//table[@id='theme_grid_table']//td[contains(text(), '{{gridCellText}}')]" parameterized="true"/>
19+
<element name="columnHeader" type="text" selector="//thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/>
20+
</section>
21+
</sections>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="ThemeTest">
12+
<annotations>
13+
<features value="Theme Test"/>
14+
<title value="Magento Rush theme should not be available in Themes grid"/>
15+
<description value="Magento Rush theme should not be available in Themes grid"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-91409"/>
18+
<group value="theme"/>
19+
</annotations>
20+
<after>
21+
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
22+
</after>
23+
<!--Login to Admin Area-->
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/>
25+
<!--Navigate to Themes page-->
26+
<amOnPage url="{{ThemesPageIndex.url}}" stepKey="navigateToThemesIndexPage" />
27+
<waitForPageLoad stepKey="wait1"/>
28+
<dontSee selector="{{AdminThemeSection.gridCell('Magento Rush')}}" stepKey="dontSeeRushThemeInTitleColumn"/>
29+
<seeNumberOfElements selector="{{AdminThemeSection.rowsInColumn('theme_path')}}" userInput="2" stepKey="see2RowsOnTheGrid"/>
30+
</test>
31+
</tests>

dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
'is_filterable_in_search' => 0,
3333
'is_used_for_promo_rules' => 0,
3434
'is_html_allowed_on_front' => 1,
35-
'is_visible_on_front' => 0,
36-
'used_in_product_listing' => 0,
35+
'is_visible_on_front' => 1,
36+
'used_in_product_listing' => 1,
3737
'used_for_sort_by' => 0,
3838
'frontend_label' => ['Drop-Down Attribute'],
3939
'backend_type' => 'varchar',

0 commit comments

Comments
 (0)