Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Array
- (
- [Order] => Array
- (
- [user_email] => st@kr.com
- [billing_first] => Steve
- ... //more excluded
- [total] => 5000
- )
- [Product] => Array
- (
- [0] => Array
- (
- [id] => 1
- [price] => 5000.00
- [quantity] => 1
- )
- )
- )
- Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line 1391]
- Model::__saveMulti() - CORE/cake/libs/model/model.php, line 1391
- Model::save() - CORE/cake/libs/model/model.php, line 1355
- Model::__save() - CORE/cake/libs/model/model.php, line 1778
- Model::saveAll() - CORE/cake/libs/model/model.php, line 1673
- CartsController::saveOrder() - APP/controllers/carts_controller.php, line 128
- CartsController::checkout() - APP/controllers/carts_controller.php, line 172
- Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
- Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
- [main] - APP/webroot/index.php, line 83
- if ($this->Order->save($this->data)) {
- for($i=0; $i<sizeof($this->data['OrderProduct']); $i++){
- $this->data['OrderProduct'][$i]['order_id'] = $this->Order->id;
- }
- $this->Order->OrderProduct->saveAll($this->data['OrderProduct']);
- }
- $this->Order->create();
- $this->Order->unBindModel(array('hasAndBelongsToMany'=>array('Product')));
- $f = $this->Order->save($this->data,false);
- /* Save extra columns in HABTM TABLE */
- $this->Order->bindModel(array('hasMany'=>array('OrderProduct')));
- $q = array();
- if (!isset($this->data['Product']))
- {
- $v = false;
- }
- else
- {
- $v =true;
- for($i=0;$i<count($this->data['Product']);$i++)
- {
- $this->data['OrderProduct'][$i]['order_id'] = $this->Order->getLastInsertID();
- $this->data['OrderProduct'][$i]['product_id'] = $this->data['Product'][$i];
- $this->data['OrderProduct'][$i]['quantity'] = $this->data['quantity'][$i];
- $this->data['OrderProduct'][$i]['state_id'] = $this->data['State'][$i];
- }
- }
- $s = $this->Order->OrderProduct->saveAll($this->data['OrderProduct']);
- $this->Order->unbindModel(array('hasAndBelongsToMany' => array('Product')));
- $this->Order->bindModel(array('hasMany' => array('OrdersPost')));
- $this->data['Order']['id'] = '1';
- $this->data['OrdersPost'][0]['product_id'] = '15';
- $this->data['PostsTag'][0]['price'] = '5000.00';
- $this->data['PostsTag'][0]['quantity'] = '1';
- $this->data['OrdersPost'][1]['product_id'] = '16';
- $this->data['PostsTag'][1]['price'] = '4000.00';
- $this->data['PostsTag'][1]['quantity'] = '2';
- $this->Order->saveAll($this->data);
- CREATE TABLE orders_products (
- id integer,
- order_id integer,
- product_id integer,
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement