Recent Topics

Undefined Menu issue in sidebar in profile



  • Hello,

    After sign in it is showing me undefined menu in sidebar for profile. May i know from where you are passing menu in profile.

    Please reply

    Regards
    Deepak Sharma



  • Hi @dsharma

    You can find it from 'menu.php' file in Config folder of Shop package.

    If you want to create menu for your package then follow this link - https://forums.bagisto.com/topic/226/how-to-create-menu-for-customers

    Thanks



  • hi,

    thankyou so much for your reply i got that error

    Undefined variable: menu (View: C:\xampp\htdocs\proimagesports\packages\Proimage\Shop\src\Resources\views\customers\account\partials\sidemenu.blade.php) (View: C:\xampp\htdocs\proimagesports\packages\Proimage\Shop\src\Resources\views\customers\account\partials\sidemenu.blade.php)

    i have specified

    protected function composeView()
    {
    view()->composer('shop::customers.account.partials.sidemenu', function ($view) {
    $tree = Tree::create();

            foreach (config('menu.customer') as $item) {
                $tree->add($item, 'menu');
            }
    
            $tree->items = core()->sortItems($tree->items);
    
    
    
            $view->with('menu', $tree);
        });
    }
    
    /**
     * Register package config.
     *
     * @return void
     */
    protected function registerConfig()
    {
        $this->mergeConfigFrom(
            dirname(__DIR__) . '/Config/menu.php', 'menu.customer'
        );
    }
    

    config/menu.php of shop of my package

    <?php

    return [
    [
    'key' => 'account',
    'name' => 'shop::app.layouts.my-account',
    'route' =>'customer.profile.index',
    'sort' => 1
    ], [
    'key' => 'account.profile',
    'name' => 'shop::app.layouts.profile',
    'route' =>'customer.profile.index',
    'sort' => 1
    ], [
    'key' => 'account.address',
    'name' => 'shop::app.layouts.address',
    'route' =>'customer.address.index',
    'sort' => 2
    ], [
    'key' => 'account.reviews',
    'name' => 'shop::app.layouts.reviews',
    'route' =>'customer.reviews.index',
    'sort' => 3
    ], [
    'key' => 'account.wishlist',
    'name' => 'shop::app.layouts.wishlist',
    'route' =>'customer.wishlist.index',
    'sort' => 4
    ], [
    'key' => 'account.orders',
    'name' => 'shop::app.layouts.orders',
    'route' =>'customer.orders.index',
    'sort' => 5
    ]
    ];
    ?>

    and composer udpate also why i am getting undefined menu error again and again.

    Please reply

    Regards
    Deepak Sharma



  • Hi @dsharma

    Kindly make sure that serviceprovider's boot method calling composeView Method.

    $this->composeView();
    

    If this is there & still you are getting error, then attach a whole code of service provider so that we can check easily.

    Thanks



  • very helpful.

    Thankyou so much

    Regards
    Deepak Sharma


Log in to reply