0

Using Magento 2.3.2.

We currently sell through our website, and Amazon and Ebay via the M2E Pro extension. Our current product description is used for the website and Ebay, and the short description is used for Amazon.

The product description is not really suitable for the website, as it contains a lot of ebay related content, so I was wondering if it was possible to create a new attribute, say, 'web_description' and use that as the description on the website.

Any help in solving this problem would be greatly appreciated.

Thank you.

1

Add a new web_description attribute using admin.

Then in your custom theme, in Magento_Catalog/layout/catalog_product_view.xml, add the code below. <referenceBlock name="product.info.description"><arguments><argument name="at_call" xsi:type="string">getWebDescription</argument> <argument name="at_code" xsi:type="string">web_description</argument> <argument name="css_class" xsi:type="string">web-description</argument></arguments></referenceBlock>

1
  • That actually seems a bit more straightforward than my solution. – user355218 Oct 4 '20 at 7:25
0

I found the answer on another post

/vendor/theme/magento_catalog/templates/product/view/attribute.phtml

$_call = $block->getAtCall();


if($_code == "description") {
$objectManager =  \Magento\Framework\App\ObjectManager::getInstance();        
$storeManager  = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$storeCode     = $storeManager->getStore()->getCode();

if($_code == "description") {
    $_call = 'getWebsiteDescription'    ;
    $_code == "website_description";
}
        }
$_className = $block->getCssClass();
$_attributeLabel = $block->getAtLabel();
$_attributeType = $block->getAtType();
$_attributeAddAttribute = $block->getAddAttribute();

Your Answer

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

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