Just an update to say that our new cart supports a new method to display the cart item quantity anywhere you wish in your page -- better yet, this will appear on initial page-load, even before the cart itself has been viewed on the page.
First, paste this script code into every page where you want to show the cart item quantity; anywhere in the page is fine, but placing it in the page HEAD or above our standard cart <script ...etc.>
code would be ideal:
<script type="text/javascript">
var EJConfig = {}
EJConfig.onload = cartLoaded
function cartLoaded(x){
if(typeof x !== "undefined"){
if(x.Cart.Items)
document.querySelectorAll(".EJ-CartItemsNum").forEach(function(y){ y.innerHTML = x.Cart.Items.length; })
else
document.querySelectorAll(".EJ-CartItemsNum").forEach(function(y){ y.innerHTML = "0"; })
}
}
window.onload = function(){
EJCart.getCartJSON("CID", cartLoaded)
}
</script>
NOTE: Replace the CID
near the end there with your E-junkie Client ID, which you can find in Seller Admin > Manage Seller Account > View Account Summary.
Next, simply add any HTML element(s) with class="EJ-CartItemsNum"
wherever you want the cart item quantity to appear in your page -- e.g., you could use <b class="EJ-CartItemsNum"></b>
or <div class="EJ-CartItemsNum"></div>
, etc. -- along with any custom HTML you wish to accompany the quantity shown. For example, you could even make it work as a clickable View Cart link like so:
<a href="https://www.e-junkie.com/ecom/gb.php?c=cart&ejc=2&cl=CID" target="ej_ejc" class="ec_ejc_thkbx" onclick="return EJEJC_lc(this);">
Items in Cart: <b class="EJ-CartItemsNum"></b></a>
(...again replacing CID
there with your E-junkie Client ID.)