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 (  => 2824  => 2574 )
Array (  => 2799  => 2824  => 2825  => 2826  => 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; endwhile;
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'; endif;
Thanks in advance!