Skip to main content

Magento 2 - "Undefined constant 'Product\SizeChart\Helper\Data'" while using helper

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:

<?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();
    }
}

Thank you in Advance.

Deep Shah
  • 577
  • 6
  • 32