Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...
I have updated from ZC v1.5.5 to v2.0.1.
In v1.5.5 I had "Zone 2 Handling Fee" set 4% and it calculated 4% of the order total on top of the "Zone 2 Shipping Table" rate.
In v2.0.1 I am getting error "Unsupported operand types: int + string in .../htdocs/includes/modules/shipping/zones.php:307" and the 4% is not calculated on top of the Shipping table rate.
Can anybody help me fix that?
Fixed that!
Deleted part of the code: // Handling fee per box or order
if (constant('MODULE_SHIPPING_ZONES_HANDLING_METHOD_' . $dest_zone) == 'Box') {
$shipping_cost = ($shipping * $shipping_num_boxes) + (strstr(constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone), '%') ? constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone) /100 * $_SESSION['cart']->show_total() : constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone)) * $shipping_num_boxes;
} else {
$shipping_cost = ($shipping * $shipping_num_boxes) + (strstr(constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone), '%') ? constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone) /100 * $_SESSION['cart']->show_total() : constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone));
}
And replaced with:
// Retrieve the handling fee configuration
$handling_fee_config = constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
// Check if the handling fee is a percentage (e.g., "5%")
if (strpos($handling_fee_config, '%') !== false) {
// Extract the percentage value
$handling_fee_percentage = floatval($handling_fee_config);
// Calculate the handling fee as a percentage of the order total
$handling_fee = ($order_total_amount * $handling_fee_percentage) / 100;
} else {
// Use the handling fee as a fixed amount
$handling_fee = floatval($handling_fee_config);
}
// Calculate the shipping cost with the handling fee
if (constant('MODULE_SHIPPING_ZONES_HANDLING_METHOD_' . $dest_zone) == 'Box') {
$shipping_cost = ($shipping * $shipping_num_boxes) + ($handling_fee * $shipping_num_boxes);
} else {
$shipping_cost = ($shipping * $shipping_num_boxes) + $handling_fee;
}
Bookmarks