magento获得产品的custom option信息 Getting all custom options of a product
来源:互联网 发布:nginx 别名配置 编辑:程序博客网 时间:2024/06/07 01:31
Custom options are the options that can be added to any product, which gives an option for the user of the site to select what type of product they actually want. Here is a scenario where custom option can be helpful. If you have a product say ball and your stores sells plastic,rubber,glass balls. So you need to give the user to select what type of ball they actually want. Yes, you can do this by using configurable product as well, but why create an attribute for one product only! In this case custom option might be very helpful.
Here’s the code to get the all the custom options of a product. Please see that you need to specify the id of the product for which you are retriving custom option for. I’ve echoed some text as well to give you an idea what exactly you are getting in each loop.
$product = Mage::getModel("catalog/product")->load(167); $i = 1; echo "<pre>"; foreach ($product->getOptions() as $o) { echo "<strong>Custom Option:" . $i . "</strong><br/>"; echo "Custom Option TYPE: " . $o->getType() . "<br/>"; echo "Custom Option TITLE: " . $o->getTitle() . "<br/>"; echo "Custom Option Values: <br/>"; // Getting Values if it has option values, case of select,dropdown,radio,multiselect $values = $o->getValues(); foreach ($values as $v) { print_r($v->getData()); } $i++; echo "----------------------------------<br/>"; }
- magento获得产品的custom option信息 Getting all custom options of a product
- 获得magento simple product的custom option信息
- Magento How To Display Product Custom Option On list.phtml
- magento 更新 custom option 的data数据
- Magento中在产品页中显示Custom Option中定义的SKU
- Magento Custom Options Templates (完美)
- 插件: images and custom options,magento添加多图片,自定义选项custom options,catelog,分类的插件以及使用方法!!!
- magento custom product api (1)--- infomobile
- magento custom product api (2) --- getskubyurl
- magento custom product api (3) --- getupdatedproducts
- magento custom product api(4) --- getallproducts
- Magento admin order item update custom option
- magento导入导出Custom Options, Tier Prices and Grouped Products
- 将自定义选项(custom options)批量导入Magento
- 将自定义选项(custom options)批量导入Magento(一)
- Magento Custom Options - saving new values doesn't work
- Writing a custom module in Magento
- Create A Custom Theme in Magento
- JSON字符串和java对象的互转
- 关于事件的小题
- ASP.NET使用递归算法实现画树程序
- LeetCode121. Best Time to Buy and Sell Stock
- Swift 构造过程 1
- magento获得产品的custom option信息 Getting all custom options of a product
- 子树
- linux 设置gedit文本编辑器-字体颜色、显示行号、插件、制表符等
- 在一个整型数组中有两个数 a 、b值出现一次,其他数都出现两次。求出 a 和 b
- Qt下双屏的显示方法
- 汇编指令之CMOVcc-----CMOVG
- Java集合 03
- QT Q_OBJECT使用注意事项
- Python——isinstance函数