Ejemplo n.º 1
0
function RoundFloatValueStr($float_value)
{
    $str = RoundFloatValue($float_value);
    $index = strpos($str, ".");
    if ($index === false) {
        return $str . ".00";
    } else {
        if (strlen($str) - 1 - $index == 1) {
            return $str . "0";
        } else {
            return $str;
        }
    }
}
 /**
  * @param bool $roundfloat: if true total price will have view like 0.00
  * @param mixed
  * @return float: total price in UC
  */
 function calculateTotalPrice($roundfloat = true, $currency = 0, $ignore_freeshipping = false)
 {
     $total_price = 0;
     $r_aItem = $this->Items->getChildNodes('item');
     foreach ($r_aItem as $aItem) {
         /* @var $aItem xmlNodeX */
         $aProduct =& $aItem->getFirstChildByName('product');
         if ($ignore_freeshipping && $aProduct->attribute('free-shipping')) {
             continue;
         }
         $aPrice =& $aItem->getFirstChildByName('price');
         $aQuantity =& $aItem->getFirstChildByName('quantity');
         $item_price = virtualModule::_convertCurrency($aPrice->getData(), $aPrice->attribute('currency'), $currency);
         $total_price += ($roundfloat ? RoundFloatValue($item_price) : $item_price) * $aQuantity->getData();
     }
     return $total_price;
 }