2011-02-18 16 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