Created
April 3, 2014 14:29
-
-
Save thagxt/9955408 to your computer and use it in GitHub Desktop.
Get Magento Latest Products everywhere!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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