Déclarez votre propre bloc dans un module et utiliser le code suivant pour obtenir les produits dont vous avez besoin:
function getProducts() {
$id = $this->getCategoryId(); // you will have to call setCategoryId somewhere else
$category = Mage::getModel("catalog/category")->load($id);
$products = $category->getProductCollection();
$products->addAttributeToSelect("*"); // adds all attributes
//$products->addAttributeToSelect(array("name", "color")); // more precise way to add attributes
return $products;
}
Alors, selon vous:
$products = $this->getProducts(); // this is a collection object, not an array, but we can iterate over it anyway.
foreach($products as $productObject) {
$color = $productObject->getColor();
$name = $productObject->getName();
$sku = $productObject->getSku(); // some things are retrieved even if you don't ask for them.
}
Cela devrait vous avez commencé. Jetez un oeil à app/code/core/Mage/Catalog/Model/Product.php
pour plus d'informations sur la façon de récupérer des attributs. Si vous continuez à avoir des problèmes, affichez du code que vous avez essayé et nous pouvons continuer.
Espérons que ça aide!
Merci, Joe