Jump to content

tiziano.besomi

Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Location
    Switzerland
  • Activity
    Developer

tiziano.besomi's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Prestashop 1.6.0.9: classes / Tools.php public static function ps_round($value, $precision = 0) { static $method = null; if ($method == null) $method = (int)Configuration::get('PS_PRICE_ROUND_MODE'); if ($method == PS_ROUND_UP) return Tools::ceilf($value, $precision); elseif ($method == PS_ROUND_DOWN) return Tools::floorf($value, $precision); // Original by prestashop is: return round($value, $precision); return(round($value/5, $precision)*5); } js / tools.js function ps_round(value, precision) { if (typeof(roundMode) === 'undefined') roundMode = 2; if (typeof(precision) === 'undefined') precision = 2; var method = roundMode; if (method === 0) return ceilf(value, precision); else if (method === 1) return floorf(value, precision); var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision); // return Math.round(value * precisionFactor) / precisionFactor; return Math.round(value / 0.05) * 0.05; } Das macht prestashop "classic rounding" arbeiten mit 0.05 CHF...
×
×
  • Create New...