Ejemplo n.º 1
0
 protected function changeQtyRow($item)
 {
     $qty = (int) $item['qty'];
     $rows = CartItem::find()->where('row_id = :row_id ', ['row_id' => $item['rowId']])->andWhere('order_id = :order_id ', ['order_id' => $item['orderId']])->all();
     foreach ($rows as $row) {
         $row->qty = $qty;
         $row->total = (int) $row['qty'] * (int) $row['size_cost'];
         if (!$row->save()) {
             Yii::error($row->getErrors(), __LINE__);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCartItems()
 {
     return $this->hasMany(CartItem::className(), ['order_id' => 'id']);
 }