0

I have try to addAttributeOption() integer value add in database using my code.

But i have facing on error message when i have add integer value in CSV

(1) Not Working CSV:- 70024,70014,70010,70624,70040,70017,70014,70010

(2) Working CSV:- A550-24,B55014,C55010,D94624,E75040,F75017,G75014,H75010,I55334

Error message is SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails

My part of code is

foreach ($attribute_arr as $key=>$value) {

        $option['value'][$value][0]=$value;

        foreach($allStores as $skey =>$svalue){

            $option['value'][$value][$skey] = $value;

        }

    }

$eavSetup = $this->_eavSetupFactory->create();

$eavSetup->addAttributeOption($option);

1
  • Can you post the full code that you're using?
    – Haim
    Commented Nov 23, 2018 at 12:44

1 Answer 1

0

You have 70014 and 70010 twice in your array

1
  • 1
    This should be in the comment section. Please avoid one line answers and try to explain as much as possible. Commented Nov 23, 2018 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.