hello


I need to display conditionally my shopping cart button using Javascript and Css. My goal is to hide the button when no items are present inside the cart.

The code of my button is:

<span id="mycartbutton" style="float: right; clear: both;">
<a class="button"href="$(shopping_cart_url)">My Cart</a>
</span>
When nothing is present in the cart, the url of the button render like this:

/.../mode=show_cart

When one or more items are present, the url of the button render like this:

/.../mode=show_cart&cart_id=10332&first_reservation_id=717

Unfortunately I'm not a coder and I don't have any knowledges of JavaScript but I suppose is possible to make a check to rendered url of the button.

Actually I use the follow javascript:

<script type='text/javascript'>
function on_site_form_loaded(event) {
if (event=='product_list')
document.getElementById('mycartbutton').style.display='none';
}
</script>
..this allow me to hide the button on product list as desired BUT even if some items are inside the cart who is not what I want.

I suppose is possible to modify this javascript for make a check to rendered url button for see if contain for example "cart_id". If not is necessary to apply the style "display=none" to the button.

I asked this in another forum but the answer was wrong because they told to use a code who check the URL page instead to check the URL button.


Any clue please ?

thank for your time

cheers