我正在使用Magento 1.9.2.2, 我创建了一个处理评论的childhtml,它看起来像:
<catalog_product_view translate="label">
<reference name="product.info">
<block type="review/product_view_list" name="productinfo.reviewinfo" as="hs_review" template="catalog\product\hs_review.phtml"></block>
</reference>
</catalog_product_view>
hs_reviw.ptml
:
<?php $ratingSummary =Mage::getModel('rating/rating')->getEntitySummary($_p->getId()); ?>
<div class="review-container">
<?php if ($ratingSummary) { ?>
<div class="w ratting">
<div class="rating-value" style="width: <?php
echo $ratingSummary->getSum() / $ratingSummary->getCount(); ?>%"></div>
</div>
<div class="reviw-count w">
<span><?php echo $ratingSummary->getCount() ?> Reviews</span>
</div>
<?php } ?>
<div class="review-add w">
<a href="<?php echo Mage::getUrl('review/product/list',
array('id'=> $this->getProduct()->getId(),
'category' => $this->getProduct()->getCategoryId()
)); ?>">Write a Review</a>
</div>
</div>
现在奇怪的事情发生在view.ptml中 当我使用
<?php var_dump( $_product->getShortDescription()); ?>
<?php echo $this->getChildHtml('hs_review')?>
它会转储产品简短描述和评论但是当我使用
时<?php echo $this->getChildHtml('hs_review')?>
<?php var_dump( $_product->getShortDescription()); ?>
评论工作完美但产品简短描述返回Null