0

I'm trying to change Product Name attribute from Text to Dropdown. I have created new Dropdown attribute in the backend and it's working fine.

but in frontend its seems that I should change the product name code everywhere in the Theme! list.phtml grid.phtml ..etc

Is there any way I could call the new attribute directly in one file without changing tons of phtml files to call the new product name dropdown!

e.g: Plugin "afterGetProductName" or something like this? kindly advise! Thanks

UPDATE i have created new plugin

public function afterGetName(\Magento\Catalog\Model\Product $subject, $result)
{
    $title = $subject->getAttributeText('new_name');
    return $title;
}

and its working perfect in Catalog Pages. but the product name now doesn't appear in checkout pages and mini cart! it's only show "false".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.