Commit 04b199f04a7ac185af5554263eb4044e69f787e6
1 parent
9454f3c0
koshuky
Showing
2 changed files
with
48 additions
and
1 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
... | ... | @@ -1519,11 +1519,57 @@ |
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | public function basket_uaAction(){ |
1522 | + | |
1523 | + if($this->request->isPost()){ | |
1524 | + | |
1525 | + $data['name'] = $this->request->getPost('name', 'string', NULL); | |
1526 | + $email = $this->request->getPost('email', 'string', NULL); | |
1527 | + $form = $this->request->getPost('form', 'string', NULL); | |
1528 | + $data['email'] = filter_var($email, FILTER_VALIDATE_EMAIL); | |
1529 | + | |
1530 | + if (!empty($data['email']) && $form == 'subscribe') { | |
1531 | + | |
1532 | + $this->sendmail->sendPleaseReturn($data['name'], $data['email']); | |
1533 | + $this->flash->success("Проверьте Вашу почтовый ящик"); | |
1534 | + | |
1535 | + } | |
1536 | + else { | |
1537 | + | |
1538 | + $this->flash->error("Заполните поле Email"); | |
1539 | + | |
1540 | + } | |
1541 | + | |
1542 | + } | |
1543 | + | |
1522 | 1544 | $this->view->setMainView('basket_ua'); |
1545 | + | |
1523 | 1546 | } |
1524 | 1547 | |
1525 | 1548 | public function basket_ruAction(){ |
1549 | + | |
1550 | + if($this->request->isPost()){ | |
1551 | + | |
1552 | + $data['name'] = $this->request->getPost('name', 'string', NULL); | |
1553 | + $email = $this->request->getPost('email', 'string', NULL); | |
1554 | + $form = $this->request->getPost('form', 'string', NULL); | |
1555 | + $data['email'] = filter_var($email, FILTER_VALIDATE_EMAIL); | |
1556 | + | |
1557 | + if (!empty($data['email']) && $form == 'subscribe') { | |
1558 | + | |
1559 | + $this->sendmail->sendPleaseReturn($data['name'], $data['email']); | |
1560 | + $this->flash->success("Проверьте Вашу почтовый ящик"); | |
1561 | + | |
1562 | + } | |
1563 | + else { | |
1564 | + | |
1565 | + $this->flash->error("Заполните поле Email"); | |
1566 | + | |
1567 | + } | |
1568 | + | |
1569 | + } | |
1570 | + | |
1526 | 1571 | $this->view->setMainView('basket_ru'); |
1572 | + | |
1527 | 1573 | } |
1528 | 1574 | |
1529 | 1575 | ... | ... |
src/app/frontend/views/basket_ru.php
... | ... | @@ -417,13 +417,14 @@ else |
417 | 417 | <div class=""> |
418 | 418 | <div class="col-md-1"> </div> |
419 | 419 | <div class="input-group-input col-md-4"> |
420 | + <input type="hidden" name="form" value="subscribe"> | |
420 | 421 | <input type="text" required name="name" class="form-control" placeholder="Имя"> |
421 | 422 | </div> |
422 | 423 | <div class="input-group-input col-md-4"> |
423 | 424 | <input type="email" required name="email" class="form-control" placeholder="e-mail"> |
424 | 425 | </div> |
425 | 426 | <div class="input-group-btn col-md-1"> |
426 | - <button type="submit" class="btn small_buttom green text-center">Подписаться</button> | |
427 | + <button type="submit" name="subscribe" class="btn small_buttom green text-center">Подписаться</button> | |
427 | 428 | </div> |
428 | 429 | <div class="col-md-1"> </div> |
429 | 430 | </div> | ... | ... |