Hi

I have posted this on ubercart forums, and Ryan told me that it was better to open an issue here:

I don't know if this is posted already, but for % adjustements with decimals, it truncates the decimal part.

ie. for 6.95% COD adjustment the adjustment applied is 0.06 instead of 0.0695

I've modified the _payment_method_adjustment of uc_pma.module for solving this (lines 178-183 or so):

Before:
  if (strstr($adjustment, '%')){
    $percent = TRUE;
    $adjustment = str_replace('%', '', $adjustment);
    $adjustment /= 100;
  }

After:

  if (strstr($adjustment, '%')){
    $percent = TRUE;
    $adjustment = str_replace('%', '', $adjustment);
    $adjustment = number_format(str_replace(variable_get('uc_currency_dec', '.'),".",$adjustment), 2);
    $adjustment /= 100;
  }

Lyle has commented that it would be better to use floatval instead number_format, but I haven't tested it..

Comments

cyu’s picture

This might be related to #307151: Adjustments over $1000 do not work correctly, but I haven't had a chance to look closely at both these issues yet.

I'll test out your suggestion and see if it happens to remedy both problems. Thanks for the bug report and fix.

cyu’s picture

Status: Active » Needs review

I believe this is fixed here: http://drupal.org/cvs?commit=145406
Can you give it a try?

cyu’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.