_style = $vendorM->getData(0); } public function getDecimalSymbol() { if(!empty($this->_style)) return $this->_style->currency_decimal_symbol; return ''; } public function getThousandsSeperator() { if(!empty($this->_style)) return $this->_style->currency_thousands; return ''; } public function getDecimals() { if(!empty($this->_style)) return $this->_style->currency_decimal_place; return 0; } } } $currencyDisplay = new CustomCurrency(); $decimalSymbol = $currencyDisplay->getDecimalSymbol(); $decimals = $currencyDisplay->getDecimals(); $thousandsSeparator = $currencyDisplay->getThousandsSeperator(); if (preg_match('/[\.\d' . $decimalSymbol . $thousandsSeparator . ']+/', trim($product['subtotal_with_tax']), $matches)) { $str = str_replace($thousandsSeparator, '', $matches[0]) / $product['quantity']; $parts = explode($decimalSymbol, $str); $strrev = strrev($parts[0]); $count = strlen($strrev); $price = ''; $i = 0; while($i < $count) { $price = (($i + 1) % 3 == 0 ? $thousandsSeparator : '') . $strrev[$i] . $price; $i++; } if (count($parts) > 1) { $dec = round(0 . $decimalSymbol . $parts[1], $decimals); } $price .= substr($dec, 1); $leftCurrency = ''; $rightCurrency = ''; $tmp = trim(str_replace($matches[0], '{s}', $product['subtotal_with_tax'])); if ('' !== $tmp) { $parts = explode('{s}', $tmp); if ('' !== trim($parts[0])) $leftCurrency = $parts[0]; else $rightCurrency = $parts[1]; } if(!class_exists('calculationHelper')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'calculationh.php'); $calculator = calculationHelper::getInstance (); $calculator->_roundindig = 0; echo $leftCurrency . $price . $rightCurrency; } else { echo $product['subtotal_with_tax']; } ?>