Domanda

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.

È stato utile?

Soluzione

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>

Altri suggerimenti

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();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top