Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid option value when saving custom optons #4085

Closed
igrslv opened this issue Apr 10, 2016 · 10 comments
Closed

Invalid option value when saving custom optons #4085

igrslv opened this issue Apr 10, 2016 · 10 comments
Assignees
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@igrslv
Copy link

igrslv commented Apr 10, 2016

Steps to reproduce

  1. Add one custom option of drop-down Type
  2. Add a row
  3. Save the product
  4. Add another row whithout filling in any data in it
  5. Remove this row
  6. Save product

Expected result

Product must be saved without error messages.

Actual result

Error message appears: "Invalid option value".

@adifucan
Copy link
Contributor

Hi @igrslv I created an internal ticket MAGETWO-51756 to make errors reporting more intuitive

@igrslv
Copy link
Author

igrslv commented Apr 11, 2016

Hi @adifucan, consider this PR #4089

@mazhalai mazhalai added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Apr 11, 2016
@adifucan
Copy link
Contributor

Hi @igrslv! I cannot reproduce this bug: neither on CE nor on EE fresh develop.

After I save simple product product with 1 option and 2 values, add another 3rd row without filling in any data in it, remove this row & save the product, I get only 2 values in \Magento\Catalog\Model\Product\Option\Validator\Select::validateOptionValue without 'is_delete' key.

Can you recheck if this issue still occurs?

Thanks!

@igrslv
Copy link
Author

igrslv commented Apr 12, 2016

Hi @adifucan, the same steps as you described:

  1. saved the product with one drop-down option and two values
  2. added another empty row and immediately removed it
  3. saved the product once again

This is what a have as a dump of values in Magento\Catalog\Model\Product\Option\Validator\Select::validateOptionValue

Array
(
    [44] => Array
        (
            [sort_order] => 0
            [option_type_id] => 44
            [is_delete] => 
            [title] => Red
            [price] => 
            [price_type] => fixed
            [sku] => 
        )

    [45] => Array
        (
            [sort_order] => 1
            [option_type_id] => 45
            [is_delete] => 
            [title] => Blue
            [price] => 
            [price_type] => fixed
            [sku] => 
        )

    [46] => Array
        (
            [sort_order] => 2
            [option_type_id] => -1
            [is_delete] => 1
            [title] => 
            [price] => 
            [price_type] => fixed
            [sku] => 
        )

)

invalidoptionvalue

Version 2.0.4.

I have sent a pull request with cleaning out deleted values.

@adifucan
Copy link
Contributor

Hi @igrslv!

I could not reproduce this bug because I tested it on https://github.corp.magento.com/magento2/magento2ce/tree/develop and you are talking about https://github.corp.magento.com/magento2/magento2ce/tree/2.0, right?

I do not mind to merge your pull request but you need to create it for branch 2.0 but not develop as on develop this bug is not reproduced. Or I can create pull request by myself based on your fix.

One more remark is that you need to walk through array in \Magento\Catalog\Model\Product\Option\Validator\Select::validateOptionValue (string 72) not by foreach ($option->getData('values') as $value) but by foreach ($values as $value) because filtered deleted values are in $values array but not in $option->getData('values').

@igrslv
Copy link
Author

igrslv commented Apr 13, 2016

Hi @adifucan, please create PR. You are right, I had to create it for 2.0 branch. Thanks

@igrslv
Copy link
Author

igrslv commented Apr 13, 2016

@adifucan, according to foreach loop, this is actually another bug which is already fixed in the develop branch.

@shiftedreality shiftedreality self-assigned this Apr 13, 2016
@piotrekkaminski
Copy link
Contributor

@igrslv @adifucan can this be closed?

@adifucan
Copy link
Contributor

@piotrekkaminski yes please.

@shiftedreality
Copy link
Member

Closed.

magento-engcom-team pushed a commit that referenced this issue Apr 22, 2019
 MC-15873: Catch unserializer exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

6 participants