Hi,
I think you are trying to truncate the digits after the decimal. Instead of using the substr() in $cartnumber = substr($cartnumber, 0, strpos($cartnumber,'.'));, you may use $cartnumber=floor($cartnumber).
Hope that works.
Thanks, Solved my problem..