I am working on the ordering process for a site and I am experimenting with having an order alert box displayed in the window at all times.
Currently I have this box set to show how many items are in your order.
I would like to display the name of the product and the qty in this box also.
Below is the code that controls this box:
$(document).ready(function(){
//if cookie exists, show the panel
if($.cookie('order_cookie') != undefined){
productArray = JSON.parse($.cookie('order_cookie'));
$(".order-alert").show();
for(var i = 0; i < productArray.length; i++){
console.log(productArray[i]);
var obj = productArray[i];
console.log("Object code: " + obj.stockCode + " Qty: " + obj.quantity);
}
$('#order_counter').html(productArray.length);
}
});
The console.log is printing the correct data, I guess it's just a case of inserting the data into the html
The HTML for the box is:
<section class="order-alert">
<a href="xxxx">Your Order</a>
<p>You have <span id="order_counter">0</span> items in your order</p>
</section>
I would like to display the contents of the order below the counter but I'm not sure how I would do that.
appendmethod.