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

Bagisto

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

Create Category using CategoryRepository

Knowledge Base
2
8
348
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.
  • A
    alggan4 last edited by ghermans 28 Mar 2023, 15:27 21 Mar 2023, 14:56

    Using this function I try to create Category.

    All fields are saving in category and category_translations tables correctly, but url_path every times is null.

    Where is the error?

    private function createCategory(CategoryRepository $categoryRepository, $data)
        {
            return $categoryRepository->create([
                "locale" => "all",
                "name" => $data['name'],
                "status" => 1,
                "position" => $data['position'],
                "display_mode" => "products_and_description",
                "description" => "",
                "image" => ["image_1" => ""],
                "meta_title" => "meta title",
                "slug" => $data['slug'],
                "url_path" => 'correct/url/path',
                "parent_id" => $data['parent_id'],
                "meta_description" => "some description",
                "meta_keywords" => "some keywords",
            ]);
        }
    
    1 Reply Last reply Reply Quote 0
    • sanjay-webkul
      sanjay-webkul last edited by 22 Mar 2023, 07:24

      Hi there,
      I guess the triggers are missing in your db
      please run the below command and try again.

      php artisan migrate:refresh --path=/packages/Webkul/Shop/src/Database/Migrations/2020_01_06_173524_alter_stored_function_url_path_category.php
      1 Reply Last reply Reply Quote 0
      • A
        alggan4 last edited by alggan4 22 Mar 2023, 07:43 22 Mar 2023, 07:42

        Hi
        You are right .
        But I got error :
        File does not exist at path ..packages/Webkul/Shop/src/Database/Migrations/2020_01_06_173524_alter_stored_function_url_path_category.php.

        But in this path I had only 2 migrations:
        2019_11_21_194541_add_column_url_path_to_category_translations.php
        2023_03_02_193725_remove_functions_and_trigger.php

        It's looks like I working in wrong version of bugista ?

        1 Reply Last reply Reply Quote 0
        • sanjay-webkul
          sanjay-webkul last edited by 22 Mar 2023, 08:01

          Which version of Bagisto are you using?

          1 Reply Last reply Reply Quote 0
          • A
            alggan4 last edited by 22 Mar 2023, 08:37

            omg... I'm on master branch (

            1 Reply Last reply Reply Quote 0
            • sanjay-webkul
              sanjay-webkul last edited by 22 Mar 2023, 09:45

              Hi there.
              Please use our latest version V1.4.5.
              And if you are facing any issue on our master branch then you can raise a bug on our GitHub repository.

              1 Reply Last reply Reply Quote 0
              • A
                alggan4 last edited by 22 Mar 2023, 22:28

                After download and install bagisto 1.4.5 I got this.
                I'm not sure if this is a problem in bagisto, maybe in my environment settings.

                1 Reply Last reply Reply Quote 0
                • sanjay-webkul
                  sanjay-webkul last edited by 23 Mar 2023, 08:30

                  Hi there.
                  Please follow this thread.

                  1 Reply Last reply Reply Quote 0
                  6 out of 8
                  • First post
                    6/8
                    Last post