如何在magento中创建简单的产品属性选项值


How to create simple product to attribute option value in magento

我在magento中创建了自己的属性集,比如"MyAttribSet",其中包含大量的选项值。
我如何检索这些值并以编程方式为每个值分配/创建一个简单的产品?我在这里找到了代码示例,但是我缺少选项值的后一部分:

我使用的Magento版本是1.5.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']);
}