If i where you i’d rewrite the cart. You can maybe borrow the basic concept but i’d refactor the interface.
Basic idea:
class MyCart extends CApplicationComponent
{
public function init() { /* initialize the cart, maybe set up session if you don't autostart it */ }
public function add($article) { /* code to add an article here */ }
public function total() { /* code to calculate total price of articles here */ }
// ...
}
Setup as application component in you configuration: