• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1012
  • Last Modified:

Show product price in Magento

Hi guys,

I have a small problem which has taken me several hours of searching and I still cannot solve the issue.

I have a product category left-sidebar which displays thumbnails of products and a link to vew the item.

I am trying to also include the price and quantity available in stock but I firs need to get the price to show.

<?php echo $this->getPriceHtml($_product) ?>

Open in new window

The code isn't outputting the price.

Here is the entire code for sidebarCategories.phtml

$category_id = "36"; // category_id for "Featured Products"
$_productCollection = Mage::getResourceModel('catalog/product_collection')
  ->addAttributeToSelect(array('name', 'price', 'small_image'), 'inner')
<?php if($_productCollection->count()): ?>
<div class="block block-featured-product">
  <div class="block-title">
    <strong>Featured Products</strong>
  <div class="block-content">

    <ul id="featured-product-list">

  $products = array();
  foreach ($_productCollection as $_product) { 
      <li class="featured-product">
          <strong><?php echo $this->htmlEscape($_product->getName())?></strong><?php echo $this->getPriceHtml($_product) ?><br />
          <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>">
            <img class="product-image" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(107, 107); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
<a class="view-item-button" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">View Item</a>
      <hr />
<?php } ?>
<?php endif; ?>

Open in new window

  • 2
1 Solution
Chris StanyonCommented:
Try these functions instead:

echo $_product->getPrice();
echo $_product->getSpecialPrice();
echo $_product->getFinalPrice();
rafique12Author Commented:
Thankyou for your help!

Is there a way to show currency symbol as the store has three different currencies?
Chris StanyonCommented:
Something like this should do it:

 echo Mage::helper('core')->currency($_product->getPrice());
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now