Shopping Cart in Header for Marketpress 3

Hi

Is it possible to put a shopping cart in the header for marketpress 3. I had it working with 2.9 lovely but the code is not working now with version 3. It was Ashok who got it working great last time

add_filter( ‘wp_nav_menu_items’, ‘add_cart_link’, 10, 2 );

function add_cart_link( $items, $args ) {

global $mp;

$items .= ‘<li class=”menu_cart”>’.mp_cart_link( false, false, ‘Cart – <span>’ . get_cart_value(false) . ‘</span>’ ).”;

return $items;

}

add_action( ‘wp_footer’, ‘add_cart_value’ );

function add_cart_value() {

global $mp;

$cart = $mp->get_cart_cookie();

?>

<script type=”text/javascript”>

jQuery(function($){

var data = {

‘action’: ‘get_cart_value’

};

setInterval(function() {

$.post( ‘<?php echo admin_url( ‘admin-ajax.php’ ); ?>’, data, function(response) {

$(‘.menu_cart a span’:wink:.text(response);

});

}, 5000);

});

</script>

<?php

}

add_action( ‘wp_ajax_get_cart_value’, ‘get_current_cart_value’ );

add_action( ‘wp_ajax_nopriv_get_cart_value’, ‘get_current_cart_value’ );

function get_cart_value( $echo = true ) {

global $mp;

$totalCount = 0;

$cart = $mp->get_cart_cookie();

foreach( $cart as $c ){

$totalCount += count($c);

}

$selected_cart = $mp->get_cart_contents(true);

$totals = array();

foreach ($selected_cart as $bid => $cart) {

foreach ($cart as $product_id => $variations) {

foreach ($variations as $variation => $data) {

$price = $data * $data;

$discount_price = $mp->coupon_value_product($coupon_code, $price, $product_id);

$totals[] = $discount_price;

}

}

}

$total = array_sum($totals);

if ( $mp->get_setting(‘tax->tax_inclusive’:wink: && $mp->get_setting(‘tax->tax_shipping’:wink: ) {

$total += array_sum($shipping_tax_prices) – array_sum($shipping_prices);

}

if( $echo ){

echo $totalCount . ‘ item(s) – £’ . $total;;

die();

}else{

return $totalCount . ‘ item(s) – £’ . $total;;

}

}

function get_current_cart_value() {

global $mp;

$totalCount = 0;

$cart = $mp->get_cart_cookie();

foreach( $cart as $c ){

$totalCount += count($c);

}

$selected_cart = $mp->get_cart_contents(true);

$totals = array();

foreach ($selected_cart as $bid => $cart) {

foreach ($cart as $product_id => $variations) {

foreach ($variations as $variation => $data) {

$price = $data * $data;

$discount_price = $mp->coupon_value_product($coupon_code, $price, $product_id);

$totals[] = $discount_price;

}

}

}

$total = array_sum($totals);

if ( $mp->get_setting(‘tax->tax_inclusive’:wink: && $mp->get_setting(‘tax->tax_shipping’:wink: ) {

$total += array_sum($shipping_tax_prices) – array_sum($shipping_prices);

}

echo $totalCount . ‘ item(s) – £’ . $total;

die();

}