Closed
Description
Preconditions
- Have a storeview in a language other than en_US
- Have a language pack / dictionary with translated string for 'none'
Steps to reproduce
- Add a product with some text for the short description attribute
- Visit the product view/detail page in a storeview for a different language (eg, pt_BR)
Expected result
- The short description text should appear right bellow the add to and send email blocks
Actual result
- There is an attribute label just before the short description text. This label is the equivalent to 'none' ('nenhum' in pt-br)translation for the current storeview locale
I traced the code and found out the following:
- The attribute label is set in catalog_product_view.xml
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.overview" template="product/view/attribute.phtml" group="detailed_info" after="product.info.extrahint">
<arguments>
<argument name="at_label" translate="true" xsi:type="string">none</argument>
</arguments>
</block>
- The product/view/attribute.phtml template has a condition to only show the attribute label if it's different than 'none'
$_attributeLabel = $block->getAtLabel();
<?php if ($_attributeLabel != 'none'): ?><strong class="type"><?php /* @escapeNotVerified */ echo $_attributeLabel?></strong><?php endif; ?>
- Since the attribute label tag has
translate="true"
, it's not always equal to 'none' in the template, therefore resulting in the printing of the undesired attribute label.
My suggested solution is to either:
- Remove the
translate="true"
of the xml tag; or - Consider the translated string in the if condition, like so:
<?php if ($_attributeLabel != __('none')): ?><strong class="type"><?php /* @escapeNotVerified */ echo $_attributeLabel?></strong><?php endif; ?>
As of now, our temporary solution has been to insert 'none' = 'none' in our pt_BR language pack, hence not needing to rewrite template files.
Metadata
Metadata
Assignees
Labels
No labels