This is a screenshot of the error. enter image description here

My code is


    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
       <referenceContainer name="content">
           <block class="Magento\Framework\View\Element\Template"  name="order_total" template="Prayag_Module::orders.phtml">
        <referenceContainer name="sidebar.additional">
    <block class="Magento\Framework\View\Element\Template" name="order_total_sidebar" template="Prayag_Module::orders.phtml">
    <referenceContainer name="content">
    <block class="Magento\Framework\View\Element\Template" name="cart_total_sidebar" template="Prayag_Module::cart_view.phtml">



    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customerSession = $objectManager->create('Magento\Customer\Model\Session');
    $customerID = $customerSession->getCustomerId();

    $order = $this->helper('Prayag\Module\Helper\Data')->getCollection($customerID);

    foreach($order as $items){ ?>
    <span>IncrementId :</span><a href="<?php echo $block->getUrl('sales/order/history'); ?>"><?php echo $items->getIncrementId(); ?></a><br>
    echo "<b>Subtotal :</b>". $items->getSubtotal(). '<br/>';
    echo "<b>Order Status :</b>". $items->getStatus(). '<br/>';
    echo "<b>Date :</b>". $items->getCreatedAt().'<br/>';



    namespace Prayag\Module\Helper;
    class Data extends \Magento\Framework\App\Helper\AbstractHelper
    public function __construct(
    \Magento\Sales\Model\OrderFactory $orderFactory
    ) {
    $this->orderFactory = $orderFactory;
    public function getCollection($customerID)
    $collection = $this->orderFactory->create()->getCollection()->setOrder('entity_id', 'DESC')
    return $collection;
  • 1
    Post your helper here and the error shows that getLabel function doesn't exist there in heper file – Prathap Gunasekaran Apr 16 '19 at 11:36
  • where should I put that ?? – Prayag Dave Apr 16 '19 at 11:40
  • have you checked cart_view.phtml ?? – Ghulam.M Apr 16 '19 at 11:58

It seems everything is correct in the above code, but the error shows that getLabel function from helper is missing and you're calling it somewhere around in home page.

By resolve this just try add

public function getLabel(){

to the helper or run the below commands.

rm -rf generated
php bin/magento cac:flu

Hope this helps.

  • Yes, It's help me. Thank you. – Prayag Dave Apr 16 '19 at 11:57

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.