function admin_get_stock_info() { //$products = $this->Product->find('all'); $this->paginate = array('fields' => array('Product.id', 'Product.pd_name', 'Product.pd_qty'), 'order' => 'Product.pd_qty ASC'); $this->set('products', $this->paginate()); if (!empty($this->data)) { //pr($this->data); //die; $productId = $this->passedArgs['pd_id']; $stockQty = $this->data['Product']['pd_qty']; if ($this->Product->update_stock_qty($productId, $stockQty)) { $this->Session->setFlash('Product stock updated successfully!'); $this->redirect(array('action' => "admin_get_stock_info", 'admin' => true)); } else { $this->Session->setFlash('Product stock failed to update'); $this->redirect(array('action' => "admin_get_stock_info", 'admin' => true)); } } }