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

Bagisto

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

Edit Attribute -> Add Option or Swatch Item Error 404

Bug Report
2
14
735
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.
  • O
    otheriz last edited by 11 May 2020, 11:15

    Dear Bagisto team,

    I have some strange bug,
    every time i want to edit attribute with "select" type and add option item, when i save it..
    it goes to page "404 Page Not found"..

    When i edit it without touching the "Option" tab it working well..

    Thank You

    1 Reply Last reply Reply Quote 0
    • V
      Vaishali Agarwal last edited by 11 May 2020, 17:18

      hi @otheriz
      could you mention your bagisto version?

      1 Reply Last reply Reply Quote 0
      • O
        otheriz last edited by otheriz 12 May 2020, 14:56 12 May 2020, 14:47

        hi @Vaishali-Agarwal

        i think it is v1.1.0 (via PHP artisan bagisto:version)
        but recently i already use command from git "git pull" and successfully get the new file from git.
        why it's not updated to v1.1.2 even i have "## v1.1.2 (24th of March 2020) - Release" info on my "CHANGELOG for v1.x.x.md" file..
        i even then use "composer update"..

        back to the topic...the only think i change only delete unneeded language and leave only English..then add 2 more languages Arabic and indonesia...
        i don't know if this related to the problem..

        like i mention before..the problem only occurred when i add the option item then try to save it..if i change anything except the option item, it can save successfully..

        Here's the screenshot when the error 404 occured
        alt text

        1 Reply Last reply Reply Quote 0
        • O
          otheriz last edited by otheriz 14 May 2020, 15:54 14 May 2020, 12:46

          As an additional, this add option problem not occurred when use add new attribute..
          Only on edit..

          please verify if this is the cause

          this is the form data send
          01f3f4e2-8162-4e16-b6e9-6520db727758-image.png

          and this is the cause of the error https://github.com/bagisto/bagisto/blob/master/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php#L93
          5aa60a23-0021-4cec-b8ad-0dce3776cbdd-image.png

          some how..it always call/trigger ....->update() instead of ...->create() because it never find any "option_" value...

          as it is new option id..when the update triggered..it's not found any existing data..and somehow it throws an error 404 page not found...

          when i disable those line..it worked..and of course, the option item not added(because i disabled the script)

          1 Reply Last reply Reply Quote 0
          • O
            otheriz last edited by 14 May 2020, 16:15

            i Found suspicious form data..
            when i see the form data on bagisto live demo..the output is
            f2fb89f0-cc16-41c0-a286-cdd8fb5dcdad-image.png

            while on my form data is
            42c56404-aed1-401f-8329-593a42cdd4ff-image.png

            1 Reply Last reply Reply Quote 0
            • O
              otheriz last edited by 14 May 2020, 16:22

              I have found the way to regenerate this problem...even from live demo..
              just try to add Indonesia language
              1fe545ca-eac8-4368-8ea9-479c251f86c9-image.png

              then try to add option item on "Catalog -> attributes -> any item with type 'select'" then save..
              same problem
              622048ca-d6e9-40f3-92ad-eeaa2a8d9f2b-image.png

              form data
              a73da088-c677-4698-8a38-3a7997cb04be-image.png

              1 Reply Last reply Reply Quote 0
              • V
                Vaishali Agarwal last edited by 14 May 2020, 16:28

                Hi @otheriz
                We appreciated your efforts to finally debugging the issue.
                I've also able to reproduce this issue.

                You could raise the issue on github community https://github.com/bagisto/bagisto/issues

                Thanks.

                1 Reply Last reply Reply Quote 0
                • O
                  otheriz last edited by 14 May 2020, 16:40

                  Dear @Vaishali-Agarwal ,

                  i will post it on the issue..somehow..i try several country..
                  it only happen on my country code "id"..
                  i guess because it same as script "$id"..

                  ---___---

                  1 Reply Last reply Reply Quote 0
                  • V
                    Vaishali Agarwal last edited by 14 May 2020, 16:45

                    @otheriz
                    That could also be the reason behind this issue.
                    As i have checked the indonesia locale code is in_ID

                    Please once try this https://prnt.sc/sgtjth, it might resolve your issue. ☺

                    1 Reply Last reply Reply Quote 0
                    • O
                      otheriz last edited by otheriz 14 May 2020, 18:16 14 May 2020, 17:30

                      @Vaishali-Agarwal

                      it's better to use 3 letter ISO code (idn) other than local code..
                      but it too much to update it..since i already create much translation..

                      so the other workaround for this issue is i updated this line..
                      in short:
                      in this file https://github.com/bagisto/bagisto/blob/master/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php
                      Change all string 'id' with other than 'id' like 'getID' or whatever..
                      then replace all variable ".id" with ".getID" (whatever you change)

                      in Long explanation :
                      i updated this line..
                      https://github.com/bagisto/bagisto/blob/master/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php#L468

                      from

                      let row = {'id': id};
                      

                      to (other than "id")

                      let row = {'getID': id};
                      

                      and change all "row.id" variable after those line to "row.getID"
                      Specifically these lines
                      Line 485,Line 495,Line 499, and Line 503

                      also change this line (or when we reload the attribute it will get option[undefined][])
                      https://github.com/bagisto/bagisto/blob/master/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php#L432

                      from

                      'id': '{{ $option->id }}'
                      

                      to (same as above changing)

                      'getID': '{{ $option->id }}'
                      

                      and change also "row.id" at optionRows inside tag "options-template" to "row.getID"

                      Specifically this two lines
                      Line 364 and Line 369

                      and the variable below that refer to it at :
                      Line 522
                      from "optionRow.id" to "optionRow.getID"

                      and it worked perfectly

                      1 Reply Last reply Reply Quote 0
                      • V
                        Vaishali Agarwal last edited by 15 May 2020, 04:45

                        @otheriz
                        we will check the feasibility to use ISO Code instead of locale code.
                        Thanks for the suggestion.

                        1 Reply Last reply Reply Quote 0
                        • 21 days later
                        • V
                          Vaishali Agarwal last edited by 5 Jun 2020, 15:03

                          @otheriz
                          this query is resolved on github community raised by you, please check it here https://github.com/bagisto/bagisto/issues/3070

                          Do let us know if still any doubt.
                          Thanks

                          1 Reply Last reply Reply Quote 0
                          • O
                            otheriz last edited by 8 Jun 2020, 11:11

                            Hi @Vaishali-Agarwal ,

                            I tried with your updated code, and pull from the master..it's worked perfectly now..

                            thank you for the fixed.

                            1 Reply Last reply Reply Quote 0
                            • V
                              Vaishali Agarwal last edited by 8 Jun 2020, 11:43

                              Hi @otheriz
                              Glad to hear that your issue is being resolved!! 🙂

                              Thanks

                              1 Reply Last reply Reply Quote 0
                              4 out of 14
                              • First post
                                4/14
                                Last post