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
    770
    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 otheriz

      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

        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

          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

            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

              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

                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

                  @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

                    @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

                      @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
                      • V
                        Vaishali Agarwal last edited by

                        @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

                          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

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

                            Thanks

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