1

I want to replace all Product name with one Product Attribute in Category page only. Any idea how can I achieve it? Any suggestion or guidance? No need to provide code.

1
  • Want to changes view on category page
    – Amit Bera
    Commented May 24, 2018 at 7:28

1 Answer 1

2

To achieve your need to some code at template file phtml

Do the indexing from admin and flush for apply changes.

Then open list.phtml from app/design/{ThemeVendor}/{Themename}/Magento_Catalog/templates/product,Then and find the code:

<?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

and add your attribute value using

<?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getData('{YOUR_ATTRIBUTE_CODE}'), '{YOUR_ATTRIBUTE_CODE}') ?>
3
  • Thanks so much, I almost forgot this, I was thinking too much about by creating the module for this.. and forgot that I can directly do this via template file. Commented May 24, 2018 at 7:43
  • don't need any extension. But It is always developer call how they manage their requirement .
    – Amit Bera
    Commented May 24, 2018 at 7:44
  • yes that's true. Commented May 24, 2018 at 7:47

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.