1

can any one help on how to fix this ??

Exception #0 (Exception): Notice: Undefined index: category-node-310 in /home/cp376418/public_html/app/code/TemplateMonster/Megamenu/Model/Configurator/Row/Column/Category.php on line 21

<?php namespace TemplateMonster\Megamenu\Model\Configurator\Row\Column;


class Category extends Entity
{
    public $rendererClass = 'Category';
    private $_subCategory;

    public function __construct(array $data = [])
    {
        parent::__construct($data);
    }

    public function getCategory()
    {
        if (!$this->_subCategory) {
            $nodes = $this->getNode()->getAllChildNodes();
            $this->_subCategory = $nodes['category-node-' . $this->getValue()];
        }
        return $this->_subCategory;
    }
}
  • Add code of this <i>/home/cp376418/public_html/app/code/TemplateMonster/Megamenu/Model/Configurator/Row/Column/Category.php</i> file in comment also – Saurabh Dwivedi Aug 3 '18 at 0:08
  • <?php namespace TemplateMonster\Megamenu\Model\Configurator\Row\Column; class Category extends Entity { public $rendererClass = 'Category'; private $_subCategory; public function __construct( array $data = [] ) { parent::__construct($data); } public function getCategory() { if (!$this->_subCategory) { $nodes = $this->getNode()->getAllChildNodes(); $this->_subCategory = $nodes['category-node-' . $this->getValue()]; } return $this->_subCategory; } } – Greg Aug 3 '18 at 4:43
  • Has someone got it running? After applying the above changes I got another error Fatal error: Uncaught Error: Call to a member function getChildren() on null in /var/www/clients/client210/web1638/web/app/code/TemplateMonster/Megamenu/view/frontend/templates/html/topmenu/block/row/column/category.phtml:3 Stack trace: #0 /var/www/clients/client210/web1638/web/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() #1 /var/www/clients/client210/web1638/web/vendor/magento/framework/View/Element/Template.php(270): Magento\Framework\View\TemplateEngine\Php->render(Object(TemplateMonster\ – Martin St Jan 22 at 16:41
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review – Rama Chandran M Jan 22 at 17:00
0

You have to modify at this code

$this->_subCategory = $nodes['category-node-' . $this->getValue()];

to

    if(isset($nodes['category-node-' . $this->getValue()])){
        $this->_subCategory = $nodes['category-node-' . $this->getValue()];
    }

Some value does not exits at $nodes arra that why it is creating issue.

  • so AMit just swap the top line of code out for the second? – Greg Aug 3 '18 at 6:55
  • $nodes is an array.Category-node-310 index does not exist at this array.it is a PHP error – Amit Bera Aug 3 '18 at 7:13
0

After some time our developer found a solution.

The reason is a bug in the big menue extension. If a category got deleted by accident it is still looking for the not existing child category.

Solution is to deactivated and than activate the parent category of the missing child category. Than it should work.

please find more detailed information how to reproduce and solve it in our blog https://www.konvis.de/neuigkeiten/magento/magento-2-magetique-template-big-menue-bug-and-solution-en/

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.