- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试在产品详细信息页面上获取选定的 bundle 选项标题和值。
单位颜色*:Antelope Audio Zodiac 数模转换器 +£0.00
我使用下面的代码但它返回选项列表而不是选择的选项值但不是像Unit color这样的标题
$bundled_product = new Mage_Catalog_Model_Product();
$bundled_product->load($_product->getId());
$selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
$bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
);
$bundled_items = array();
foreach($selectionCollection as $option)
{
echo "<pre>";
print_r($option);die;
$bundled_items[] = $option->product_id;
}
请同时检查下图。
所以请建议我如何获得标题和选定的值。
谢谢
最佳答案
免责声明:此代码段适用于 magento 演示站点上的捆绑产品: http://demo.magentocommerce.com/my-computer.html
如果我将以下带有前缀 javascript:
和后缀 generate_options_label_and_value()
的代码段放入浏览器 URL 栏中,它对单选按钮工作正常。如果您需要更多扩展案例(支持下拉菜单/复选框),请告诉我。这只是一个简短的片段:
function generate_options_label_and_value(){
var generated_html = '';
$$("#product-options-wrapper>dl>dt").each( function (dt){
if(dt.next('dd').select('input:checked[type=radio]').length > 0 ){
generated_html += dt.select("label")[0].innerHTML;
generated_html += dt.next('dd').select('input:checked[type=radio]')[0].next('span').innerHTML;
}
});
if(!$('selected_options_div')){
$$('.add-to-cart')[0].insert({ top : "<div id='selected_options_div'></div>"});
}
$('selected_options_div').update(generated_html);
}
这是用原型(prototype)写的
关于php - Magento : How to get selected bundle option title and value from bundle product?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19403017/
有什么方法可以覆盖无法直接编辑的页面标题,只能在页眉中添加 Javascript? 我不能直接编辑的行是: Title of the page 我能想到的解决这个问题的唯一方法是在我可以通过我的门户后
这是我的基础文件 {% load static %} {% include "feed/header.html" %} {% block content%} {% endblock %} {% inc
请说明 之间有什么区别标记和 标签。 Page title 如果两者都使用,哪个最优先? 我观察到一些网站同时具有 和 tags 和 两者相同,这是预期的,请确认? 如果我们不使用 标签标题,我
我有一个带有唯一title的表_primary,并且我有一个需要设置引用title的表_secondary > 对于 _primary 表。 最佳答案 尝试这个解决方案并让我知道它对您有用。 ALTE
我正在尝试学习使用 PDO 而不是 MySQLi 进行数据库访问,但我在从数据库中选择数据时遇到了问题。我想使用: $STH = $DBH->query('SELECT * FROM ratings
我了解 title 和 alt 属性的用途,但我只是不了解它们的最佳用途,或者我是否可以使用相同的 title /alt 不止一次。 例如,以一个关于狗的网站为例: 根据我的理解,所有 img 标签都
我分配了一个带有标题 (initWithTitle) 的 UITabBarItem 并将其连接到 UINavigationController。 我发现,如果导航 Controller 的 Root
我有标签栏和导航栏。在导航栏中我有表格 View 。问题是,当我在 IB 中将标题设置为选项卡栏,然后在 TableView 中设置标题时,选项卡栏标题将更改为 TableView 中的标题,并且我在
在我的 JSP 页面中,我使用 显示页面标题,有时可以,但有时页面显示无法cpmplie代码 。所以我将代码更改为 ${TITLE} ,也可以。 有什么不同和${TITLE}在jsp中? 这是我的页
我目前正在向 Jade 和 node.js 介绍自己 由于我想避免冗余,我想到将域名附加到当前标题,例如Blog | example.com 我的 Jade 模板得到了 Blog通过 Node.js
//Sorting userDefined object from ArrayList<>... import java.io.*; import java.util.*; class Song
我的网站有这两个元标记,它们目前具有相同的值: 第二个是 facebook 连接所需的格式。 这是否意味着第一个是多余的并且可以删除? 最佳答案 最好同时存在这两个标签。该标签告诉搜索引擎有
我现在对 ASP.NET MVC 的 Razor ViewEngine 感到困惑。 大多数人会说: View.Title 与相同 ViewData["Title"] 运行应用程序后我得到了这个 Com
UIViewController 的 title 属性的用途是什么,不能用 navigationItem.title 设置标题吗? 两者似乎都有效,我只是想知道为什么会有这种看似重复的功能。 最佳答案
我仍在学习如何将 API 数据与 react 和 nextjs 一起使用。但是,为什么我的函数只在我编写 {props.props.title} 而不是我期望的 {props.title} 时起作用?
我正在尝试编写一个从URL提取的正则表达式,但是问题是“。”与我们已经知道的不匹配换行符。如何编写正则表达式以匹配和提取pageTitle(。*?),但换行符可能介于 我在用grails。 最佳答案
我仍在学习如何将 API 数据与 react 和 nextjs 一起使用。但是,为什么我的函数只在我编写 {props.props.title} 而不是我期望的 {props.title} 时起作用?
我正在 github 上创建一个库,所以我为此使用了一个 Markdown 文件,其结构如下: # My main title ## My first section ... ## My second
我在某些地方看到,为了从 props 中获取 title 的值,我们使用 {`${props.title} `} 而在其他一些地方,我们使用它 {props.title} 有什么区别? 最佳答案 第一
我想使用 IMG 标签的 TITLE 属性,为图像创建标题: HTML CSS img[title]:after{content:attr(title);} 但是无论是在 IE、Firefox 还是
我是一名优秀的程序员,十分优秀!