Пример #1
0
 public static function smartyConvertPrice($params, &$smarty = null)
 {
     $currency = self::smartyGetCurrency($params);
     $price = array_key_exists('price', $params) ? $params['price'] : null;
     $product = array_key_exists('product', $params) ? $params['product'] : self::$smarty_product;
     if ($product != null) {
         $product_properties = PP::getProductProperties($product);
         $mode = array_key_exists('m', $params) ? $params['m'] : null;
         list($key, $price) = PP::calcProductDisplayPrice($product, $product_properties, $price, $mode);
         $display = is_numeric($price) ? Tools::displayPrice($price, $currency) : ($price === null ? 0 : $price);
         if ($key) {
             $display .= ' <span class="' . $key . '">' . PP::safeOutput($product_properties[$key]) . '</span>';
         }
     } else {
         $display = Tools::displayPrice($price === null ? 0 : $price, $currency);
     }
     return $display;
 }