0

I went to the backend of magento I added a reference attribute for product, then I executed the script Programmatically to add product I put:

$_product->setName($product_data->_source->name);
$_product->setTypeId('simple');
$_product->setSku('sku'.$item);
$_product->setreference($product_data->_source->reference);
...
$_product->save();

but an error is displayed as following,

enter image description here please how to add an attribute and access it with set and thanks in advance

1 Answer 1

1

try to use this one

$_product->setName($product_data->_source->name);
$_product->setTypeId('simple');
$_product->setSku('sku'.$item);
$_product->setreference($product_data->_source->reference);
...
$_product->save();

I have changed

$_product->setreference($product_data->_source>reference);

to

$_product->setreference($product_data->_source->reference);

Your Answer

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