Home

Tuesday, January 8, 2013

Products Display without Category id in Magento

Products Display without Category id in Magento

require_once ("D:\wamp\www\examples\magento\app\Mage.php");
umask(0);
Mage::app("default");
   
 //////////////  ALL PRODUCTS DISPLAY WITHOUT CATEGORY ID /////////////
    $collection= Mage::getModel('catalog/product')
                        ->getCollection()
                        ->addAttributeToSort('entity_id', 'asc')
                        ->addAttributeToSelect('*')
                        ->setPage(0, 3);// LIMIT BY ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<table width="100%" border="1">
            <tr>
                <th>Product ID</th>
                <th>Product Name</th>
                <th>SKU</th>
                <th>Price</th>              
                <th>Thumbnail</th>
                <th>Small</th>
                <th>Big</th>
            </tr>
<?php
    foreach ($collection as $product)
    {
        ?>
        <tr>
            <td><?php echo $product->getId();?></td>
            <td><?php echo $product->getName();?></td>
            <td><?php echo $product->getSku();?></td>
            <td><?php echo $product->getPrice();?></td>           
            <td>
                <a href="<?php echo $product->getProductUrl();?>" target="_blank"><img src="<?php echo $product->getThumbnailUrl();?>" /></a>
            </td>
            <td><img src="<?php echo $product->getSmallImageUrl();?>" /></td>
            <td><img src="<?php echo $product->getImageUrl();?>" /></td>
        </tr>
        <?php       
    }
    ?></table>

No comments:

Post a Comment

rathoddhirendra.blogspot.com-Google pagerank and Worth