Commit 71ef7261ee9841b863975b6fdbf45ef2bdfb9707
1 parent
0e51e661
14.06.16
Showing
2 changed files
with
15 additions
and
4 deletions
Show diff stats
common/widgets/Mailer.php
| ... | ... | @@ -28,7 +28,7 @@ class Mailer extends Widget{ |
| 28 | 28 | $mail->CharSet = 'UTF-8'; |
| 29 | 29 | $mail->Username = "adwords@artweb.ua"; |
| 30 | 30 | $mail->Password = "eks,ybcm5hfp"; |
| 31 | - $mail->SetFrom('dockdep@gmail.com'); | |
| 31 | + $mail->SetFrom('rukza4ok@eltrade.com.ua'); | |
| 32 | 32 | $mail->Subject = $this->subject; |
| 33 | 33 | $mail->MsgHTML($this->render($this->type, ['params' => $this->params])); |
| 34 | 34 | $address = "dockdep@gmail.com"; | ... | ... |
frontend/controllers/BasketController.php
| ... | ... | @@ -40,7 +40,7 @@ class BasketController extends Controller |
| 40 | 40 | } |
| 41 | 41 | $body .= "\n\r"; |
| 42 | 42 | |
| 43 | - if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->validate()) { | |
| 43 | + if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->save()) { | |
| 44 | 44 | $productV = $_POST['ProductVariant']; |
| 45 | 45 | |
| 46 | 46 | foreach ($productV as $index=>$row) { |
| ... | ... | @@ -54,10 +54,20 @@ class BasketController extends Controller |
| 54 | 54 | /** |
| 55 | 55 | * Проверяем товар на наличие |
| 56 | 56 | */ |
| 57 | - if(!$product->stock > 0 && !$product->price > 0 ){ | |
| 57 | + | |
| 58 | + if(!$product->stock > 0 || !$product->price > 0 ){ | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Добавляем сообщение об ошибке | |
| 62 | + */ | |
| 58 | 63 | \Yii::$app->getSession()->setFlash('error', 'К сожалению товара '.$product->name . ' нет в наличии'); |
| 64 | + /** | |
| 65 | + * Удаляем заказ | |
| 66 | + */ | |
| 67 | + $modelOrder->delete(); | |
| 59 | 68 | |
| 60 | 69 | $basket_mods = $modelOrder->getBasketMods(); |
| 70 | + | |
| 61 | 71 | return $this->render('index',[ |
| 62 | 72 | 'modelMod'=>$modelMod, |
| 63 | 73 | 'basket_mods'=>$basket_mods, |
| ... | ... | @@ -71,6 +81,7 @@ class BasketController extends Controller |
| 71 | 81 | unset($row['id']); |
| 72 | 82 | $productV[$index]['img'] = \common\components\artboximage\ArtboxImageHelper::getImageSrc($product->image->imageUrl, 'list'); |
| 73 | 83 | $modelOrdersProducts->load($data); |
| 84 | + $modelOrdersProducts->validate(); | |
| 74 | 85 | $modelOrdersProducts->save(); |
| 75 | 86 | } |
| 76 | 87 | |
| ... | ... | @@ -80,7 +91,7 @@ class BasketController extends Controller |
| 80 | 91 | * Сохраняем заказ |
| 81 | 92 | */ |
| 82 | 93 | |
| 83 | - $modelOrder->save(); | |
| 94 | + | |
| 84 | 95 | |
| 85 | 96 | if(!Yii::$app->user->id && !empty($modelOrder->email)){ |
| 86 | 97 | $modelUser = new Customer(); | ... | ... |