Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Mostrar produtos da categoria selecionada…
 
jwaldeck
Jr. Member
 
Total Posts:  24
Joined:  2010-04-27
 

Galera, por favor, precisaria de uma ajuda de vcs…

Temos uma página de produtos onde deveriam ser listados todos os produtos da categoria atual, mas na verdade aparecem todas as categorias às quais o produto atual pertence.

Detalhes aqui: http://www.magentocommerce.com/boards/viewthread/206107/

Alguém poderia, por favor, me ajudar com isso? Faz 1 mês que estou procurando uma solução…

Valeu!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwaldeck
Jr. Member
 
Total Posts:  24
Joined:  2010-04-27
 

Tks to http://www.magentocommerce.com/boards/viewthread/51638/ I finally came to an answer. The following code works great in he view.html page:

<div class=\"box base-mini mini-related-items\">
<div class=\"head\"><h4>Todos os produtos da coleção <strong><?php echo $this->getProduct()->getCategory()->getName() ?> </strong></h4></div>
<div class=\"content\" style=\"float:left\">
<ol>

<?php
$cat_id = Mage::getModel(\'catalog/layer\')->getCurrentCategory()->getId(); // set current category id
$category = Mage::getModel(\'catalog/category\')->load($cat_id);
$products = $category->getProductCollection()->addCategoryFilter($category)->addAttributeToSelect(\'*\');
?>
<?php foreach ( $products as $_product ): ?>
<li<?php if($_product->isComposite() || !$_product->isSaleable()): ?> class=\"super-products\"<?php endif; ?> class=\"product-box\">
<div class=\"product-images\">

<a href=\"<?php echo $_product->getProductUrl() ?>\"><img src=\"<?php echo $this->helper(\'catalog/image\')->init($_product, \'thumbnail\')->resize(50) ?>\” alt=\"<?php echo $this->htmlEscape($_product->getName()) ?>\” width=\"50\" height=\"50\" /></a>
</div>
<div class=\"product-details\">
<a href=\"<?php echo $_product->getProductUrl() ?>\"><?php echo $this->htmlEscape($_product->getName()) ?></a>
<!-- Price -->
<?php echo $this->getPriceHtml($_product, true) ?>
</div>
</li>
<?php endforeach; ?>
</ol></div><div style=\"clear:both\"><br /></div>
</div></div>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top