public function actionTradeSubmit() { $cart = new EShoppingCart(); $cart->init(); $positions = $cart->getPositions(); $tradeInfo = ""; foreach ($positions as $position) { if ($position->id != 100) { //если это не доставка $tradeInfo = $tradeInfo . $position->name . " " . $tradeInfo . $position->article . " " . $position->attributes . " -" . $position->count . "шт (цена за шт.:" . $position->priceForThisCount / $position->count . "р.) :" . $position->priceForThisCount . "р.\r\n"; } } $trade = new Trades(); $trade->name = $_POST["name"]; $trade->phone = $_POST["phone"]; $trade->email = $_POST["email"]; $trade->address = $_POST["address"]; $trade->paymentType = $_POST["paymentType"]; $trade->tradeInfo = $tradeInfo; $trade->date = new CDbExpression('NOW()'); $trade->totalPrice = $_POST["totalPrice"]; $res = $trade->save(); if ($res == false) { echo "error"; return; } $message = "Поступила новвый заказ!\r\n\r\n" . "Номер заказа: " . $trade->id . "\r\n\r\n" . $tradeInfo . "\r\n\r\n"; $message = $message . "Доставка"; if ($_POST["address"] == "") { $message = $message . ":\r\nсамовывоз"; } else { $message = $message . " +200р.\r\nАдрес:" . $_POST["address"]; } $message = $message . "\r\n\r\nИтого: " . $_POST["totalPrice"] . "р."; if ($_POST["paymentType"] == "nal") { $message = $message . "\r\n\r\nОплата наличными."; } else { $message = $message . "\r\n\r\nОплата онлайн."; } $message = $message . "\r\n\r\nКонтакты:\r\nИмя:" . $_POST["name"] . "\r\nТелефон:" . $_POST["phone"] . "\r\nEmail:" . $_POST["email"]; mail("*****@*****.**", "Dominanta:Поступила новвый заказ!", $message); echo $trade->id; }
echo $url; ?> " class="navLink">Новости</a></li> <?php $url = $this->createUrl("main/form"); ?> <li><a href="<?php echo $url; ?> " class="navLink">Обратная связь</a></li> <?php $url = $this->createUrl("main/cart"); ?> <?php $cart = new EShoppingCart(); $cart->init(); $c = $cart->getItemsCount(); if ($c > 0) { $cartCount .= ' (' . $c . ')'; } ?> <li><a href="<?php echo $url; ?> " class="navLink">Корзина <span id="cartCount"><?php echo $cartCount; ?> </span></a></li> </ul> <div class="header-contacts">