2014-03-05 21 views
0

,在我的config.xml文件<catalog_product_view>下面用於觸發產品評論和它的形式。將我的主題的config.xml中的product/view.phtml中的childhtml移動到product/view/description.phtml

<catalog_product_view translate="label"> 
     <label>Catalog Product View (Any)</label> 

    <reference name="catalog_product_price_template"> 
      <action method="addPriceBlockType"><type>simple</type><block>catalog/product_price</block><template>catalog/product/productpageprice.phtml</template></action> 
     </reference>  

     <!-- Mage_Catalog --> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="head"> 
      <action method="addJs"><script>varien/product.js</script></action> 
      <action method="addJs"><script>varien/configurable.js</script></action> 

      <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action> 
      <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action> 
      <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action> 
     </reference> 
     <reference name="content"> 
      <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml"> 
       <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/> 
       <block type="core/text_list" name="alert.urls" as="alert_urls" translate="label"> 
        <label>Alert Urls</label> 
       </block> 

     <block type="review/product_view_list" name="review.list" as="review_list" template="review/product/view/list.phtml"> 
       <block type="review/form" name="product.review.form" as="review_form"> 
      <block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label"> 
      <label>Review Form Fields Before</label> 
      <action method="setMayBeInvisible"><value>1</value></action> 
      </block> 
     </block> 
     </block> 

       <action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action> 

       <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml"> 
        <action method="setColumnCount"><columns>4</columns></action> 
        <action method="setItemLimit"><type>upsell</type><limit>20</limit></action> 
       </block> 

     <block type="core/text_list" name="product.info.short_des_after" as="short_des_after" translate="label"> 
        <label>Product View Short Description After</label> 
       </block> 

       <block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" /> 
       <block type="core/template" name="product.info.additonal_collateral" as="product_additional_collateral" template="catalog/product/view/additional_collateral.phtml" translate="label"> 
        <label>Add Extra Tabs of Collateral</label> 
       </block> 

        <action method="addToParentGroup"><group>detailed_info</group></action> 
       </block> 
       <block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="catalog/product/view/attributes.phtml"> 
        <action method="addToParentGroup"><group>detailed_info</group></action> 
       </block> 



     <!-- Custom --> 

     <block type="catalog/product_view_inthebox" name="product.inthebox" as="inthebox" template="catalog/product/view/inthebox.phtml"> 
        <action method="addToParentGroup"><group>detailed_info</group></action> 
       </block> 

     <block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml"> 
     <action method="addToParentGroup"><group>detailed_info</group></action> 
      <!-- added --> 
      <block type="review/product_view_list" name="review.list" as="review_list" template="review/product/view/list.phtml"> 
       <block type="review/form" name="product.review.form" as="review_form"> 
       <block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label"> 
        <label>Review Form Fields Before</label> 
        <action method="setMayBeInvisible"><value>1</value></action> 
       </block> 
       </block> 
      </block> 
     </block> 

       <block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addtoproductview.phtml"/> 
     <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocartproductview.phtml"/> 
     <!-- Custom --> 

       <!--<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml"/>--> 

       <block type="core/text_list" name="product.info.extrahint" as="extrahint" translate="label"> 
        <label>Product View Extra Hint</label> 
       </block> 

       <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> 
       <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label"> 
        <label>Bottom Block Options Wrapper</label> 
        <action method="insert"><block>product.tierprices</block></action> 
        <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/> 
        <action method="append"><block>product.info.addtocart</block></action> 
        <action method="append"><block>product.info.addto</block></action> 
       </block> 

       <block type="core/template_facade" name="product.info.container1" as="container1"> 
        <action method="setDataByKey"><key>alias_in_layout</key><value>container1</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> 
       <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> 
       <action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action> 
       <action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action> 

     <block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/> 
     <block type="catalog/product_price" name="catalog.product.price" template="catalog/product/productpageprice.phtml"/> 

    </block> 
     </reference> 

     <reference name="right"> 
      <!--block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/--> 
     </reference> 

    </catalog_product_view> 

,並使用<?php echo $this->getChildHtml('review_list') ?>在我的主題product/view.phtml顯示與形式審查審查。

現在我試圖在product/view/description.phtml中使用<?php echo $this->getChildHtml('review_list') ?>,但它顯示爲空。

任何解決方案來解決這個問題?

回答

1

開放Magento的\ APP \設計\前臺\ DEFAULT \ DEFAULT \佈局\的catalog.xml

找到

<block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml"> 
         <action method="addToParentGroup"><group>detailed_info</group></action> 

</block> 

替換爲上述 「目錄/ product_view_description」 的一個

<catalog_product_view translate="label"> 
    ........ 
    <reference name="content"> 
    ...... 
     <block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml"> 
         <action method="addToParentGroup"><group>detailed_info</group></action> 
         <!-- added--> 
         <block type="review/product_view_list" name="review.list" as="review_list" template="review/product/view/list.phtml"> 
          <block type="review/form" name="product.review.form" as="review_form"> 
          <block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label"> 
           <label>Review Form Fields Before</label> 
           <action method="setMayBeInvisible"><value>1</value></action> 
          </block> 
          </block> 
         </block> 
         <!-- added --> 
    </block> 
..... 
</reference name="content"> 
.............. 
</catalog_product_view> 

and in magento \ app \ design \ frontend \ defa ULT \ DEFAULT \模板\目錄\產品\圖\ description.phtml

<?php echo $this->getChildHtml('review_list') ?> 

希望這有助於你

+0

真棒你!它工作,但更新產品頁面上的catalog.xml描述選項卡出現兩次後的一個小錯誤? –

+0

在catalog.xml中使用哪個xml? – shivam

+0

不,我沒有做任何改變,除了我目前激活的主題 –

相關問題