Jump to content

Recommended Posts

i have some code that im editing for an auction website, the thing is that i need the $all_unpaid = false if the bid_amount is zero, I tried several tweaks but no results, perhaps some1 can have some suggestions?

 

 

function direct_payment_multiple ($invoice_id, $items_array, $dp_array, $buyer_id)
{
	$output = false;

	$nb_sub_arrays = count($dp_array);
	if ($nb_sub_arrays)
	{
		$array_result = $dp_array[0];

		for ($i=1; $i<$nb_sub_arrays; $i++)
		{
			$array_result = @array_intersect($array_result, $dp_array[$i]);
		}

		$all_unpaid = true;
		for ($i=0; $i<$nb_sub_arrays; $i++)
		{
			$all_unpaid = (!$items_array[$i]['direct_payment_paid'] && !$items_array[$i]['flag_paid'] && $items_array[$i]['bid_amount'] > 0) ? $all_unpaid : false;
		}

		$same_currency = true;
		$currency = $items_array[0]['currency'];
		for ($i=0; $i<$nb_sub_arrays; $i++)
		{
			$same_currency = ($currency == $items_array[$i]['currency']) ? $same_currency : false;
		}
	}

	$output = (is_array($array_result) && $all_unpaid) ? true : false;

	return $output;
}

 

some overview some overview, this auction website allows users to place a bid of 0.00, if no-one outbids them then they get the item for free, however if someone does outbid them then regular code applies so if payment has been made and is greater then zero then all_unpaid is true, if payment equal to zero or there is no payment then all_unpaid is false

 

spam removed

Link to comment
https://forums.phpfreaks.com/topic/258124-php-if-else-statement-with-exception/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.