2011-02-18 79 views
4

在文件$MAGENTO_PATHapp/design/frontend/base/default/template/catalog/product/view/options/wrapper.phtml,我看到下面的代码行:Magento的 - 产品选项查看或控制文件

<?php echo $this->getChildHtml('', true, true);?> 

这是负责印刷的产品页面上的产品选项。我想要理解和修改这行代码生成的html内容,但我似乎无法找到与其相关的视图或控制器。例如,假设我想以编程方式添加字符& nbsp;到下拉菜单中的每个选项元素的innerHTML,我可以编辑哪个phtml,php或html文件?

我希望能回答这个问题会帮助我了解如何检索产品选择,这反过来将帮助我解决这个更直接的问题:

Magento - Query for Product Options

回答

7

当传递一个空值任何getChild函数都会使用所有孩子。在这种情况下,getChildHtml(''...返回每个toHtml输出的结果。

要找出它的孩子们,我们需要参考catalog.xml布局文件:

<block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label"> 
    <label>Info Column Options Wrapper</label> 
    <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/> 
     <block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml"> 
      <action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action> 
      <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action> 
      <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action> 
      <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action> 
     </block> 
    <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/> 
</block> 

您也许能够从你的包装块有一个“选项”孙其具有杂乱乱看几种可能选项的渲染器。对于下拉菜单,您可能需要编辑catalog/product/view/options/type/select.phtml