Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

getPriceHtml problem - A month on still no solution so reposting HELP!! 
 
grooveyard
Jr. Member
 
Total Posts:  26
Joined:  2009-06-08
 

Hi hopefully you can help

Im trying to show products in the right column using:

<? 
$_productId 
'2';
$_product Mage::getModel('catalog/product')->load($_productId);
?>
<a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50) ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" width="50" height="50" /></a><br>
<
a href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a>
<?php echo $_product->getPriceHtml() 
?>

Everything shows except the prices.

I can change the last line to either

<?php echo $_product->getPrice() ?>
or
<?php echo $_product->getSpecialPrice() ?>

Problem is that this always displays if there is a special price or not.

it just seems that i cant get getPriceHtml to call the prices from the right column.

Any ideas?

Many thanks in advance.
Paul

 
Magento Community Magento Community
Magento Community
Magento Community
 
szotyi
Sr. Member
 
Total Posts:  153
Joined:  2008-11-29
 

typing in google “function getpricehtml” gives you a solution within a minute

http://www.google.cn/search?hl=zh-CN&q;=FUNCTION+getPriceHtml
http://www.magentocommerce.com/boards/viewthread/60152/
http://colin.mollenhour.com/tag/magento/

 
Magento Community Magento Community
Magento Community
Magento Community
 
grooveyard
Jr. Member
 
Total Posts:  26
Joined:  2009-06-08
 

Hi thanks for the post

I’ve looked at that but there is no indication of where to put the code or how to use it?

I tried a few ways but just get fatal errors.

My current code is:

<? 
$_productId 
'2';
$_product Mage::getModel('catalog/product')->load($_productId);
?>
<a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50) ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" width="50" height="50" /></a><br>
<
a href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a>
<?php echo $_product->getPriceHtml() 
?>

so where do i place:

$productIds array_keys($_products->getItems());
$minimalPriceModel Mage::getResourceModel('catalogindex/price');
$minimalPriceModel->setStoreId(Mage::app()->getStore()->getId());
$minimalPriceModel->setCustomerGroupId(
  
Mage::getSingleton('customer/session')->getCustomerGroupId());
$minimalPrices $minimalPriceModel->getMinimalPrices($productIds);
foreach (
$minimalPrices as $row{
  $item 
$_products->getItemById($row['entity_id']);
  if (
$item{
    $item
->setData('minimal_price'$row['value']);
    
$item->setData('minimal_tax_class_id'$row['tax_class_id']);
  
}
}

And what would i need to change?

Many thanks
Paul

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top