Product Colletion

public function getProductCollection($storeId){
	$product    = Mage::getModel('catalog/product');  
	$products   = $product->setStoreId($storeId)->getCollection()
	  ->addAttributeToSelect(array('name', 'price', 'small_image','short_description'), 'inner')
	  ->addAttributeToSelect(array('special_price', 'special_from_date', 'special_to_date'), 'left')
	;
	
	$this->_collection = $products;
	return $this->_collection;
}

$storeId    = Mage::app()->getStore()->getId();  

$this->getProductCollection($storeId);

foreach ($this->_collection as $_product):
	echo $_product->getProductUrl();
	echo "<br>";
	echo $_product->getName();
	echo "<br>";
	echo $_product->getShortDescription();
	echo "<br>";
	echo $_product->getPrice();
	echo "<br>";
endforeach;

Category

$categoryId = $_product->getCategoryIds();
$_category = Mage::getModel('catalog/category')->load($categoryId[0]);
$catName = $_category->getName();
 
magento/develop/product_colletion.txt · Darrera modificació: 2009/10/26 19:18 per resteve
 
Copyright: Zikzakmedia Llicència Creative Commons By-NC-SA
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki