Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thagxt/9955408 to your computer and use it in GitHub Desktop.
Save thagxt/9955408 to your computer and use it in GitHub Desktop.
Get Magento Latest Products everywhere!
<ul>
<?php
$store_id = Mage::app()->getStore()->getId();
$_productCollection = Mage::getResourceModel('reports/product_collection')
->addStoreFilter($store_id)
->addAttributeToFilter('visibility', 4)
->addAttributeToFilter('status', 1)
->addAttributeToSelect('*')
->setVisibility(array(2,3,4))
->setOrder('created_at', 'desc')
->setPage(1, 9);
?>
<li>
<?php foreach($_productCollection as $_product) : ?>
<div>
<div>
<a href="<?php echo $_product->getProductUrl(); ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(170, 100); ?>" alt="" />
</a>
</div>
<div>
<a href="<?php echo $_product->getProductUrl(); ?>" title="<?php echo $_product->getName(); ?>"><?php echo $_product->getName(); ?></a>
</div>
</div>
<?php endforeach; ?>
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment