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

0

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, privacy policy and cookie policy