And then another message mostly the same saying
Declaration of Cart::save() should be compatible with Model::save
The basic problem is that the cart refuses to update whenever I try to add a product to it(its a simple ajax script). I wish I could talk more about this but I have no clue whats wrong. I have tried passing different parameters into the function but nothing works. Here are the relevant fucntions, sorry it being long.
CartsController:
$carts = $this->Cart->read();
$products = array();
if (null!=$carts) {
foreach ($carts as $productId => $count) {
$product = $this->Product->read(null,$productId);
$product['Product']['count'] = $count;
$products[]=$product;
}
}
$this->set(compact('products'));
}
public function update() {
if ($this->request->is('post')) {
if (!empty($this->request->data)) {
$cart = array();
foreach ($this->request->data['Cart']['count'] as $index=>$count) {
if ($count>0) {
$productId = $this->request->data['Cart']['product_id'][$index];
$cart[$productId] = $count;
}
}
$this->Cart->save($cart);
}
}
$this->redirect(array('action'=>'view'));
}
Cart Model:
public function save($data) {
return CakeSession::write('cart',$data);
}
/*
* read cart data from session
*/
public function read($data) {
return CakeSession::read('cart', $data);
}
Thanks for any help.