what type of block would i use and what method would I call.
Also what type of array would it return and where would I find the attributes , price and all that good stuff.
Thanks
what type of block would i use and what method would I call.
Also what type of array would it return and where would I find the attributes , price and all that good stuff.
Thanks
Declare your own block in a module and use the following code to get the products you need:
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;
}
Then, in your view:
$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.
}
That should get you started. Take a look at app/code/core/Mage/Catalog/Model/Product.php
for more information on how to retrieve attributes. If you continue to have trouble, post some code you've tried and we can keep going.
Hope that helps!
Thanks, Joe