RSS

Listing of all products in magento

12 Dec

Sometime we need to show all products in magento on anywhere. here is the code which get all the products in magento:

 

<?php /* listing of all product */
$allproduct = Mage::getModel(‘catalog/product’)->getCollection()->setOrder(‘entity_id’,’desc’)->getData();

foreach($allproduct as $product){
$obj = Mage::getModel(‘catalog/product’);
$productid = $product[‘entity_id’];
$_product = $obj->load($productid); // Enter your Product Id in $product_id
$productUrl = $_product->getProductUrl();
?>
<li><a href=”<?php echo $productUrl ?>”><?php echo $_product->getName(); ?></a></li>
<?php } ?>

This is well running in Magento 1.61.0.

 
Leave a comment

Posted by on Dec 12, 2011 in Magento

 

Tags: , , , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: