1 回答

TA貢獻2065條經驗 獲得超14個贊
您可以將客戶的所有時間保存在一個字符串中,一個列表中,然后在電子郵件中使用它
foreach( $client_emails as $client_email){
$cancelled_items=OrderItem::find()->where(['location_id'=>$model->location_name] and ['user_id'=>$client_email['id']])->andwhere(['between', 'date', $model->from_date, $model->to_date ])->all();
$body = "regarding cancellation
<ul>"; // create the ul element
foreach($cancelled_items as $cancelled_item){
$start_time = $cancelled_item->start_time;
$body .= "<li>". $start_time."</li>"; // add the li with the start_time content inside
}
$body .= "</ul>"; // close the list
\Yii::$app->mailer->compose()
->setFrom([$from_email => $from_name])
->setTo($client_email['email'])
->setSubject('Regarding Cancellation of Classes')
->setHtmlBody($body)
->send();
}
不要獲取取消狀態未設置為取消的用戶。$orders像這樣編輯你的變量
$order_items = OrderItem::find()->where(['location_id'=>$model->location_name])
->andwhere(['between', 'date', '', $model->from_date, $model->to_date ])
->andWhere("cancellation_status=:cancellation_status",array(':cancellation_status'=>'cancelled'))->all();
- 1 回答
- 0 關注
- 119 瀏覽
添加回答
舉報