Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function admin_add($idCustomer = null) {
- if ($this->request->is('post')) {
- $this->ProductDetail->create();
- if ($this->ProductDetail->save($this->request->data)) {
- $this->Session->setFlash(
- __('The %s has been saved', __('product detail')),
- 'alert',
- array(
- 'plugin' => 'TwitterBootstrap',
- 'class' => 'alert-success'
- )
- );
- pr($this->request->data);
- //$id = $this->request->data['ProductDetail']['customer_id'];
- //pr($id);
- //die();
- $this->redirect(array('controller'=>'customers','action' => 'view',$id));
- } else {
- $this->Session->setFlash(
- __('The %s could not be saved. Please, try again.', __('product detail')),
- 'alert',
- array(
- 'plugin' => 'TwitterBootstrap',
- 'class' => 'alert-error'
- )
- );
- }
- }
- $customers = $this->ProductDetail->Customer->find('list');
- if($idCustomer) {
- $customers = $this->ProductDetail->Customer->find(
- 'list',
- array(
- 'conditions' => array(
- 'Customer.id' => $idCustomer
- )
- )
- );
- }
- $products = $this->ProductDetail->Product->find('list');
- $this->set(compact('customers', 'products'));
- }
Advertisement
Add Comment
Please, Sign In to add comment