# Shopping cart List?

**URL:** <https://forum.kirupa.com/t/shopping-cart-list/209937>\
**Category:** Uncategorized\
**Created:** [December 13, 2006, 2:09pm UTC](https://forum.kirupa.com/t/shopping-cart-list/209937 "2006-12-13T14:09:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coop](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@coop](https://forum.kirupa.com/u/coop)\
**Post date:** [December 13, 2006, 2:09pm UTC](https://forum.kirupa.com/t/shopping-cart-list/209937/1 "2006-12-13T14:09:02Z")

</div>

Shopping cart List

Hi all,

I’m trying to produce a shopping cart, so I have a list of products and prices that come from XML. When I click one of the products I want to add that to a list below and then show a sub total. The problem is when I click a product the list below is just replaced by the last product, so it’s not a list, but just replaced all the time by what I’m pressing.

[AS]  
\_global.Total = 0;  
changeColor = function (tar, col) {  
banColor = new Color(tar);  
banColor.setRGB(col);  
};  
cart\_xml = new XML();  
cart\_xml.ignoreWhite = true;  
cart\_xml.onLoad = function(success) {  
if (success) {  
shoppingCart();  
} else {  
trace(“cart xml not loaded”);  
}  
};  
cart\_xml.load(“cart.xml”);  
shoppingCart = function () {  
proNames = cart\_xml.firstChild.childNodes;  
for (var i = 0; i\<proNames.length; i++) {  
fontInfo = proNames\*;  
buy = fontHolder\_mc.attachMovie(“btn\_mc”, “btn\_mc”+i, i+1);  
buy.\_y = 18\*i;  
buy.idcolor = fontInfo.attributes.color;  
buy.name = fontInfo.attributes.name;  
buy.price = fontInfo.attributes.price;  
buy.name\_txt.text = buy.name;  
changeColor(buy.base\_mc, buy.idcolor);  
if (buy.name != “ONE” && buy.name != “TWO”) {  
buy.price\_txt.text = “£”+buy.price;  
buy.base\_mc.\_alpha = 50;  
buy.onRollOver = function() {  
this.base\_mc.\_alpha = 100;  
};  
buy.onRollOut = function() {  
this.base\_mc.\_alpha = 50;  
};  
buy.onRelease = function() {  
cartBtn = cart\_mc.attachMovie(“cartbtn\_mc”, “cartbtn\_mc”+i, i+1);  
cartBtn.name\_txt.text = this.name;  
\_global.Total += this.price;  
total\_txt.text = \_global.Total;  
};  
}  
}  
};  
[/AS]
