0

I am performing a mass product import and have automation scripts to handle all aspects of imports besides attribute assignments. I've spent many hours looking for resources for a solution and can't seem to find one, even through programming my own. So far I am successfully altering the product object but it's not actually saving or retaining the changes. It seems I'm finding a lot of contradicting information out there on how to go about it as well. Has anyone successfully written a script to accomplish this?

// This is my latest attempt. All variables are populated ($attributeName for example)

$product = Mage::getModel('catalog/product');
$product = Mage::getModel('catalog/product')->setCurrentStore(1)->load($product->getIdBySku($sku));
$product->getResource()->addAttributeUpdate($attributeName, $value, 0);

$product->getResource()->addAttributeUpdate($attributeName, $value, 0);
$product->save();

I've also been trying the following, once having the product and attribute objects similar to how I instantiated them earlier:

$product->addAttributeUpdate($attributeName, $value, 0);

$product->setData('diameter', '10.5');
$product->getResource()->saveAttribute($product, 'diameter', '2');

I'm really quite baffled at this point. Anyone with any suggestions? They'd be much appreciated. Thanks for your time!

  • Yep, I feel downright ridiculous, but I feel the documentation could be clearer on this. I was saving the value of the attribute, not the corresponding id of it. Once I returned the attribute ID it worked. Hopefully this helps someone someday. – Robert Kozora Oct 14 '16 at 19:40
0

You can use Bulk import module to import bulk product.

AvS Fast Simple Import.

for this module you have to create multidimensional array.

Note : You dont have to put attribute option id in this array (Attribute value will work).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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