frocco
(Farocco)
1
Hello,
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
Frank
function add_item($itemid,$qty=1,$price = FALSE, $info = FALSE)
function edit_item($itemid,$qty)
function del_item($itemid)
function empty_cart()
frocco
(Farocco)
2
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;
$cart->add_item($item,$qty,$price,$name);
yii::app()->session['wfcart'] = $cart;
$this->render('index');
}