Created
October 2, 2013 17:16
-
-
Save wcodex/6797110 to your computer and use it in GitHub Desktop.
Display or get new products in Magento store
This file contains hidden or 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
$allproduct = Mage::getModel('catalog/product')->getCollection()->setOrder('entity_id','desc')->getData(); | |
$_helper = $this->helper('catalog/output'); | |
foreach($allproduct as $product){ | |
echo '<div class="product_box">'; | |
$obj = Mage::getModel('catalog/product'); | |
$productid = $product['entity_id']; | |
$_product = $obj->load($productid); // Enter your Product Id in $product_id | |
$productName = $_product->getName(); | |
$productDescription = $_product->getDescription(); | |
$productImage = $_product->getImageUrl(); | |
$productUrl = $_product->getProductUrl(); | |
$productPrice = $_product->getPrice(); | |
$addToCartUrl = Mage::helper('checkout/cart')->getAddUrl($_product); | |
echo "<h3>"; | |
echo $_product->getName(); | |
echo "</h3>"; | |
echo '<a href="'.$productUrl.'"><img src="'.$productImage.'" alt="Shoes 1" /></a>'; | |
echo '<p>"'.$productDescription.'"</p>'; | |
echo '<p class="product_price">"'.$productPrice.'"</p>'; | |
echo '<a href="'.$productUrl.'" class="detail"></a>'; | |
echo '<a href="'.$addToCartUrl.'" class="addtocart"></a>'; | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment