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!

Amit Bera
77.8k21 gold badges127 silver badges240 bronze badges
asked Oct 14, 2016 at 17:01
1
  • 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. Commented Oct 14, 2016 at 19:40

1 Answer 1

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).

answered Oct 15, 2016 at 7:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.