Low order fee in trouble with custom payment module
We have a custom payment module that the developer is not anymore maintaining it. We noted now that we are getting error when using low order fee. We haven't used that earlier, so no idea if it has ever worked. It looks like it calculates the md5 hash wrong, or passes some wrong values, only if the order sum is under 50 euro (our low order limit) and thus we are quite sure that the problem occurs only when using low order fee.
Here under are the two parts of the code that are about low order fee, is there something that doesn't match ZC 1.5?
<code>
function process_button() {
global $db, $order, $currencies, $currency, $products, $shipping;
$items = sizeof($order->products);
if( $_SESSION['shipping']['cost'] AND $_SESSION['shipping']['cost'] > 0 )
{
$items++;
}
if(
(
MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION == 'both' OR
($order->delivery['country_id'] == STORE_COUNTRY AND MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION == 'national') OR
($order->delivery['country_id'] != STORE_COUNTRY AND MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION == 'international')
) AND
MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true' AND
$order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER AND
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE > 0
)
{
$items++;
}
if($GLOBALS['ot_gv']->output[0]['value'] && $GLOBALS['ot_gv']->output[0]['value'] != "")
{
$items++;
}
</code>
and
<code>
if(
(
MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION == 'both' OR
($order->delivery['country_id'] == STORE_COUNTRY AND MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION == 'national') OR
($order->delivery['country_id'] != STORE_COUNTRY AND MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION == 'international')
) AND
MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true' AND
$order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER AND
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE > 0
)
{
$loworderfeetax = zen_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$params["ITEM_TITLE[$i]"] = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;
$params["ITEM_NO[$i]"] = $i;
$params["ITEM_AMOUNT[$i]"] = 1;
if(DISPLAY_PRICE_WITH_TAX == "true")
{
$params["ITEM_PRICE[$i]"] = number_format(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + zen_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $loworderfeetax), 2, ".", "");
}
else
{
$params["ITEM_PRICE[$i]"] = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
}
$params["ITEM_TAX[$i]"] = $loworderfeetax;
$params["ITEM_DISCOUNT[$i]"] = 0;
$params["ITEM_TYPE[$i]"] = 3;
$i++;
}
</code>
Both of the above code samples belong to the function process_button().
(Not sure how to put these code samples here nicely, trying with tag <code>)
I may be blond but at least I found Zen.
Bookmarks