Reputation: 519
I created my own attribute set in magento, let say "MyAttribSet" with a large number of option values.
How can I retrieve these values and assign/create to each one a simple product programatically?
I found code sample here, but I'm missing the latter part with option values:
I'm using Magento version is 1.5.0.1
Upvotes: 0
Views: 559
Reputation: 519
I solved the problem:
require_once 'app/Mage.php';
Mage::app('');
$attribute = Mage::getModel('eav/config')
->getAttribute('catalog_product', '955');
foreach ( $attribute->getSource()->getAllOptions(true) as $option){
//here comes the code sample (see link before)
.
.
.
$product->setMyCustomAttribute($option['value']);
}
Upvotes: 1