Fatal error: Uncaught Error: Method name must be a string in D:\xampp-7.1.23\htdocs\indiahicks\app\design\frontend\Mgs\ethan\Magento_Catalog\templates\product\view\form.phtml:19

    $_helper = $this->helper('Magento\Catalog\Helper\Output'); 
    $_product = $block->getProduct();

    $_call = $block->getAtCall();
    $_code = $block->getAtCode();
    $_className = $block->getCssClass();
    $_attributeLabel = $block->getAtLabel();
    $_attributeType = $block->getAtType();
    $_attributeAddAttribute = $block->getAddAttribute();
    $themeHelper = $this->helper('MGS\Mpanel\Helper\Data');

    if ($_attributeLabel && $_attributeLabel == 'default') {
        $_attributeLabel = $_product->getResource()->getAttribute($_code)->getFrontendLabel();
    if ($_attributeType && $_attributeType == 'text') {
        $_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) ? $_product->getAttributeText($_code) : '';
    } else {
        $_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code);
  • What is the return value of $_call = $block->getAtCall();?
    – Sohel Rana
    Commented Feb 19, 2019 at 7:25
  • not getting anything. Actually I copy this code from attribute.phtml and using same code in form.phtml, code is working fine in attribute.phtml but not in form.phtml I want to dynamic the product detail description. right now it's static
    – Farhan Ali
    Commented Feb 19, 2019 at 7:28

2 Answers 2


If you open the following file:


Then you can see following code:

<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="Magento_Catalog::product/view/attribute.phtml" after="product.info.type">
        <argument name="at_call" xsi:type="string">getSku</argument>
        <argument name="at_code" xsi:type="string">sku</argument>
        <argument name="css_class" xsi:type="string">sku</argument>
        <argument name="at_label" xsi:type="string">default</argument>
        <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument>

Where pass at_call as getSku. So you need to do that too. When you check in phtml

$_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code);

Where $_product->$_call() this actually $_product->getSku().

In your case $_call() is null.


Create a catalog_product_view.xml

    <referenceBlock name="product.info">
           <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" 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>

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.