New mp cart widget

Hi all,

I don't like (sorry Aaron) The widget core for the cart, and i wanna replace it with a new more simple widget.

This is the script...Really simple... it counts all products in cart and does the total...

So, it require ajax to dinamically update the totals! I've just copied the ajax-cart.js code of mp_cart_listeners, andchanghed the name of div focused, but on update, put the old widget on screen!! Why?!

here the code (for best understand):

function instead of widget class:

function widget($args, $instance) {
global $mp, $blog_id, $plugin_url;
$blog_id = (is_multisite()) ? $blog_id : 1;
$settings = get_option('mp_settings');
$current_blog_id = $blog_id;

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

if ( get_query_var('pagename') == 'cart' )
return;

if ($instance['only_store_pages'] && !mp_is_shop_page())
return;

extract( $args );

echo $before_widget;
echo "<h3 class=\"widget-title\">". __('Cart', 'bh')."</h3>";

echo '<div class="byoutique_cart_widget_content">';
$selected_cart = $global_cart[$blog_id];

foreach ($selected_cart as $bid => $cart){
foreach ($cart as $product_id => $variations){
//print_r($variations);
$subtotal[$i++] = $variations['price'] * $variations['quantity'];
$object[] = $variations['quantity'];
//print_r($sub_total);
$objects = array_sum($object);
$total = array_sum($subtotal);
}
}
if(!$objects)
$objects = 0;
echo "<div class=\"byoutique_cart_container\">";
echo "<div class=\"byoutique_cart_objects\">".__('Products:', 'bh')." ".$objects."</div>";
echo "<div class=\"byoutique_cart_total\">".__('total:', 'bh')." ".$mp->format_currency('', $total)."</div>";
echo "</div>";
echo "<div class=\"clear\"></div>";
echo mp_cart_link(true, false, __('checkout', 'bh'));
echo '</div>';

echo $after_widget;
}

function instead the js file:

function byoutique_cart_listeners() {
$("input.mp_button_addcart").click(function() {
var input = $(this);
var formElm = $(input).parents('form.mp_buy_form');
var tempHtml = formElm.html();
var serializedForm = formElm.serialize();
formElm.html('<img src="'+MP_Ajax.imgUrl+'" alt="'+MP_Ajax.addingMsg+'" />');
$.post(MP_Ajax.ajaxUrl, serializedForm, function(data) {
var result = data.split('||', 1);
if (result[0] == 'error') {
alert(result[1]);
formElm.html(tempHtml);
byoutique_cart_listeners();
} else {
formElm.html('<span class="mp_adding_to_cart">'+MP_Ajax.successMsg+'</span>');
$("div.byoutique_cart_widget_content").html(result[1]);
if (result[0] > 0) {
formElm.fadeOut(2000, function(){
formElm.html(tempHtml).fadeIn('fast');
byoutique_cart_listeners();
});
} else {
formElm.fadeOut(2000, function(){
formElm.html('<span class="mp_no_stock">'+MP_Ajax.outMsg+'</span>').fadeIn('fast');
byoutique_cart_listeners();
});
}
byoutique_empty_cart(); //re-init empty script as the widget was reloaded
}
});
return false;
});
}
byoutique_cart_listeners();

I just want update products and total...Don't wanna dispaly the table of mp_show_cart('widget')

Can you help me?
Where i wrong?