Пример #1
0
 public static function sendAllOrder($id)
 {
     $data = Orders::getOrderById($id);
     View::$layout = 'empty';
     $text = View::getRenderFullEmpty('email/order', $data);
     $mail = new Email();
     $mail->mailTo($data['email']);
     $mail->Subject('Статус заказа №' . (str_repeat('0', 6 - strlen($id)) . $id) . ' на сайте ' . $_SERVER['HTTP_HOST'] . ' изменен');
     $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
     $mail->Text($text);
     $mail->Send();
 }
Пример #2
0
 public function getOrdersListByStatus($status = '', $all = '')
 {
     $list = array();
     $status = '';
     $sqlWhere = '';
     if ($_GET['status'] != 'all') {
         if ($_GET['status'] == '') {
             $_GET['status'] = 'new';
         }
         $status = 'AND status=\'' . $_GET['status'] . '\'';
     }
     if ($_GET['from'] && $_GET['to']) {
         $sqlWhere .= 'AND (wdate BETWEEN \'' . date('Y-m-d H:i:s', strtotime($_GET['from'])) . '\' AND \'' . date('Y-m-d H:i:s', strtotime($_GET['to'])) . '\')';
     } elseif ($_GET['from'] && $_GET['to'] == '') {
         $sqlWhere .= 'AND wdate>\'' . date('Y-m-d H:i:s', strtotime($_GET['from'])) . '\'';
     } elseif ($_GET['from'] == '' && $_GET['to']) {
         $sqlWhere .= 'AND wdate<\'' . date('Y-m-d H:i:s', strtotime($_GET['to'])) . '\'';
     }
     if (is_numeric($_GET['number'])) {
         $sqlWhere .= 'AND id=\'' . $_GET['number'] . '\'';
     }
     if ($_GET['phone']) {
         $sqlWhere .= 'AND phone LIKE \'%' . $_GET['phone'] . '%\'';
     }
     if ($_GET['fio']) {
         $sqlWhere .= 'AND name LIKE \'%' . $_GET['fio'] . '%\'';
     }
     $sql = 'SELECT * FROM {{orders}} WHERE 1=1 ' . $status . ' ' . $sqlWhere . ' ORDER BY wdate DESC';
     if ($all == '') {
         $data = DB::getPagi($sql);
     } else {
         $data = DB::getAll($sql);
     }
     $itog = 0;
     foreach ($data as $item) {
         $temp = Orders::getOrderById($item['id']);
         $temp['reports'][0] = 0;
         $temp['reports'][1] = 0;
         foreach ($temp['goods'] as $goods) {
             $sql = 'SELECT tree FROM {{reports}} WHERE tree=' . $goods['tree'] . ' AND email=\'' . $item['email'] . '\'';
             if (DB::getOne($sql)) {
                 $temp['reports'][0]++;
             }
             $temp['reports'][1]++;
         }
         $sql = 'SELECT * FROM {{orders_opinion}} WHERE orders=' . $item['id'] . '';
         $temp['opinion'] = DB::getRow($sql);
         $list[] = $temp;
         $itog += $item['price'];
     }
     return array('list' => $list, 'itog' => $itog);
 }
Пример #3
0
 public static function getPayment()
 {
     $model = new Orders();
     $data = $model->getOrderById(Funcs::$uri[3]);
     print View::getPluginEmpty('payment', $data);
 }
Пример #4
0
<?php

