Array intersect not working

Hi all, I’m sure I am doing something really obvious wrong, but I just can’t see it!

I have an array_intersect in place on a wp ecommerce site for some custom shipping. When I print the two arrays, you can clearly see there is a matching ID (2824). But the last array (my array_intersect) is empty!

Array ( [0] => 2824 [1] => 2574 )
Array ( [0] => 2799 [1] => 2824 [2] => 2825 [3] => 2826 [4] => 2827 )
Array ( )

This is my code:

This is outside of my function, and get the IDs from a text field in the admin area:

$ProductsIDS = get_option( ‘epix_ship_override_ids’ );
$productid = explode(“,”, $ProductsIDS);
$allIDS = array();
foreach($productid as $value)
$allIDS = $value;

This is inside my function and returns all the IDs in the basket:

while (wpsc_have_cart_items()) : wpsc_the_cart_item();
	$intheBasket[] = $wpsc_cart->cart_item->product_id;

This is my intersect, all I need to do is populate a variable when it spots a match:

$match = array_intersect($intheBasket, $wpec_cs_product_ids);
if(count($match) > 0) :
	$surchargeadded = 'added';		

Thanks in advance!

The obvious question is what is $wpec_cs_product_ids and where is it coming from?

Oh i missed a line when pasting my code! $allIDS is passed in to it!

$wpec_cs_product_ids = $allIDS;

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.