本文介绍了如何在magento中以编程方式更新自定义选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有很多带有自定义选项的产品,现在我需要通过csv文件仅更新自定义选项.那么我们如何以编程方式做到这一点?
I have lot of products with custom options, now I have requirement to update only custom options through csv file. so how we can do this programatically?
推荐答案我找到了一种以编程方式更新自定义选项的解决方案,即解决方案
i found one solution for updating custom options programatically here is the solution
$product = Mage::getModel('catalog/product')->load($product_id); $values = array(); foreach ($product->getOptions() as $o) { $p = $o->getValues(); } } foreach($p as $v) { $values[$v->getId()]['option_type_id']= $v->getId(); $values[$v->getId()]['title']= 'test'; $values[$v->getId()]['price']= 23; $values[$v->getId()]['price_type']= 'fixed'; $values[$v->getId()]['sku']= $value1; } $v->setValues($values); $v->saveValues(); $product->save();希望这可以帮助某人 这只会更新自定义选项的值
hope this help someone this only update custom options value
更多推荐
如何在magento中以编程方式更新自定义选项?
发布评论