You need to somehow insert this PHP var into a JS var. One simple example is the fallowing:
Code:<input type='hidden' id='total' value='<?=$total?>'>
If you don't want to add the html tag, use the fallowing code:
Code:<script type='text/javascript'>
var total = <?=$total?>;
</script>
Now you can access the variable trough JS. The check should be something like this (for the first example):
Code:function checkTotal()
{
if(document.getElementById('total').value == 0)
alert('you can not checkout, basket is empty... blah blah blah');
}
And
Code:function checkTotal()
{
if(window.total == 0)
alert('you can not checkout, basket is empty... blah blah blah');
}
for the second example. Hope that helps