Created
August 11, 2011 12:05
-
-
Save arush/1139484 to your computer and use it in GitHub Desktop.
price decimal modifyer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// trim all decimals | |
public function formatPrice($price, $includeContainer = true) | |
{ | |
if ($this->getCurrentCurrency()) { | |
return preg_replace('/.[0-9]*$/', '', $this->getCurrentCurrency()->format($price, array(), $includeContainer)); | |
// return $this->getCurrentCurrency()->format($price, array(), $includeContainer); | |
} | |
return $price; | |
} | |
//trim only .00 | |
public function formatPrice($price, $includeContainer = true) | |
{ | |
if ($this->getCurrentCurrency()) { | |
return str_replace('.00', '', $this->getCurrentCurrency()->format($price, array(), $includeContainer)); | |
// return preg_replace('/.[0-9]*$/', '', $this->getCurrentCurrency()->format($price, array(), $includeContainer)); | |
// return $this->getCurrentCurrency()->format($price, array(), $includeContainer); | |
} | |
return $price; | |
} | |
return str_replace('.00', '', $this->getCurrentCurrency()->format($price, array(), $includeContainer)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public function formatPrice($price, $includeContainer = true)
{
if ($this->getCurrentCurrency()) {
return str_replace('.00', '', $this->getCurrentCurrency()->format($price, array(), $includeContainer));
// return preg_replace('/.[0-9]*$/', '', $this->getCurrentCurrency()->format($price, array(), $includeContainer));
// return $this->getCurrentCurrency()->format($price, array(), $includeContainer);
}
}