• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

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

override product model ERROR !!!

Modules
2
5
454
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 25 Aug 2019, 07:40

    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 27 Aug 2019, 07:41

      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 28 Aug 2019, 05:06

        Thanks....

        1 Reply Last reply Reply Quote 0
        • R
          RK REZA last edited by 28 Aug 2019, 05:08

          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 28 Aug 2019, 05:14

            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
            3 out of 5
            • First post
              3/5
              Last post