Zen Cart Logo
Forums / Addon Payment Modules / Low order fee in trouble with custom payment module

Low order fee in trouble with custom payment module

Views: 1,197

Results 1 to 4 of 4
12 Feb 2014, 7:12 AM
#1
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

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>)

17 Feb 2014, 8:20 AM
#2
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Low order fee in trouble with custom payment module

Maybe we could edit the code so that it wouldn't specify the low order fee but it would be a bulk of everything else than products total or shipping?

17 Feb 2014, 4:14 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Low order fee in trouble with custom payment module

Not sure how much help I'll be, but I can tell already that more information is needed. If there is an error, then it would help to know what the error says. So is there something in the logs directory associated with trying to process a low order fee type item?

Also, not sure what you meant by your second post, but if you wanted you might be able to make it simple, but it more than likely won't be. :) possibly the simplest would be to collect the costs of that type of business through some other route if the developer is no longer making updates or supporting the mod. Perhaps there is something else available to do the same thing?

27 Feb 2014, 2:32 PM
#4
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Low order fee in trouble with custom payment module

There is only an error on the payment provider website that it is making a "gateway error" but in the debug logs are nothing.
By testing this happens only when the low-order fee is on and the sum of the order is so that the low-order fee is added.