Hi all, by default it appears that DHL does not tack on the handling by percentage but rather by dollar amount. For example, the default handling for DHL is set to 6% in the admin and all it does is add $6 to the total shipping amount.
I think I've figured out a way to have it calculate by percentage instead. This will only work for either or though. It would ideally be nice to have a drop down that lets you first select if you want a flat rate handling or percentage and then calculate accordingly. So, first decide what you want. If you want percentage based handling then follow these instructions:
Open up administrator/components/com_virtuemart/classes/shipping/dhl.php and find this line (around 487):
$total_rate = $ship_rate + floatval(DHL_HANDLING_FEE);
Here you can see that all it does is add the ship rate and handling fee together instead of multiplying for a percentage.
Comment that line out and add the following below:
$cart = $_SESSION['cart'];
for ($i = 0; $i < $cart['idx']; $i++) {
$item_value = $this->get_duty_value(
$cart[$i]['product_id']) * $cart[$i]['quantity'];
}
$percentage_handling = $item_value * floatval(DHL_HANDLING_FEE);
$total_rate = $ship_rate + $percentage_handling;
$ship_postage = $CURRENCY_DISPLAY->getFullValue(
$total_rate);
This first gets the value of the items in the cart and then takes the value and multiplies it by the handling fee. Then that handling fee is added to the ship rate.
For this to work, you must also set your DHL handling fee to a percentage value formatted in decimal value. So for 6% you would type in .06
I hope this helps others out there and please let me know if anyone finds any flaws in this change.
Thanks,
Jonah