Skip to main content

I am getting this error in magento Magento 2 - "Undefined constant 'Product\SizeChart\Helper\Data'" while using helper

added 99 characters in body
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

Uncaught Error: Undefined constant 'Product\SizeChart\Helper\Data' in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml:48 Stack trace: #0 /opt/lampp/htdocs/M2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() #1 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #2 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array) #3 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception{closure}(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #4 /opt/lampp/htdocs/M2/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(26): Magento\Framework\View\TemplateEngine\ in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml on line 48

here is my helper code:

Uncaught<?php Error:namespace UndefinedProduct\SizeChart\Helper;

use constant\Magento\Framework\App\Action\Context;
use 'Product\SizeChart\Helper\Data'\Product\SizeChart\Model\CurdFactory;

class inData /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml:48extends Stack\Magento\Framework\App\Helper\AbstractHelper
{
 trace: #0 /opt/lampp/htdocs/M2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include()protected #1$curdFactory;
 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) 
 #2 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array)public #3function /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php__construct(153): 
 Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(Object(Product\SizeChart\Block\Display)       Context $context, 
 '/opt/lampp/htdo...'       CurdFactory $curdFactory, 
 Array) #4 /opt/lampp/htdocs/M2/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(26     $data = []
    ): Magento\Framework\View\TemplateEngine\ in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml on line{
 48

here is my helper code:

curdFactory       $this->curdFactory = $curdFactory;
        parent::__construct($context, $data);
    }
    
    public function getCollection()
    {
        return $this->curdFactory>curdFactory->create>create()->getCollection>getCollection();
    }
} 
Uncaught Error: Undefined constant 'Product\SizeChart\Helper\Data' in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml:48 Stack trace: #0 /opt/lampp/htdocs/M2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() #1 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #2 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array) #3 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #4 /opt/lampp/htdocs/M2/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(26): Magento\Framework\View\TemplateEngine\ in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml on line 48

here is my helper code:

curdFactory = $curdFactory;
        parent::__construct($context, $data);
    }
    
    public function getCollection()
    {
        return $this->curdFactory->create()->getCollection();
    }
}

Uncaught Error: Undefined constant 'Product\SizeChart\Helper\Data' in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml:48 Stack trace: #0 /opt/lampp/htdocs/M2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() #1 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #2 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array) #3 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception{closure}(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #4 /opt/lampp/htdocs/M2/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(26): Magento\Framework\View\TemplateEngine\ in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml on line 48

here is my helper code:

<?php namespace Product\SizeChart\Helper;

use \Magento\Framework\App\Action\Context;
use \Product\SizeChart\Model\CurdFactory;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
    protected $curdFactory;
     
    public function __construct( 
        Context $context, 
        CurdFactory $curdFactory, 
        $data = []
    )     {
        $this->curdFactory = $curdFactory;
        parent::__construct($context, $data);
    }
    
    public function getCollection()
    {
        return $this->curdFactory->create()->getCollection();
    }
} 
added 1709 characters in body
Source Link
Deep Shah
  • 577
  • 6
  • 32

If anyone have idea then please share with me.

I am going to stuck in this error:

ClassUncaught Product\SizeChart\Helper\ContextError: doesUndefined notconstant exist'Product\SizeChart\Helper\Data' in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml:48 Stack trace: #0 /opt/lampp/htdocs/M2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() #1 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #2 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array) #3 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #4 /opt/lampp/htdocs/M2/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(26): Magento\Framework\View\TemplateEngine\ in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml on line 48

here is my helper code:

curdFactory = $curdFactory;
        parent::__construct($context, $data);
    }
    
    public function getCollection()
    {
        return $this->curdFactory->create()->getCollection();
    }
}

Thank you in Advance.

If anyone have idea then please share with me.

I am going to stuck in this error:

Class Product\SizeChart\Helper\Context does not exist

Thank you in Advance.

If anyone have idea then please share with me.

I am going to stuck in this error:

Uncaught Error: Undefined constant 'Product\SizeChart\Helper\Data' in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml:48 Stack trace: #0 /opt/lampp/htdocs/M2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() #1 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #2 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array) #3 /opt/lampp/htdocs/M2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(Object(Product\SizeChart\Block\Display), '/opt/lampp/htdo...', Array) #4 /opt/lampp/htdocs/M2/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(26): Magento\Framework\View\TemplateEngine\ in /opt/lampp/htdocs/M2/app/code/Product/SizeChart/view/frontend/templates/size.phtml on line 48

here is my helper code:

curdFactory = $curdFactory;
        parent::__construct($context, $data);
    }
    
    public function getCollection()
    {
        return $this->curdFactory->create()->getCollection();
    }
}

Thank you in Advance.

Source Link
Deep Shah
  • 577
  • 6
  • 32
Loading