开发者

How to create simple product to attribute option value in magento

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 vers开发者_如何学Goion 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']);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