Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short Description attribute label showing up as translated string from 'none' in non-english storeview product/view page #9295

Closed
pguedesbr opened this issue Apr 18, 2017 · 2 comments

Comments

@pguedesbr
Copy link

Preconditions

  1. Have a storeview in a language other than en_US
  2. Have a language pack / dictionary with translated string for 'none'

Steps to reproduce

  1. Add a product with some text for the short description attribute
  2. Visit the product view/detail page in a storeview for a different language (eg, pt_BR)

Expected result

  1. The short description text should appear right bellow the add to and send email blocks

Actual result

  1. 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

image

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.

@korostii
Copy link
Contributor

Possible duplicate of #9161

@veloraven
Copy link
Contributor

I'm closing this issue as a duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants