override product model ERROR !!!



  • I was trying to override Product. But when I create my own view & route same as Product/Admin this error occurred.

    2.PNG

    Where is the $productTypes coming from?
    1.PNG



  • Hi @RK-REZA

    Place this code in your package's service provider & called in boot method of your service provider.

    public function composeView() {
            view()->composer(['typehint::view file path'], function ($view) {
                $items = array();
    
                foreach (config('product-types') as $item) {
                    $item['children'] = [];
    
                    array_push($items, $item);
                }
    
                $types = core()->sortItems($items);
    
                $view->with('productTypes', $types);
            });
        }
    

    Thanks



  • Thanks....



  • Do I have to add this

    $this->publishes([
            dirname(__DIR__) . '/../Config/imagecache.php' => config_path('imagecache.php'),
    ]);
    

    in my service provider? or It will automatically call from Webkul/Product's service provider?



  • Hi @RK-REZA

    If you have added any new type then you need to do this otherwise not.

    Thanks


Log in to reply