Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Put in your controller . </p> <pre><code>//$address_id = Yii::app()-&gt;session-&gt;get('address_id');// Temporary I set $address_id = 1; // Remove this if(!empty($address_id)) { $address = Address::model()-&gt;findByPk($address_id); } else { echo "error address id should be there"; } $order_id = Yii::app()-&gt;db-&gt;createCommand("SELECT MAX(orders_id) FROM orders")-&gt;queryScalar(); $order_id = ($order_id)?($order_id+1):1; $orders=new OrdersTemp; $orders-&gt;orders_id = $order_id; $orders-&gt;customer_id = 1; $orders-&gt;billing_address_id = $address_id; $orders-&gt;shipping_address_id = $address_id; $orders-&gt;payment_details_id = 1; $orders-&gt;order_date = date('Y-m-d G:i:s'); $orders-&gt;shipping_amount= '44'; $orders-&gt;total_amount = '10'; $orders-&gt;shipping_address_id = 1; $orders-&gt;created_date = date('Y-m-d G:i:s'); $orders-&gt;modified_date = date('Y-m-d G:i:s'); $orders-&gt;save(); echo $address-&gt;address_id; echo "&lt;br /&gt;"; echo $address-&gt;addressOrders-&gt;orders_id; echo "&lt;br /&gt;"; echo $address-&gt;addressOrders-&gt;total_amount; $this-&gt;render('checkout_shipping', array('address'=&gt;$address),false,true); </code></pre> <p>Replace this function into CartController n check echoes in view file like echo $address->addressOrders->orders_id; etc. </p> <p>Change in model "OrdersTemp" is </p> <pre><code> public function tableName() { return 'orders'; } </code></pre> <p>Basic errors were there like table name you use 1. orders_temp and table name is "orders" 2. Don't insert NULL as you set NOT NULL in Table structure. 3. You didn't get values in order table b cause there was no values inserting into table. </p> <p>Hope you find this useful </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload