Hi I am working on a website for uni for an online store. I am using NOP Design freecart and everything works fine.
I have the menu and header in PHP which work fine but I can't get my javascript which displays items in cart and total in the php menu
PHP Header
<h1 id="logo"><a href="index.html">Pet Accessories</a></h1>
<!-- Cart -->
<div id="cart">
<a href="managecart.html" class="cart-link" >Your Shopping Cart</a>
<br>
</div>
<!-- End Cart -->
<!-- Navigation -->
<div id="navigation">
<ul>
<li><a href="index.html" class="active">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<!-- End Navigation -->
The javascript I want to use
scart.js file
if ( Cart_is_empty()) {
document.write('Your cart is empty.');
} else {
document.write('In your cart:<p>');
Print_total_products(true);
document.write(', ');
Print_total(true);
document.write('<p>Applicable shipping and taxes extra.<p>');
document.write('<a href="managecart.html">View Cart</a>');
}
If I paste that code into my index.html file is displays correctly but when I paste it into the .php file it doesnt work
I've tried pasting this
<?php echo "<script type=\"text/javascript\" src=\"/js/scart.js\"></script>; ?> ))
into the header.php file but that doesn't work either.
Any ideas on what I should be doing? The shopping cart code I have used from a site so it is quite tricky for me to get my head around.
Any help would be appreciated, thanks