How do I make Webforce Cart persistent?


Would I include this is a model for sessions?

I want to be able to add/remove items through out the users session.

I am not sure what the best approch is.

Thank you


function add_item($itemid,$qty=1,$price = FALSE, $info = FALSE)

function edit_item($itemid,$qty)

function del_item($itemid)

function empty_cart()

I am basically using it in my own controller.

Is this the best way?

public function actionBuy($id)


		$record = Shopinventory::model()->findByPk($id);


		if (yii::app()->session['wfcart'] === null) 


			$cart = new wfCart();

			yii::app()->session['wfcart'] = $cart;



		$cart = yii::app()->session['wfcart'];

		$item = $record->Item;

		$qty = 1;

		$price = $record->List_price;

		$name = $record->Item_description;



		yii::app()->session['wfcart'] = $cart;