Skip to main content
added 208 characters in body
Source Link
PaddyD
  • 369
  • 3
  • 18

So on the product page (view.phtml) I had:

<div class="no-display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice()); ?></span>
<link itemprop="availability" href="http://schema.org/InStock" />
                

Which give me the result of eg €70.30

But for rich snippet the currency has to be declared separately

So i used the code:

<meta itemprop="priceCurrency" content="<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"/>
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(), false, false); ?></span>

Which give the the Currency separately from the Price but the price is now not rounded so I get eg: 70.30132312323

How do I get the price (with out the currency) to 2 decimal points?

Edit: just to clarify, there are 2 store fronts with different currencies, so if you just call the base price it will give the wrong value for one of the store fronts ( eg you get 64.99 instead of 70.30)

Thanks

So on the product page (view.phtml) I had:

<div class="no-display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice()); ?></span>
<link itemprop="availability" href="http://schema.org/InStock" />
                

Which give me the result of eg €70.30

But for rich snippet the currency has to be declared separately

So i used the code:

<meta itemprop="priceCurrency" content="<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"/>
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(), false, false); ?></span>

Which give the the Currency separately from the Price but the price is now not rounded so I get eg: 70.30132312323

How do I get the price (with out the currency) to 2 decimal points?

Thanks

So on the product page (view.phtml) I had:

<div class="no-display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice()); ?></span>
<link itemprop="availability" href="http://schema.org/InStock" />
                

Which give me the result of eg €70.30

But for rich snippet the currency has to be declared separately

So i used the code:

<meta itemprop="priceCurrency" content="<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"/>
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(), false, false); ?></span>

Which give the the Currency separately from the Price but the price is now not rounded so I get eg: 70.30132312323

How do I get the price (with out the currency) to 2 decimal points?

Edit: just to clarify, there are 2 store fronts with different currencies, so if you just call the base price it will give the wrong value for one of the store fronts ( eg you get 64.99 instead of 70.30)

Thanks

added 3 characters in body
Source Link
PaddyD
  • 369
  • 3
  • 18

So on the product page (view.phtml) I had:

<div class="no-display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice()); ?></span>
<link itemprop="availability" href="http://schema.org/InStock" />
                

Which give me the result of eg €70.30

But for rich snippet the currency has to be declared separablyseparately

So i used the code:

<meta itemprop="priceCurrency" content="<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"/>
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(), false, false); ?></span>

Which give the the Currency separtlyseparately from the Price but the price is now not rounded so I get eg: 70.30132312323

How do I get the price (with out the currency) to 2 decimal points?

Thanks

So on the product page (view.phtml) I had:

<div class="no-display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice()); ?></span>
<link itemprop="availability" href="http://schema.org/InStock" />
                

Which give me the result of eg €70.30

But for rich snippet the currency has to be declared separably

So i used the code:

<meta itemprop="priceCurrency" content="<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"/>
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(), false, false); ?></span>

Which give the the Currency separtly from the Price but the price is now not rounded so I get eg: 70.30132312323

How do I get the price (with out the currency) to 2 decimal points?

Thanks

So on the product page (view.phtml) I had:

<div class="no-display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice()); ?></span>
<link itemprop="availability" href="http://schema.org/InStock" />
                

Which give me the result of eg €70.30

But for rich snippet the currency has to be declared separately

So i used the code:

<meta itemprop="priceCurrency" content="<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"/>
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(), false, false); ?></span>

Which give the the Currency separately from the Price but the price is now not rounded so I get eg: 70.30132312323

How do I get the price (with out the currency) to 2 decimal points?

Thanks

Source Link
PaddyD
  • 369
  • 3
  • 18

finalPrice with no currency and 2 decimal points (for rich snippets)

So on the product page (view.phtml) I had:

<div class="no-display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice()); ?></span>
<link itemprop="availability" href="http://schema.org/InStock" />
                

Which give me the result of eg €70.30

But for rich snippet the currency has to be declared separably

So i used the code:

<meta itemprop="priceCurrency" content="<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"/>
<span itemprop="price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(), false, false); ?></span>

Which give the the Currency separtly from the Price but the price is now not rounded so I get eg: 70.30132312323

How do I get the price (with out the currency) to 2 decimal points?

Thanks