2

我非常希望将简单产品(只有简单产品)的自定义选项(类型:无线电输入)移到右列。

现在,它们似乎显示在页面底部的一个名为“container2”的容器中,并在 view.phtml 中调用如下:

<div class="clearer"></div>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>

Container2 也在内容块内的布局文件 catalog.xml 中。

所以我所做的只是将选项包装器从引用 name="content" 块中移出,一个新的:reference name="right" 。

由于某种原因,代码在这里的格式并不正确,而且还缺少一些位,所以我将其粘贴在这里: http: //pastebin.com/nhCUXcF4

基本上我可以在右栏中看到我的选项,但是当我单击它时,就像没有检查无线电输入一样,因为它要求再次选择一个选项(它们是必需的)

如果我将选项留在内容块中,在底部的 container2 中,它们可以正常工作,就像我单击一个一样,它被正确检查。如果我没有选中任何并单击添加到购物车,它会要求选择所需的选项。

我认为问题来自我不太了解的 container1 、 container2 东西。我还在目录 XML 中看到它们是一些代码,例如

<block type="core/template_facade" name="product.info.container2" as="container2">
<action method="setDataByKey"><key>alias_in_layout</key><value>container2</value>    </action>
   <action method="setDataByKeyFromRegistry"><key>options_container</key
    <key_in_registry>product</key_in_registry></action>
 <action method="append"><block>product.info.options.wrapper</block></action>
 <action method="append"><block>product.info.options.wrapper.bottom</block></action>
</block>

所以基本上我的问题是如何正确地将所需选项从 view.phtml (产品页面)的内容移动到右列?现在绝对感谢任何帮助。谢谢。

4

1 回答 1

2

There's a much simpler way to do this.

instead of using the 3-column, or 2column-right layouts use the 1column layout and then add the right hand column into the product view template file like this:

<div class="col-right sidebar">
    <?php if ($_product->isSaleable() && $this->hasOptions()):?>
    <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
    <?php endif;?>
</div>

It's a lot easier to change the CSS for the product view page than it is to change the blocks around etc.

于 2013-03-01T16:41:11.030 回答