2016-07-06 67 views
-1

我在catalog.xml文件中添加了以下代碼,現在評論部分顯示在產品視圖頁面中。但我想只顯示在特定的選項卡下。使用phtml代碼而不是xml代碼來顯示評論

<block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml"> 
<block type="review/form" name="product.review.form" as="review_form"/></block> 

有什麼方法可以使用phtml代碼來顯示此評論部分。

,所以我打算使用PHTML代碼標籤

+0

在該選項卡中要顯示它?你有沒有在view.phtml上顯示的所有標籤代碼? –

+0

@PankajPareek請檢查[這裏](http://sbdev2.kidsdial.com/vintage-retro-bicycle-background-apple-iphone-4-phone-case.html),在「評論」選項卡下,我想顯示審查部分 – fresher

+0

@PankajPareek我在查看頁面顯示4個標籤,在一個特定的標籤下,我想顯示評論部分。 – fresher

回答

0
<?php 
$reviewListBlock = $this->getLayout()->createBlock('review/product_view_list'); 
$reviewFormBlock = $this->getLayout()->createBlock('review/form'); 

echo $reviewListBlock->setTemplate('review/product/view/list.phtml')->toHtml(); 
echo $reviewFormBlock->setTemplate('review/form.phtml')->toHtml(); 
?> 
2

下,您可以在特定選項卡的內容調用getChildHtml函數來調用特定的塊的內容。如下圖所示:

echo $this->getChildHtml('product_review'); 

echo $this->getChildHtml('review_form'); 
+0

我不知道爲什麼它沒有爲我工作。可能是我做錯了什麼。 Thansk非常感謝您的支持。我有解決方案。 – fresher

+0

如果你點擊'添加評論'選項卡[這裏],你可以看到2部分,其中一條是已發佈的評論。 另一部分是'寫你自己的評論',我想在另一個標籤中顯示'寫你自己的評論'部分。 – fresher

+0

我也爲那個解決方案,我還有一個問題,我會發布新的問題,並儘快通知你。 – fresher