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
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']);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.