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/>";
}
Happy coding in Magento!
来源: http://subesh.com.np/2009/12/custom-options-product-magento/
分享到:
相关推荐
magento custom menu 可以自己定制的导航菜单
Magento导入导出产品插件 编辑csv表格导入产品 Import Products categories multiple images and custom options 1 1 2 tgz 与官方插件一样
magento通过产品名称获取产品id提示代码
Get a detailed insight into the structure of Magento Learn about event/observer-driven modules Get a hands-on introduction to custom shipping and payment methods ☆ 出版信息:☆ [作者信息] Branko ...
You’ll start by getting a general understanding of what Magento is, why and how you should use it, and whether it is possible and feasible to migrate from an old web store to Magento 2. As you work ...
Chapter 1, Installing Magento 2 on Apache and NGINX, is a totally different ballgame compared to Magento 1. Where Magento 1 could be installed through FTP or SSH, Magento 2 is installable only via the...
如何给产品描述里的关键字、字词批量添加链接?我想大家一直在的这样的插件。说实话,我也找了很久,也没有找到。可是由于需要,不得不自己开发一个这样的插件。并支持到Magento1.6.2 说明请查看:...
Buildateam的Magento2的自定义产品生成器Custom Product Builder是一个独特的工具,它在一个易于使用的应用程序中结合了产品定制“构建您自己的产品”功能和产品个性化(添加会标和艺术品)功能,并具有实时产品预览...
magento站点首页显示新产品及产品数量,可在block块中设置产品数量
magento2-custom-header
为什么magento产品不改变“缺货”尽管数量已经低于最低
无需进入产品产品详情页就可以预览产品图片,商店访问者也可以通过单击项目图片进入产品页面而没有任何问题(禁止用作商业用途)
“#magento2custom”
magento产品名称及描述批量修改sql
Magento1.7测试可用 批量产品多图上传 包含上传样本
config-options-stock-m2 Magento 2产品可配置选项库存状态v.1.0.0 描述简单的Magento 2.x模块,如果选项设置为“缺货”,则可以将“缺货”标签添加到“产品自定义选项” 安装将模块文件复制到magento安装目录中运行...
custom-reports, 使用SQL定制Magento报告 使用Google图表 API 定制Magento报告使用custom或者使用magento管理网格( ),轻松创建报表,并使用magento来显示它们。 功能报告结果表定义列配置或者允许自动配置的能力。...
magento导入导出产品分类
Magento 2最受欢迎的产品滑块 它是如何工作的? 当您启用Magento 2产品滑块模块并在配置中创建产品滑块时,您的产品列表将以生动有趣的方式在店面中滑出,并带有您之前选择的动画效果。 除了产品图片之外,您的客户...