如何在magento中以编程方式更新自定义选项?

编程入门 行业动态 更新时间:2024-10-24 14:21:50
本文介绍了如何在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中以编程方式更新自定义选项?

本文发布于:2023-11-28 07:31:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641482.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   中以   选项   方式   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!