我正在为我的商店创建导航。我是magento的新手。我在该类别下加载产品时遇到问题。我可以在所有类别下打印所有产品,但我不知道如何在特定类别下加载产品。
这是我的代码
<?php $_menu = $this->renderCategoriesMenuHtml($this->getSelectedCategoryId(), 0, 'level-top') ?>
<?php
if ($this->getTitle() != '') {
$title = $this->getTitle();
} else {
$title = 'Categories';
}
?>
<?php
$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
?>
<?php if ($_menu): ?>
<div class="block vertical-menu">
<div class="title-block" style="margin-bottom:0px;"><h4><?php echo $this->__($title) ?></h4></div>
<div class="block-content">
<?php $children = Mage::getModel('catalog/category')->getCategories(2);?>
<ul class="content-navigation">
<?php foreach($children as $category){ ?>
<li>
<a href="<?php echo $category->getUrlPath(); ?>"><?php echo $category->getName();?></a>
<? foreach($category->getId()){ ?> // here I want to load product as per their category
<ul>
</ul>
<?php } ?>
</li>
<?php } ?>
</ul>
</div>
</div>
<?php else: ?>
<?php if (Mage::helper('mpanel')->acceptToUsePanel()): ?>
<div class="block vertical-menu">
<div class="block-title"><strong><span><?php echo $this->__($title) ?></span></strong></div>
<div class="block-content">
<p><?php echo $this->__('Have no categories.'); ?></p>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
答案 0 :(得分:0)
尝试使用以下代码
UINavigationController *navi =[self.tabBarController.viewControllers objectAtIndex:0 ];
RedCicleViewController *redCicleViewController = [navi.viewControllers objectAtIndex:0];
self.addDelegate = RedCicleViewController;
[self.addDelegate UpdateCell:nil];
工作..