Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_round_up() Error


kentstroker

Recommended Posts

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

Link to comment
Share on other sites

Get the tep_round_up() code from the earlier version and put it in your code.

:huh:

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

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.

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

Be sure the code is in the general.php file in the catalog side and the admin side, too.

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

I'm guessing you probably need to add the link to it to the appropriate file.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...