There are a few resources out there that cover how to strip the decimal point for a certain currency in Magento or for an entire site, but none that cover how to do it for a certain store.
Background:
Price format per currency is governed in /lib/Zend/Currency.php (http://mrtony.org/2013/01/removing-decimals-in-currency-for-magento/) so you can override currency decimals there using the number format. This file is not overridable and changes therein will affect the whole site.
If you want to step forward from the core and move more into display code which is overridable you can mess with code/core/Mage/Directory/Model/Currency.php (http://magentocoders.blogspot.com.au/2011/10/how-to-remove-decimal-price-in-magento.html)
With both of the above what if you only want to do for one store?
Try this:
app/etc/modules/Madison_Overrides.xml
<?xml version="1.0"?>
<config>
<modules>
<Madison_Overrides>
<active>true</active>
<codePool>local</codePool>
</Madison_Overrides>
</modules>
</config>
app/code/local/Madison/Overrides/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Madison_Overrides>
<version>1.0</version>
</Madison_Overrides>
</modules>
<global>
<models>
<directory>
<rewrite>
<currency>Madison_Overrides_Model_Currency</currency>
</rewrite>
</directory>
<core>
<rewrite>
<locale>Madison_Overrides_Model_Locale</locale>
</rewrite>
</core>
</models>
</global>
</config>
app/code/local/Madison/Overrides/Model/Currency.php
<?php
class Madison_Overrides_Model_Currency extends Mage_Directory_Model_Currency
{
/**
* Format price to currency format
*
* @param double $price
* @param bool $includeContainer
* @return string
*/
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{
//get the store id so you an correctly reference the global variable
$store_id = Mage::app()->getStore()->getId();
//JASE get precision from custom variable that can be set at store level
$getPrecision = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('decimalPrecision')->getData('store_plain_value');
//Mage::log("Precision is ".$getPrecision,null,'jase.log');
//if set use it, otherwise default to two decimals
$precision = is_numeric($getPrecision) ? $getPrecision : 2 ;
return $this->formatPrecision($price, $precision, $options, $includeContainer, $addBrackets);
}
}
?>
app/code/local/Madison/Overrides/Model/Locale.php
<?php
class Madison_Overrides_Model_Locale extends Mage_Core_Model_Locale
{
/**
* Functions returns array with price formatting info for js function
* formatCurrency in js/varien/js.js
*
* @return array
*/
public function getJsPriceFormat()
{
$format = Zend_Locale_Data::getContent($this->getLocaleCode(), 'currencynumber');
$symbols = Zend_Locale_Data::getList($this->getLocaleCode(), 'symbols');
$pos = strpos($format, ';');
if ($pos !== false){
$format = substr($format, 0, $pos);
}
$format = preg_replace("/[^0\#\.,]/", "", $format);
$totalPrecision = 0;
$decimalPoint = strpos($format, '.');
if ($decimalPoint !== false) {
$totalPrecision = (strlen($format) - (strrpos($format, '.')+1));
} else {
$decimalPoint = strlen($format);
}
$requiredPrecision = $totalPrecision;
$t = substr($format, $decimalPoint);
$pos = strpos($t, '#');
if ($pos !== false){
$requiredPrecision = strlen($t) - $pos - $totalPrecision;
}
$group = 0;
if (strrpos($format, ',') !== false) {
$group = ($decimalPoint - strrpos($format, ',') - 1);
} else {
$group = strrpos($format, '.');
}
$integerRequired = (strpos($format, '.') - strpos($format, '0'));
//get the store id so you an correctly reference the global variable
$store_id = Mage::app()->getStore()->getId();
//JASE get precision from custom variable that can be set at store level
$getPrecision = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('decimalPrecision')->getData('store_plain_value');
//if set use it, otherwise default to two decimals
$totalPrecision = is_numeric($getPrecision) ? $getPrecision : $totalPrecision ;
$requiredPrecision = is_numeric($getPrecision) ? $getPrecision : $requiredPrecision ;
$result = array(
'pattern' => Mage::app()->getStore()->getCurrentCurrency()->getOutputFormat(),
'precision' => $totalPrecision,
'requiredPrecision' => $requiredPrecision,
'decimalSymbol' => $symbols['decimal'],
'groupSymbol' => $symbols['group'],
'groupLength' => $group,
'integerRequired' => $integerRequired
);
return $result;
}
}
?>
The first php file above overrides decimal point precision in php and the second php above overrides decimal point precision in javascript which is required for configurable products or products with options.
The final step is you can use Custom Variables in Magento to control the number of decimal places per store. Try setting a Custom Variable called "decimalPrecision". Save the "Plain Value" as 2. Then save it and go back into it. Change the "Store View" to your specific store and set "Use Default Variable Values" to "No". Be sure to put some text in the "Variable HTML Value" so that it saves (it doesn't matter what). Put in "Variable Plain Value" the number "0". Now with this code and that Custom Variable, there will be no decimals on your selected store but everywhere else will be the default of 2 decimal places.