I need to display all my products like,
Sku Name Price Thumbnail Add-to-cart(Button)
How can i get all above details on CMS Page?
Note : Add-To-Cart Error
I need to display all my products like,
Sku Name Price Thumbnail Add-to-cart(Button)
How can i get all above details on CMS Page?
Note : Add-To-Cart Error
Please find the below the screen shot
In order to get the below product collection in cms page Please First create
Cms page under below at admin side.
Cms -> Pages -> Add New Page -> under content
Please find the below screen shots
And place the Product collection content under the template file in mentioned
file path: app/desgin/frontend/base/default/template/myphp/myphpcode.phtml
Place the below code
<?php $_productCollection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*');
?>
<table>
<tr>
<th class="prosku">Sku</th>
<th class="proname">Name</th>
<th class="proprice">Price</th>
<th class="proimg">Thumbnail</th>
<th class="pro-button">Add to Cart Button</th>
</tr>
<?php
if(count($_productCollection)) {
foreach($_productCollection as $product) {
?>
<tr>
<td class="prodsku"><?php echo $product->getSku(); ?></td>
<td class="prodname"><?php echo $product->getName();?></td>
<td class="prodprice"><?php echo $product->getPrice();?></td>
<td class="prodimg"><img src="<?php echo $product->getImageUrl();?>" width="100px" height="100px"/></td>
<td class="prod-add_to_Cart-button"><?php if($product->isSaleable()): ?>
<p><button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?></td>
</tr>
<?php
}
}
?>
</table>
<style type="text/css">
.prodsku, .prodname, .prodprice, .prodimg, .prod-add_to_Cart-button{
padding:10px;
}
.prosku, .proname, .proprice, .proimg, .pro-button{
padding:10px;
}
</style>