我已将捆绑产品 sku 与简单产品相关联。
现在我正在尝试获取捆绑的产品选项。
$selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
$bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
我已经使用了上面的代码,但它返回了捆绑下的所有简单产品。但我想要一系列选项。从选项中我想要选择数组,以便我可以为每个捆绑的选项迭代并创建下拉列表
我查看了核心 select.phtml
<select onchange="bundle.changeSelection(this)" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select change-container-classname">
<option value=""><?php echo $this->__('Choose a option') ?></option>
<?php foreach ($_selections as $_selection): ?>
<option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php echo $this->getSelectionTitlePrice($_selection, false) ?></option>
<?php endforeach; ?>
</select>
我想在 view.phtml 上复制类似的东西。但是我无法访问这些方法。有谁知道我该怎么做。