$orderData = Orders::getOrderById($id);
$maxPrice = -1;
$maxPriceArr = array();
for ($ii = 0; $ii < count($orderData["items"]); $ii++) {
    if ($maxPrice < $orderData["items"][$ii]["price"]) {
        $maxPrice = $orderData["items"][$ii]["price"];
        $maxPriceArr = $orderData["items"][$ii];
    }
}
/* 
<tr>
	<td style="background: #fff;padding: 25px;">
		<table cellpadding="0" cellspacing="0" >
			<tr>
				<td>
					<p style="font-size: 13pt; font-family: Arial, sans-serif;">
						Здравствуйте, <?=$row["name"];?>!<br />
						Некоторое время назад Вы оформляли у нас заказ на <b><?=$maxPriceArr["name"]?></b>. Большое спасибо за Ваш заказ!
						 Будем благодарны, если Вы напишите о Ваших впечатлениях о покупке у нас на странице нашего магазина.
						С уважением, команда DVR-Group.ru<br/>
						<br />
					</p>
					<table style="display: table; width: 100%; height: 43px; text-align: center;">
						<tr>
						 	<td>&nbsp;</td>
							<td style="background: #0d4e91; background: -moz-linear-gradient(top, #0d9eec, #073d84);background: -webkit-linear-gradient(top, #0d9eec, #073d84);background: -o-linear-gradient(top, #0d9eec, #073d84); background: -ms-linear-gradient(top, #0d9eec, #073d84); background: linear-gradient(top, #0d9eec, #073d84);width: 130px;height: 43px;border-radius: 4px;text-decoration: none;vertical-align: middle;text-align: center;">
								<a style="text-decoration: none;  color: #FFFFFF; font-family: Tahoma, sans-serif; font-size: 12px; font-weight: bold;" href="<?=$row["yaopinions"];?>">Оставить отзыв</a>
							</td>
							<td>&nbsp;</td>
Пример #5
0
 public static function getParcel($what, $orderid = 0)
 {
     $data = array('volume' => 0, 'weight' => 0, 'height' => 0, 'width' => 0, 'length' => 0);
     if ($what == 'site') {
         $order = Basket::getOrder();
         $arrField = 'goods';
         $data = array('volume' => 0, 'weight' => 0);
         foreach ($order[$arrField] as $item) {
             if ($item['set'] == true) {
                 foreach ($item['goods'] as $goods) {
                     $temp = Catalog::getArticle($goods['sizeId']);
                     $data['volume'] += $temp['height'] * $temp['width'] * $temp['length'];
                     $data['weight'] += $temp['weight'];
                     if ($temp['width'] > $data['width']) {
                         $data['width'] = $temp['width'];
                     }
                     if ($temp['length'] > $data['length']) {
                         $data['length'] = $temp['length'];
                     }
                     $data['height'] += $temp['height'];
                 }
             } else {
                 $temp = Catalog::getArticle($item['sizeId']);
                 $data['volume'] += $temp['height'] * $temp['width'] * $temp['length'];
                 $data['weight'] += $temp['weight'];
                 if ($temp['width'] > $data['width']) {
                     $data['width'] = $temp['width'];
                 }
                 if ($temp['length'] > $data['length']) {
                     $data['length'] = $temp['length'];
                 }
                 $data['height'] += $temp['height'];
             }
         }
         $data['volume'] = $data['volume'] / 1000000;
         $data['weight'] = $data['weight'] / 1000;
         $address = Region::getCity($_SESSION['iuser']['address'][0]['city']);
     } else {
         $order = Orders::getOrderById($orderid);
         foreach ($order['goods'] as $item) {
             $temp = Goods::getSizeByName($item['tree'], $item['size']);
             $data['volume'] += $temp['height'] * $temp['width'] * $temp['length'];
             $data['weight'] += $temp['weight'];
             if ($temp['width'] > $data['width']) {
                 $data['width'] = $temp['width'];
             }
             if ($temp['length'] > $data['length']) {
                 $data['length'] = $temp['length'];
             }
             $data['height'] += $temp['height'];
         }
         $data['volume'] = $data['volume'] / 1000000;
         $data['weight'] = $data['weight'] / 1000;
         $address = IuserAddress::getCity($order['address']['city']);
     }
     return array('data' => $data, 'address' => $address);
 }
Пример #6
0
 public function printorder()
 {
     $model = new Orders();
     $text = View::getPluginEmpty('print', $model->getOrderById($_GET['id']));
     echo $text;
 }