2

For some reason the label of the short description is shown as "none" in frontend's product page just before the short description.

2 Answers 2

2

To complete Webninja's response, you should add a translate="false" if you want to handle multi-langage and if your at_label = none.

You will end up with this code to add in the catalog_product_view.xml :

<referenceBlock name="product.info.overview">
    <arguments>
        <argument name="at_label" translate="false" xsi:type="string">none</argument>
    </arguments>
</referenceBlock>

Here is the reason why you may have to add this parameter :

In the native file catalog_product_view.xml (in Magento_Catalog module), you will see that product.info.overview block is defined that way :

<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_call" xsi:type="string">getShortDescription</argument>
        <argument name="at_code" xsi:type="string">short_description</argument>
        <argument name="css_class" xsi:type="string">overview</argument>
        <argument name="at_label" translate="true" xsi:type="string">none</argument>
        <argument name="title" translate="true" xsi:type="string">Overview</argument>
        <argument name="add_attribute" xsi:type="string">itemprop="description"</argument>
    </arguments>
</block>

Unlike other usage of product/view/attribute.phtml, The at_label argument here is being translated.

Now looking at the file product/view/attribute.phtml, we'll see that this could be problematic :

<?php if ($_attributeLabel != 'none'): ?><strong class="type"><?php /* @escapeNotVerified */ echo $_attributeLabel?></strong><?php endif; ?>

If you have a translation of the "none" string in another langage, the condition will turn to true, and your translation of "none" will be displayed right before your attribute as a label.

2

Extended the catalog_product_view.xml with this:

<referenceBlock name="product.info.overview">
    <arguments>
        <argument name="at_label" xsi:type="string">none</argument>
    </arguments>
</referenceBlock>

The location for the new file:

app/design/frontend/{Vendor}/{Theme}/Magento_Catalog/layout/catalog_product_view.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.