我在magento中创建了自己的属性集,假设“MyAttribSet”包含大量选项值。
如何检索这些值并以编程方式为每个值分配/创建一个简单的产品?
I found code sample here, but I'm missing the latter part with option values:
我使用的Magento版本是1.5.0.1
答案 0 :(得分:1)
我解决了这个问题:
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']);
}