magentomagento-1.7

Magento get price featured product


I have a featured product selection in pHtml, which instead of creating an attribute set in Magento, all i am doing is calling on a specific category (this is then added to the front end with XML ont he home page). It seems to work just fine, which is good. However when i try to call in the price I get nothing, i know Im not doing something right, but im just not sure what? here is my code:

    <?php

$categoryid = 13;

$category = new Mage_Catalog_Model_Category();
$category->load($categoryid);
$collection = $category->getProductCollection();
$collection->addAttributeToSelect('*'); 

?>
<div class="featured-products group">

    <h1 class="featured-header">Featured Products</h1>

    <div >
        <ul class="group multiple"  id="featured-set-home">
 <?php foreach ($collection as $_product) { ?>

            <li>
                <a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(138); ?>" width="138" height="138" alt="" /></a>             
                <a href="<?php echo $_product->getProductUrl(); ?>"><?php echo $this->getTierPriceHtml(); ?></a> 
                <a href="<?php echo $_product->getProductUrl(); ?>" class="button right" ><span><span>View Item</span></span></a>
            </li>

<?php } ?>
        </ul>
    </div>
</div>

Its not overly complicated. If anyone can help that would be awesome.


Solution

  • <?php echo $this->getTierPriceHtml(); ?>
    

    Will get the price block (it must be added in the XML layout of the custom page that you have created)

    I would just go for if you only need to show the price:

    $this->helper('core')->currency(Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice()), true, false)); ?>