Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    override product model ERROR !!!

    Modules
    2
    5
    426
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      RK REZA last edited by

      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

      1 Reply Last reply Reply Quote 0
      • R
        rahul last edited by

        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

        1 Reply Last reply Reply Quote 0
        • R
          RK REZA last edited by

          Thanks....

          1 Reply Last reply Reply Quote 0
          • R
            RK REZA last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • R
              rahul last edited by

              Hi @RK-REZA

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

              Thanks

              1 Reply Last reply Reply Quote 0
              • First post
                Last post