jQuery(document).ready(function () {
basket_show();
});
var basket_show = function()
{
var basketImgHtml = '
';
if(jQuery('#basketLabel').length > 0)
{
jQuery('#basketLabel').html(basketImgHtml + ' bezig met laden...');
var oncompleteFunc = function(lipuObj)
{
if(lipuObj.ErrorCode == '100')
{
var shoppingbasketXml = jQuery.xmlDOM(lipuObj.XmlParam);
var numProducts = 0;
jQuery('VALUE > ShoppingCartModule > ShoppingCartOrder > ShoppingCartOrderItems > ShoppingCartOrderItem', shoppingbasketXml).each(function() {
numProducts += Number(jQuery(this).find('Orderquantity').text());
});
if (numProducts > 0)
{
var totalPrice = (jQuery('VALUE > ShoppingCartModule > ShoppingCartOrder > TotalinctaxString', shoppingbasketXml).text().replace(',', '.') * 1).toFixed(2).replace('.', ',');
if (numProducts == 1)
{
jQuery('#basketLabel').html(basketImgHtml + ' 1 artikel - € ' + totalPrice + ' | bekijk inhoud');
}
else
{
jQuery('#basketLabel').html(basketImgHtml + ' ' + numProducts + ' artikelen - € ' + totalPrice + ' | bekijk inhoud');
}
}
else
{
jQuery('#basketLabel').html(basketImgHtml + ' geen artikelen - € 0,00');
}
}
else if(lipuObj.ErrorCode == '120')
{
jQuery('#basketLabel').html(basketImgHtml + ' geen artikelen - € 0,00');
}
else
{
jQuery('#basketLabel').html(basketImgHtml + ' ' + lipuObj.ErrorCode);
}
};
var objLipu = new LIPUHandler();
objLipu.Plugin = 'WSCache';
objLipu.SetParam('ws_state', 'shoppingcart');
objLipu.SetParam('ws_action', 'getBasket');
objLipu.SetParam('token', '1@1');
objLipu.SetParam('articleid', '2925');
//It's an ajax call so no need to output html, but merly to mark this, nothing is done with it (for now)
objLipu.SetParam('outputhtml', 'false');
objLipu.ProcessInput(oncompleteFunc);
}
};