首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

[原创] Magento 动态增添或修改商品的 Custom Option

2012-12-27 
[原创] Magento 动态添加或修改商品的 Custom Option  最近在 Magento 项目中有这样一种需求,在下订单时,

[原创] Magento 动态添加或修改商品的 Custom Option
  最近在 Magento 项目中有这样一种需求,在下订单时,修改该商品的 Custom Option。现列出一下解决方案:

  测试时使用的 Magento 版本是 1.7.0.2。

动态修改商品的 Custom Option


动态添加商品的 Custom Option
$options =  array('type' => 'radio',            'is_require' => 1,            'price' => 0,            'price_type' => 'fixed'); $values = array(            array(                'title' => '2kg',                'price' => 10,                'price_type' => 'fixed',                'sku' => 'w1',                'sort_order' => 1            ),             array(                'title' => '4kg',                'price' => 20,                'price_type' => 'fixed',                'sku' => 'w2',                'sort_order' => 2            ),             array(                'title' => '10kg',                'price' => 40,                'price_type' => 'fixed',                'sku' => 'w3',                'sort_order' => 3            )         ); setCustomOption(166, 'Weight', $options, $values);


FYI:
http://www.2coding.com/mage/magento-set-custom-option-product/http://stackoverflow.com/questions/10798158/how-to-update-custom-options-programatically-in-magento 1 楼 vb2005xu 7 小时前   1.6.1 以上 soap api中已经提供了对 自定义属性进行修改的api 我一般都是单独的 api调用来做这些事情 这样基本可以不去改里面的流程

热点排行