Edit Attribute -> Add Option or Swatch Item Error 404
-
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
-
hi @otheriz
could you mention your bagisto version? -
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
-
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
and this is the cause of the error https://github.com/bagisto/bagisto/blob/master/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php#L93
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)
-
i Found suspicious form data..
when i see the form data on bagisto live demo..the output is
while on my form data is
-
I have found the way to regenerate this problem...even from live demo..
just try to add Indonesia language
then try to add option item on "Catalog -> attributes -> any item with type 'select'" then save..
same problem
form data
-
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.
-
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"..---___---
-
@otheriz
That could also be the reason behind this issue.
As i have checked the indonesia locale code is in_IDPlease once try this https://prnt.sc/sgtjth, it might resolve your issue.
-
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#L468from
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 503also 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#L432from
'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 369and the variable below that refer to it at :
Line 522
from "optionRow.id" to "optionRow.getID"and it worked perfectly
-
@otheriz
we will check the feasibility to use ISO Code instead of locale code.
Thanks for the suggestion. -
@otheriz
this query is resolved on github community raised by you, please check it here https://github.com/bagisto/bagisto/issues/3070Do let us know if still any doubt.
Thanks -
Hi @Vaishali-Agarwal ,
I tried with your updated code, and pull from the master..it's worked perfectly now..
thank you for the fixed.
-
Hi @otheriz
Glad to hear that your issue is being resolved!!Thanks