kentstroker Posted August 27, 2009 Share Posted August 27, 2009 I have begun looking at the code and any additional help/insight would be much appreciated. OE installed nicely and when hitting the Edit button immediately get: Fatal error: Call to undefined function tep_round_up() in /opt/sites/store.bearomnimedia.com/htdocs/catalog/includes/modules/shipping/usps.php on line 162 coming from the edits_order.php code. Now, I have searched around the forums here and found that USPS Method 4.3.0 added the tep_round_up() function; has anyone already solved this. Going back to USPS Methods earlier versions is nbot an option given the number of fixes and postal insurance rate changes. If anyone knows the answer to solve this, I would be much in debt. In the meantime, I am digging into the code to see what solution I might figure out. Thanks in advance. -Kent emdkay 1 Quote Link to comment Share on other sites More sharing options...
germ Posted August 27, 2009 Share Posted August 27, 2009 Get the tep_round_up() code from the earlier version and put it in your code. :huh: Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
kentstroker Posted August 27, 2009 Author Share Posted August 27, 2009 And sure enough; look to the code - follow the errors and there is an answer. Solution to the problem. When installing the USPS Method 4.3.1, the catalog/includes/functions/general.php requires the following edit to be made right after the tep_round definition: //// // Round up function for non whole numbers by GREG DEETH // The value for the precision variable determines how many digits after the decimal and rounds the last digit up to the next value // Precision = 0 -> xx.xxxx = x+ // Precision = 1 -> xx.xxxx = xx.+ // Precision = 2 -> xx.xxxx = xx.x+ function tep_round_up($number, $precision) { $number_whole = ''; $num_left_dec = 0; $num_right_dec = 0; $num_digits = strlen($number); $number_out = ''; $i = 0; while ($i + 1 <= strlen($number)) { $current_digit = substr($number, $i, ($i + 1) - $num_digits); if ($current_digit == '.') { $i = $num_digits + 1; $num_left_dec = strlen($number_whole); $num_right_dec = ($num_left_dec + 1) - $num_digits; } else { $number_whole = $number_whole . $current_digit; $i = $i + 1; } } if ($num_digits > 3 && $precision < ($num_digits - $num_left_dec - 1) && $precision >= 0) { $i = $precision; $addable = 1; while ($i > 0) { $addable = $addable * .1; $i = $i - 1; } $number_out = substr($number, 0, $num_right_dec + $precision) + $addable; } else { $number_out = $number; } return $number_out; } //// However, this code insertion is *NOT* required by USPS Methods for the catalog/admin/includes/functions/general.php. Open up the above file, find the tep_round and insert the above code. In another words; do the same code insertion to BOTH general.php filers and the problem is solved. Quote Link to comment Share on other sites More sharing options...
emdkay Posted October 27, 2009 Share Posted October 27, 2009 (edited) Thanks, kentstroker! I had the same issue and this worked for me. I couldn't go without the USPS methods or editor order module. Edited October 27, 2009 by emdkay Quote Link to comment Share on other sites More sharing options...
NetEffect Posted September 15, 2011 Share Posted September 15, 2011 the file edit is already in my includes/functions/general.php and i still get the error. how come? Thx NetEffect Quote Link to comment Share on other sites More sharing options...
germ Posted September 15, 2011 Share Posted September 15, 2011 Be sure the code is in the general.php file in the catalog side and the admin side, too. Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
NetEffect Posted September 15, 2011 Share Posted September 15, 2011 Oh it worked, thanx! How come I don't see Configuration->Order Editor in my admin section? NetEffect Quote Link to comment Share on other sites More sharing options...
germ Posted September 15, 2011 Share Posted September 15, 2011 I'm guessing you probably need to add the link to it to the appropriate file. Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
NetEffect Posted September 15, 2011 Share Posted September 15, 2011 got it. hey looks pretty good :D keep up the good work. Thax Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.