Project:Ubercart Payment Method Adjustments
Version:5.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

#1

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.

#2

Status:active» needs review

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

#3

Status:needs review» fixed

#4

Status:fixed» closed (fixed)

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