Hello, After creating a new variable in the file db/fr.product.php and db/fr.product.def.php all is well. I have create a new array in template/admin/product.tpl. The display is ok. But how to say that this variable is numérique.For example if I write 80 I would like the script write 80.00 For the moment, when I write 80 the display is 80
Should I create a new function or write fprice4 beside fprice, because if I do this:
/**
* Return price format and display * @return float * @param float $fPrice */ function displayPrice( $fPrice ){ return $fPrice; } // end function displayPrice
/** * Return price format to save in database * @return float * @param float $fPrice */ function normalizePrice( $fPrice ){ //return sprintf( '%01.2f', ereg_replace( ',', '.', $fPrice ) ); return sprintf( '%01.2f', preg_replace( '/,/', '.', $fPrice ) ); } // end function normalizePrice
function displayPrice( $fPrice4 ){ return $fPrice4; } // end function displayPrice
/** * Return price format to save in database * @return float * @param float $fPrice */ function normalizePrice( $fPrice4 ){ //return sprintf( '%01.2f', ereg_replace( ',', '.', $fPrice4 ) ); return sprintf( '%01.2f', preg_replace( '/,/', '.', $fPrice4 ) ); } // end function normalizePrice
I have this résult :
Fatal error: Cannot redeclare displayprice() (previously declared in /web/......./wwweu/core/common.php:165) in /web/...../wwweu/core/common.php on line 182
Cachousam, there are somewhere in core/products.php functions: listProducts and throwProduct. They use those normalize- & displayPrice to format the price variable's values before throwing through the tpl.