想用锚标记在另一个phtml文件中调用一个phtml文件?

时间:2014-04-03 07:33:48

标签: php magento-1.7

我是magento的初学者我想在主页上展示一些产品。还提供了一个链接,找到更多关于我想要显示所有产品列表的点击。请帮我 。 我的新人是

        <?php echo $this->getLayout()
             ->createBlock("catalog/product_list")->setTemplate("inchoo/onsale/sale.phtml")->toHtml(); 
             ?>

1 个答案:

答案 0 :(得分:-1)

你必须这样打电话:

    <?php
$category_id = 13;
    $children = Mage::getModel('catalog/category')->getCategories($category_id);
    foreach ($children as $category): 
            $categoryUrl = Mage::getModel('catalog/category')->load($category->getEntityId())->getUrl();
            echo '<li><a href="' . $categoryUrl . '">' . $category->getName() . '</a></li>';
    endforeach;
    ?>

上述内容将导致与该特定ID相关的子类别。

OR ELSE:

如果您只想要特定类别的网址,则可以调用:

 <?php echo Mage::getModel("catalog/category")->load(5)->getUrl() ?> 
相关问题