I adding my product to bx slider... i calling data from catalog model .... how can i get price on slider... my magento code is ..

     $category = new Mage_Catalog_Model_Category();
    $_products  = $category->getProductCollection();

    $_products->addAttributeToFilter('status', 1);
    $_products->addFieldToFilter(array(array('attribute'=>'visibility', 'neq'=>"1" )));


my slider html..

<div class="sale_slide_women">
                <?php $i=0; foreach ($_products->getItems() as $_product): $i++; ?>
                    <div class="slide <?php if(($i == 4 && $_products->getSize() < 5) || ($i == $_products->getPageSize())) echo 'last'?>">
                        <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(210) ?>" width="210" height="210" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
                        <div class="new-description text-center">
                            <div class="labels-container"><?php include('view/labels.phtml'); ?></div>
                            <h3><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo Mage::helper('core/string')->truncate($this->htmlEscape($_product->getName()), $length = 30, $etc = '...', $remainder = '', $breakWords = true); ?></a></h3>
                            <?php echo $this->getPriceHtml($_product, true) ?>
                            <div style="clear: both;"></div>
                <?php endforeach; ?>


2 Answers 2


<?php echo $this->getPriceHtml($_product, true) ?> is not work because did not call price block

you need to call price block

remove this code and below try this

<?php echo $this->getLayout()->createBlock('catalog/product_price')
            ->toHtml(); ?>

You need set price.phtml and check you price.phtml is your price phtml


The code that you're using to show price:

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

Is for default taking template from file app/design/frontend/your_template/your_template/catalog/product/price.html

For testing purposes try to replace upper code with this:

<?php echo $_product->getPrice(); ?>

And see if price is displayed. If yes then the template file is your reason for not displaying price and we should try to look in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.