magento view.phtml调用具有特定产品ID的cms页面但getchildhtml方法无法呈现

时间:2014-09-04 11:56:39

标签: magento

  <?php $_helper = $this->helper('catalog/output'); ?>
    <?php //$_product = $this->getProduct(); 
    $product_id = $_GET['proid'];
    $obj = Mage::getModel('catalog/product');
    $_product = $obj->load($product_id); // Enter your Product Id in $product_id
    print_r($_product);
   ?>

                            <?php echo $this->getChildHtml('product_type_data'); ?>
                        </div>
                       <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
                   <?php endif;?>

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


                           <?php if($_product->isSaleable()): ?>
                               <?php echo $this->getChildHtml('addtocart') ?>
                           <?php endif; ?>
                       </div>
                       <?php echo $this->getChildHtml('extra_buttons') ?>
                   </div>
                   <?php endif; ?>

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

    <?php echo $this->getChildHtml('product.info.review_list'); ?>
</div>`

在上面的代码中getchildhtml()没有在cms页面中呈现。请做一个解决方案我知道它发生在xml但我不知道怎么做。

1 个答案:

答案 0 :(得分:0)

Rahul Chittora,do this on cms page because this child block is only work on . product view page and it declared in catalog.xmlalways work on catalog_product_view layout

很多工作需要做if want do this type works using call of child from catalog_product page layout to cms page layout.

我建议做some custom code or used quick view extension,which may do this