public function indexAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } }
public static function getInstance() { if (self::$_instance == NULL) { self::$_instance = new App_Models_StoreModel(); self::$_instance->_db = App_Storage_Mysql_Connector::getInstance(); } return self::$_instance; }
public function deleteAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); $idpage = @$_GET['idpage']; $sql = "delete from ishali_noidung_page where idpage = " . $idpage; $data = $store->InsertDeleteUpdateQuery($sql); $link = ROOT_DOMAIN . '/admin/baivietcuapage'; header("location: {$link}"); }
public function preDispatch() { $facebook = new Ishali_Facebook(); $store = App_Models_StoreModel::getInstance(); $this->_SESSION = new Zend_Session_Namespace(); //$facebook->getuserfbid(); if ($facebook->getpageid() != "") { @($idpage = $facebook->getpageid()); $_SESSION['idpage'] = $idpage; $this->_SESSION->idpage = $idpage; $this->view->idpage = $idpage; } else { $idpage = isset($_SESSION['idpage']) ? $_SESSION['idpage'] : ""; $this->view->idpage = $idpage; } if ($this->_request->getParam("idpage") != "") { $idpage = $this->_request->getParam("idpage"); $_SESSION['idpage'] = $idpage; $this->_SESSION->idpage = $idpage; $this->view->idpage = $idpage; } /* $idpage = '356730004423499'; $_SESSION['idpage'] = $idpage; $this->view->idpage = $idpage; */ if (isset($_GET['tabs_added'])) { $tabs_added = $_GET['tabs_added']; foreach ($tabs_added as $idpage => $status) { $link = ROOT_DOMAIN . '/admin?pg=' . $idpage; } echo "<script>top.location.href = '{$link}'</script>"; exit; } if (!$idpage) { $link = ROOT_DOMAIN . '/admin'; echo "<script>top.location.href = '{$link}'</script>"; exit; } //Khi link có app_data if ($facebook->getParameterUrl() != null) { $idsp = $facebook->getParameterUrl(); $idsp = base64_decode($idsp); $link = APP_DOMAIN . "/detail?idpage={$idpage}&id={$idsp}"; //echo "<script>showMessageNotClose('Ðang chuyển trang, vui lòng đợi',5000);</script>"; echo "<script>setTimeout(function(){window.location = '{$link}'},3000);</script>"; } $config = $store->getConfig($idpage); $this->view->config = $config; $template = $config['template'] != "" ? $config['template'] : 'bookshop'; $option = array('layout' => 'layout', 'layoutPath' => LAYOUT_PATH . '/' . $template); Zend_Layout::startMvc($option); }
public function xoapagelikeAction() { $store = App_Models_StoreModel::getInstance(); $idpage = $_GET['idpage']; $sql = "delete from ishali_pages_like where idpage = '" . $idpage . "'"; $rs = $store->InsertDeleteUpdateQuery($sql); if ($rs == 1) { $link = APP_DOMAIN . '/admin/sapxeppagelike'; echo "<script>ThongBaoDongY('Xóa Thành Công.', '{$link}');</script>"; } else { echo "<script>ThongBaoDongY('Xóa không thành công<br/>Vui Lòng thực hiện lại thao tác.', '{$link}');</script>"; } }
public function indexAction() { $_SESSION['list_page'] = "1"; $store = $this->view->info = App_Models_StoreModel::getInstance(); if ($this->_request->getParam("idpage") != "") { $idpagee = $this->_request->getParam("idpage"); $_SESSION['idpage'] = $idpagee; } @($idpage = $_SESSION['idpage']); $checkSessionIdpage = $store->KiemTraSessionIdPage($idpage); if ($checkSessionIdpage == 0) { $this->view->checkSessionIdpage = $checkSessionIdpage; } else { $config = $this->view->config = $store->getConfig($idpage); if ($this->_request->getParam("key") != "") { $keyword = $this->_request->getParam("key"); $arr_keyword = explode('_', $keyword); $where = ""; $i = 0; foreach ($arr_keyword as $value) { if ($i == 0) { $where .= " tensp like '%{$value}%' "; } else { $where .= " or tensp like '%{$value}%' "; } $i++; } //$this->view->product = $store->getListProductByIdCate($idpage, 0, 0, 1, $where, ""); $sql = "select a.idsp, a.idloaisp, b.tenloaisp, b.parent_id, \r\n\t\t\t\t\t\t\t c.tenloaisp as tenloaisp_parent, a.masp, a.tensp, \r\n\t\t\t\t\t\t\t a.gia, a.giagiam, a.sale_off, a.spmoi, a.hinhchinh, a.anhien, a.showindex \r\n\t\t\t\t\t\tfrom ishali_sanpham a, ishali_loaisp b LEFT JOIN (select idloaisp, tenloaisp \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t from ishali_loaisp \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where parent_id = 0 and idpage = '{$idpage}') c on b.parent_id = c.idloaisp\r\n\t\t\t\t\t\twhere a.idloaisp = b.idloaisp and a.idpage = '{$idpage}' and ({$where})"; $data = $store->SelectQuery($sql); $this->view->product = $data; } $category = $store->getAllParentCategoryByIdPage($idpage, 0); $this->view->category = $category; $sql = "select donvitien, thongtinsp from ishali_config where idpage = '" . $idpage . "'"; $data = $store->SelectQuery($sql); if (count($data) == 0) { $donvitien = "VNĐ"; $thongtinsp = 0; } else { if ($data[0]['donvitien'] == "") { $donvitien = "VNĐ"; } else { $donvitien = $data[0]['donvitien']; } } $this->view->donvitien = $donvitien; $this->view->checkSessionIdpage = $checkSessionIdpage; $this->view->idpage = $idpage; } }
public function listAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } if (isset($_GET['key'])) { $act = trim($_GET['act']); $key = trim($_GET['key']); $list_cart = $store->getListCart($idpage, $act, $key); $this->view->list_cart = $list_cart; } }
public function xulyconfigAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $banner = ""; @($file = $_FILES['banner']); if ($file['name'] != "") { $banner = time() . '_' . $file['name']; move_uploaded_file($file['tmp_name'], 'public/images/banner/' . $banner); } $footer = $_POST['footer']; $solanlike = $_POST['solanlike']; $sql = "Select 1 from ishali_config"; $data = $store->SelectQuery($sql); if (count($data) == 0) { if ($banner == "") { $sql = "insert into ishali_config(footer, solanlike) "; $sql .= "value('{$footer}', '{$solanlike}')"; } else { $sql = "insert into ishali_config(banner, footer, solanlike) "; $sql .= "value('{$banner}', '{$footer}', '{$solanlike}')"; } } else { if ($banner == "") { $sql = "Update ishali_config set "; $sql .= "footer = '" . $footer . "', "; $sql .= "solanlike = '" . $solanlike . "' "; } else { $sql = "Select banner from ishali_config"; $bn = $store->SelectQuery($sql); if ($bn[0]['banner'] != "") { $banner_old = $bn[0]['banner']; if (file_exists('public/images/banner/' . $banner_old)) { unlink('public/images/banner/' . $banner_old); } } $sql = "Update ishali_config set "; $sql .= "banner = '" . $banner . "', "; $sql .= "footer = '" . $footer . "', "; $sql .= "solanlike = '" . $solanlike . "'"; } } //echo $sql; $config = $store->InsertDeleteUpdateQuery($sql); if ($config == 1) { echo "<script>ThongBaoLoi3('Lưu Thành Công.');</script>"; } else { echo "<script>ThongBaoLoi3('Lưu không thành công<br/>Vui Lòng thực hiện lại thao tác.');</script>"; } }
public function indexAction() { $config = Zend_Registry::get(APPLICATION_CONFIG); $store = $this->view->info = App_Models_StoreModel::getInstance(); if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } //$idpage = '356730004423499'; $idsp = @$_GET['id']; $this->view->idsp = $idsp; $this->view->detailProduct = $store->getProductById($idpage, $idsp); $this->view->array_hinhphu = $store->getPhotoProduct($idsp); $this->view->sanPhamLienQuan = $store->getSanPhamLienQuan($idpage, $idsp); }
public function indexAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $id = base64_decode($this->_request->getParam("id")); //$idpage = '356730004423499'; if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } else { //$idpage = $_GET["idpage"]; $idpage = $this->_request->getParam("idpage"); $this->view->idpage = $idpage; } $sql = "select count(*) as tongsp "; $sql .= "from ishali_sanpham "; $sql .= "where anhien = 1 and idloaisp = " . $id . " and idpage = " . $idpage; $data = $store->SelectQuery($sql); $tongsp = $data[0]['tongsp']; $sp1trang = 12; if ($tongsp > $sp1trang) { $sotrang = ceil($tongsp / $sp1trang); if ($this->_request->getParam("page") == "") { $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where anhien = 1 and idloaisp = " . $id . " and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit 0," . $sp1trang; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } else { $npage = base64_decode($this->_request->getParam("page")); $sp_start = $sp1trang * ($npage - 1); $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where anhien = 1 and idloaisp = " . $id . " and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit " . $sp_start . "," . $sp1trang; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } $this->view->sotrang = $sotrang; } else { $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where anhien = 1 and idloaisp = " . $id . " and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit 0," . $sp1trang; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } }
public function thongtinsanphamxulyAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); $idsp = $_POST['idsp']; $idtab = $_POST['idtab']; $sql = "Select noidung from ishali_thongtinsp where idsp = '" . $idsp . "' and keytab = '" . $idtab . "'"; $data = $store->SelectQuery($sql); if (count($data) > 0) { $noidung = $data[0]['noidung']; } else { $noidung = ""; } echo $noidung; }
public function kiemtratendangnhapAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); $UserName = $_POST['username']; $sql = "select 1 from ishali_admin "; $sql .= "where user = '******' limit 0,1"; $data = $store->SelectQuery($sql); if (count($data) >= 1) { echo 0; return; } else { echo 1; return; } }
public function indexAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $flag = 0; if (isset($_GET['flag'])) { $flag = $_GET['flag']; } if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } $facebook = new Ishali_Facebook(); if ($facebook->getuserfbid() == 0) { if ($flag == 1) { $this->view->isfbuser = 0; } else { $url = APP_DOMAIN . "/dathang?idpage=" . $idpage . "&flag=1"; $facebook->userlogin($url); } } else { $facebook->getuserfbid(); $user_profile = $facebook->getUserInfo(); $this->view->isfbuser = 1; $this->view->linkfb = $user_profile['link']; $this->view->idfb = $user_profile['id']; $checkFbUserInDb = $store->checkFbUserInDb($idpage, $user_profile['id']); if (!empty($checkFbUserInDb)) { $this->view->name = $checkFbUserInDb[0]['name']; $this->view->phone = $checkFbUserInDb[0]['phone']; $this->view->email = $checkFbUserInDb[0]['email']; $this->view->district = $checkFbUserInDb[0]['district']; $this->view->address = $checkFbUserInDb[0]['address']; } else { $this->view->name = $user_profile['name']; $this->view->phone = ""; $this->view->email = $user_profile['email']; $this->view->district = ""; $this->view->address = ""; } } }
public function installpageAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $pageid = $_GET['pageid']; $pagename = $_GET['pagename']; $userid = $_GET['userid']; $appid = $_GET['appid']; $status = $_GET['status']; $facebook = new Ishali_Facebook(); $linkpage = $facebook->getLinkPage($pageid); if ($status == 1) { $sql = "Select 1 from ishali_pages where id_fb_page = '" . $pageid . "' and id_fb = '" . $userid . "'"; $data = $store->SelectQuery($sql); if (count($data) > 0) { echo "<script>ThongBaoDongY('Fanpage <u>{$pagename}</u><br/>Đã được cài thành công vào ứng dụng.', '" . ROOT_DOMAIN . "/admin');</script>"; } else { $link = "http://www.facebook.com/add.php?api_key={$appid}&pages=1&page={$pageid}"; echo "<script>customerLoadWindow('{$link}', '', '540', '400');</script>"; $sql = "Insert into ishali_pages(id_fb_page, page_name, id_fb, link_page, templates) value("; $sql .= "'" . $pageid . "', "; $sql .= "'" . $pagename . "', "; $sql .= "'" . $userid . "', "; $sql .= "'" . $linkpage . "', "; $sql .= "'tmpstore') "; $data = $store->InsertDeleteUpdateQuery($sql); if ($data == 1) { echo "<script>ThongBaoDongY('Sau khi cài ứng dụng lên FanPage thành công,<br/>Hãy nhấn nút Đóng', '" . ROOT_DOMAIN . "/admin');</script>"; } else { echo "<script>ThongBaoDongY('Cài ứng dụng không thành công<br/>Vui Lòng thực hiện lại thao tác.', '" . ROOT_DOMAIN . "/admin');</script>"; } } } else { $link = "http://www.facebook.com/add.php?api_key={$appid}&pages=1&page={$pageid}"; echo "<script>customerLoadWindow('{$link}', '', '540', '400');</script>"; echo "<script>ThongBaoDongY('Sau khi cài ứng dụng lên FanPage thành công,<br/>Hãy nhấn nút Đóng', '" . ROOT_DOMAIN . "/admin');</script>"; } }
public function indexAction() { $config = Zend_Registry::get(APPLICATION_CONFIG); $store = $this->view->info = App_Models_StoreModel::getInstance(); if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } //$idpage = '356730004423499'; $keyword = isset($_GET['key']) ? $_GET['key'] : ""; //$keyword = "pham_hong_tien"; if ($keyword != "") { $arr_keyword = explode('_', $keyword); $where = ""; $i = 0; foreach ($arr_keyword as $value) { if ($i == 0) { $where .= " and masp like '%{$value}%' or tensp like '%{$value}%' "; } else { $where .= " or masp like '%{$value}%' or tensp like '%{$value}%' "; } $i++; } $page = @$_GET['page']; $num_page = $store->getNumPage($idpage, 0, 0, $where); $page = round($page); $page = max(1, $page); $page = min($num_page, $page); $this->view->listProduct = $store->getListProductByIdCate($idpage, 0, 0, $page, $where, ""); $this->view->num_page = $num_page; $this->view->curent_page = $page; $link = APP_DOMAIN . "/search?idpage=" . $idpage . "&key={$keyword}&page=np"; $this->view->pagination = $store->pagination(5, $num_page, $link, $page); } else { $this->view->listProduct = array(); } }
public function xulychangepassAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $iduserfb = $_POST['iduserfb']; $oldpass = sha1($_POST['oldpass']); $newpass = sha1($_POST['newpass']); $store = $this->view->info = App_Models_StoreModel::getInstance(); $sql = "select 1 from ishali_admin "; $sql .= "where iduserfb = '" . $iduserfb . "' and pass = '******' "; $data = $store->SelectQuery($sql); if (count($data) == 0) { echo '-1'; return; } else { $sql = "update ishali_admin set pass = '******' "; $sql .= "where iduserfb = " . $iduserfb; $data = $store->InsertDeleteUpdateQuery($sql); echo $data; unset($this->_SESSION->iduseradmin); unset($this->_SESSION->hotenadmin); unset($_SESSION['iduseradmin']); } }
public function indexAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); include "sendmail.php"; @($idpage = $_SESSION['idpage']); $sql = "Select * from ishali_config where idpage = '" . $idpage . "'"; $config = $store->SelectQuery($sql); $hoten = $_POST['hoten']; $sdt = $_POST['sdt']; $email = $_POST['email']; $diachi = $_POST['diachi']; $ghichu = $_POST['ghichu']; $sanpham = $_POST['sanpham']; if ($config[0]['emailsmtp'] != "") { $usersmtp = $config[0]['emailsmtp']; } else { $usersmtp = "*****@*****.**"; } if ($config[0]['passsmtp'] != "") { $passsmtp = $config[0]['passsmtp']; } else { $passsmtp = "phamhongtien510"; } if ($config[0]['emailfrom'] != "") { $mailfrom = $config[0]['emailfrom']; } else { $mailfrom = "*****@*****.**"; } if ($config[0]['title_from'] != "") { $namefrom = $namereplay = $config[0]['title_from']; } else { $namefrom = $namereplay = "ISHALI MEDIA"; } // Ten khi Admin gui mail den KH, va ten KH tra loi mail $namefrom_kh = $namereplay_kh = $hoten; // Ten khi KH gui mail den admin $subject_bk = "Cảm ơn bạn " . $hoten . " đã đặt hàng sản phẩm của Store ISHALI MEDIA"; if ($config[0]['subject_from'] != "") { $subject = $config[0]['subject_from']; } else { $subject = $subject_bk; } $subject_reply = "KH (" . $hoten . "-" . $sdt . ") đã đặt hàng sản phẩm"; $sql = "Select idsp, masp, tensp, gia, hinhchinh, mota, chitietsp "; $sql .= "From ishali_sanpham "; $sql .= "Where idsp = " . $sanpham; $data = $store->SelectQuery($sql); //APP_DOMAIN - http://ishalimedia.com/appfb/ishalistore $linkanh = APP_DOMAIN . "/application/layouts/tmpstore/images/upload/images/" . $data[0]['hinhchinh']; $noidung = ""; $noidung .= "<table width='600' border='0' cellpadding='0' cellspacing='0'>"; $noidung .= "<tr><td height='35' colspan='2'>Xin chào bạn <strong>" . $hoten . "</strong>.</td></tr>"; $noidung .= "<tr><td height='30' colspan='2'>Thông tin sản phẩm đặt hàng như sau:</td></tr>"; $noidung .= "<tr>"; $noidung .= "<td width='317' rowspan='4'>"; $noidung .= "<img src='" . $linkanh . "' width='300' height='350' /></td>"; $noidung .= "<td height='30' valign='top'><strong>Tên SP</strong> : " . $data[0]['tensp'] . "</td></tr>"; $noidung .= "<tr><td height='30' valign='top'><strong>Giá bán</strong> : " . $data[0]['gia'] . " VNĐ</td></tr>"; $noidung .= "<tr><td height='100' valign='top'><strong>Mô tả</strong> : " . $data[0]['mota'] . "</td></tr>"; $noidung .= "<tr><td width='273' height='155' valign='top'><strong>Chi tiết</strong> : " . $data[0]['chitietsp'] . "</td></tr>"; $noidung .= "<tr><td height='30' colspan='2'> </td></tr>"; $noidung .= "<tr><td height='200' colspan='2' valign='top'><p><span style='color:#00F; font-weight:bold; font-size:18px'>Thông tin đơn đặt hàng:</span></p>"; $noidung .= "<p>Họ tên : " . $hoten . "</p>"; $noidung .= "<p>SĐT : " . $sdt . "</p>"; $noidung .= "<p>Email : " . $email . "</p>"; $noidung .= "<p>Địa chỉ : " . $diachi . "</p>"; $noidung .= "<p>Ghi chú : " . $ghichu . "</p></td>"; $noidung .= "</tr>"; $noidung .= "<tr><td height='45' colspan='2' valign='top'><p><em>Chúng tôi sẽ liên hệ sớm để xác nhận đơn hàng của bạn.<br/>Cảm ơn bạn đã quan tâm đến sản phẩm của chúng tôi.</em></p></td></tr>"; $noidung .= "</table>"; $noidung_reply = ""; $noidung_reply .= "<b>Thông Tin Khách Hàng</b><br/>"; $noidung_reply .= "<b>Họ Tên KH : </b>" . $hoten . ".<br/>"; $noidung_reply .= "<b>Số Điện Thoại : </b>" . $sdt . ".<br/>"; $noidung_reply .= "<b>Email : </b>" . $email . ".<br/>"; $noidung_reply .= "<b>Địa chỉ : </b>" . $diachi . ".<br/>"; $noidung_reply .= "<b>Ghi chú : </b>" . $ghichu . ".<br/>"; $noidung_reply .= "<b>Thông Tin Đơn Hàng</b><br/><br/>"; $noidung_reply .= "<table width='600' border='0' cellpadding='0' cellspacing='0'>"; $noidung_reply .= "<tr>"; $noidung_reply .= "<td width='317' rowspan='4'>"; $noidung_reply .= "<img src='" . $linkanh . "' width='300' height='350' /></td>"; $noidung_reply .= "<td height='30' valign='top'><strong>Tên SP</strong> : " . $data[0]['tensp'] . "</td></tr>"; $noidung_reply .= "<tr><td height='30' valign='top'><strong>Giá bán</strong> : " . $data[0]['gia'] . " VNĐ</td></tr>"; $noidung_reply .= "<tr><td height='100' valign='top'><strong>Mô tả</strong> : " . $data[0]['mota'] . "</td></tr>"; $noidung_reply .= "<tr><td width='273' height='155' valign='top'><strong>Chi tiết</strong> : " . $data[0]['chitietsp'] . "</td></tr>"; $noidung_reply .= "<tr><td height='30' colspan='2'> </td></tr>"; $noidung_reply .= "</table>"; $mailto = $email; $nameto = $hoten; $result = sendmail($usersmtp, $passsmtp, $mailfrom, $mailto, $nameto, $namefrom, $namereplay, $subject, $noidung); sendmail($usersmtp, $passsmtp, $mailto, $mailfrom, $nameto, $namefrom_kh, $namereplay_kh, $subject_reply, $noidung_reply); //$result = 1; if ($result == '1') { $kq = array('result' => 1); echo json_encode($kq); } else { $kq = array('result' => 0); echo json_encode($kq); } }
public function viewcartAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); if ($this->_request->getParam("idpage") != "") { $idpage = $this->_request->getParam("idpage"); $_SESSION['idpage'] = $idpage; } @($idpage = $_SESSION['idpage']); $idCart = $_POST['idCart']; $config = $this->view->config = $store->getConfig($idpage); $sql = "select * from cart where id_cart = '{$idCart}' and idpage = '{$idpage}'"; $infoCart = $store->SelectQuery($sql); $infoCart = $infoCart[0]; $sql = "select * from detail_cart where id_cart = '{$idCart}' and idpage = '{$idpage}'"; $detailCart = $store->SelectQuery($sql); //print_r($detailCart);exit; $status = ""; if ($infoCart['status'] == 0) { $status = "Chưa đọc"; } if ($infoCart['status'] == 1) { $status = "Chưa giao"; } if ($infoCart['status'] == 2) { $status = "Đã giao"; } ?> <div class="header_popup_content"> Chi tiết đơn hàng <?php echo $idCart; ?> <p class="close_popup" onclick="close_popup()"><img src="<?php echo APP_DOMAIN; ?> /application/templates/giaodien_admin/images/delete.png"/></p> </div> <div class="popup_content"> <table class="table_detail_cart"> <tr> <td width='30%' align='right'>Tình trạng đơn hàng:</td> <td><?php echo $status; ?> </td> </tr> <tr> <td align='left'><strong>Thông tin người đặt hàng</strong></td> <td></td> </tr> <tr> <td align='right'>Họ và tên:</td> <td><?php echo $infoCart['name']; ?> </td> </tr> <tr> <td align='right'>Số điện thoại:</td> <td><?php echo $infoCart['phone']; ?> </td> </tr> <tr> <td align='right'>Email:</td> <td><?php echo $infoCart['email']; ?> </td> </tr> <tr><td colspan="2"></td></tr> <tr> <td align='left'><strong>Thông tin giao hàng</strong></td> <td></td> </tr> <tr> <td align='right'>Tỉnh/Thành phố:</td> <td><?php echo $infoCart['city']; ?> </td> </tr> <tr> <td align='right'>Quận/Huyện:</td> <td><?php echo $infoCart['district']; ?> </td> </tr> <tr> <td align='right'>Địa chỉ:</td> <td><?php echo $infoCart['address']; ?> </td> </tr> <tr> <td align='right'>Ghi chú:</td> <td><?php echo $infoCart['comment']; ?> </td> </tr> <tr><td colspan="2"></td></tr> <tr> <td align='left'><strong>Thông tin đơn hàng</strong></td> <td></td> </tr> <tr> <td colspan="2"> <table class="table_detail_cart"> <tr> <th></th> <th></th> <th>Số lượng</th> <th>Thành tiền</th> </tr> <?php $tong_tien = 0; foreach ($detailCart as $key => $value) { $sql = "select * from ishali_sanpham where idsp = " . $value['idsp']; $data = mysql_query($sql); $sp = mysql_fetch_assoc($data); $gia = $value['giagiam'] != 0 ? $value['giagiam'] : $value['gia']; $thanh_tien = $value['soluong'] * $gia; $tong_tien += $thanh_tien; ?> <tr> <td><img class="img_detail_cart" src="<?php echo $sp['hinhchinh']; ?> "/></td> <td> <div class="name_detail_cart"> <p class="name_pro"><?php echo $sp['tensp']; ?> </p> <p class="price_pro"><?php echo number_format($value['gia'], 0, ',', '.') . ' ' . $config['donvitien']; ?> </p> </div> </td> <td align='center'><span class="text3"><?php echo $value['soluong']; ?> </span></td> <td align='center'><span class="text3"><?php echo number_format($thanh_tien, 0, ',', '.') . ' ' . $config['donvitien']; ?> </span></td> </tr> <?php } ?> <tr> <th colspan="2"></th> <th class="tong_cong" colspan="2">Tổng cộng : <?php echo number_format($tong_tien, 0, ',', '.') . ' ' . $config['donvitien']; ?> </th> </tr> </table> </td> </tr> </table> </div> <?php }
public function getorderAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); $idpage = $_SESSION['idpage']; $parent_id = $_POST['parent_id']; $idloaisp = isset($_POST['idloaisp']) ? $_POST['idloaisp'] : ""; if ($parent_id != 0 && $idloaisp != "") { $sql = "select idloaisp from ishali_loaisp where idpage = '{$idpage}' and parent_id = {$idloaisp}"; $rs = mysql_query($sql); if (mysql_num_rows($rs) > 0) { echo 'ko'; exit; } } $sql = "select max(vitri) as 'maxvitri' from ishali_loaisp where idpage = '{$idpage}' and parent_id = '{$parent_id}'"; $data = $store->SelectQuery($sql); $order = $data[0]['maxvitri']; echo $order = max(0, $order); }
public function xulyconfigAction() { //$this->_helper->viewRenderer->setNoRender(true); //$this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); $banner = ""; @($file = $_FILES['banner']); if ($file['name'] != "") { $banner = time() . '_' . $file['name']; move_uploaded_file($file['tmp_name'], 'public/images/banner/' . $banner); } $idpage = $_POST['idpage']; $footer = $_POST['footer']; $emailsmtp = $_POST['emailsmtp']; $passsmtp = $_POST['passsmtp']; $emailfrom = $_POST['emailfrom']; $titlemail = $_POST['titlemail']; $subjectemail = $_POST['subjectemail']; $bg_color_menu = $_POST['bg_color_menu']; $color_text_menu = $_POST['color_text_menu']; $bg_color_menu_act = $_POST['bg_color_menu_act']; $color_text_menu_act = $_POST['color_text_menu_act']; $donvitien = $_POST['donvitien']; $linkpage = $_POST['linkpage']; if (@$_POST['thongtinsp'] != "") { $thongtinsp = @$_POST['thongtinsp']; } else { $thongtinsp = 0; } $menuthongtinsp = $_POST['menuthongtinsp']; if ($menuthongtinsp == "") { $thongtinsp = 0; } $sql = "Select 1 from ishali_config where idpage = '" . $idpage . "'"; $data = $store->SelectQuery($sql); if (count($data) == 0) { if ($banner == "") { $sql = "insert into ishali_config(footer, emailsmtp, passsmtp, emailfrom, title_from, subject_from, idpage, bg_color_menu, color_text_menu, bg_color_menu_act, color_text_menu_act, donvitien, thongtinsp, menuthongtinsp, link_page) "; $sql .= "value('{$footer}', '{$emailsmtp}', '{$passsmtp}', '{$emailfrom}', '{$titlemail}', '{$subjectemail}', '{$idpage}', '{$bg_color_menu}', '{$color_text_menu}', '{$bg_color_menu_act}', '{$color_text_menu_act}', '{$donvitien}', '{$thongtinsp}', '{$menuthongtinsp}', '{$linkpage}')"; } else { $sql = "insert into ishali_config(banner, footer, emailsmtp, passsmtp, emailfrom, title_from, subject_from, idpage, bg_color_menu, color_text_menu, bg_color_menu_act, color_text_menu_act, donvitien, thongtinsp, menuthongtinsp, link_page) "; $sql .= "value('{$banner}', '{$footer}', '{$emailsmtp}', '{$passsmtp}', '{$emailfrom}', '{$titlemail}', '{$subjectemail}', '{$idpage}', '{$bg_color_menu}', '{$color_text_menu}', '{$bg_color_menu_act}', '{$color_text_menu_act}', '{$donvitien}', '{$thongtinsp}', '{$menuthongtinsp}', '{$linkpage}')"; } } else { if ($banner == "") { $sql = "Update ishali_config set "; $sql .= "footer = '" . $footer . "', "; $sql .= "emailsmtp = '" . $emailsmtp . "', "; $sql .= "passsmtp = '" . $passsmtp . "', "; $sql .= "emailfrom = '" . $emailfrom . "', "; $sql .= "title_from = '" . $titlemail . "', "; $sql .= "subject_from = '" . $subjectemail . "', "; $sql .= "bg_color_menu = '" . $bg_color_menu . "', "; $sql .= "color_text_menu = '" . $color_text_menu . "', "; $sql .= "bg_color_menu_act = '" . $bg_color_menu_act . "', "; $sql .= "color_text_menu_act = '" . $color_text_menu_act . "', "; $sql .= "donvitien = '" . $donvitien . "', "; $sql .= "thongtinsp = '" . $thongtinsp . "', "; $sql .= "menuthongtinsp = '" . $menuthongtinsp . "', "; $sql .= "link_page = '" . $linkpage . "' "; $sql .= "where idpage = '" . $idpage . "'"; } else { $sql = "Select banner from ishali_config where idpage = '" . $idpage . "'"; $bn = $store->SelectQuery($sql); if ($bn[0]['banner'] != "") { $banner_old = $bn[0]['banner']; if (file_exists('public/images/banner/' . $banner_old)) { unlink('public/images/banner/' . $banner_old); } } $sql = "Update ishali_config set "; $sql .= "banner = '" . $banner . "', "; $sql .= "footer = '" . $footer . "', "; $sql .= "emailsmtp = '" . $emailsmtp . "', "; $sql .= "passsmtp = '" . $passsmtp . "', "; $sql .= "emailfrom = '" . $emailfrom . "', "; $sql .= "title_from = '" . $titlemail . "', "; $sql .= "subject_from = '" . $subjectemail . "', "; $sql .= "bg_color_menu = '" . $bg_color_menu . "', "; $sql .= "color_text_menu = '" . $color_text_menu . "', "; $sql .= "bg_color_menu_act = '" . $bg_color_menu_act . "', "; $sql .= "color_text_menu_act = '" . $color_text_menu_act . "', "; $sql .= "donvitien = '" . $donvitien . "', "; $sql .= "thongtinsp = '" . $thongtinsp . "', "; $sql .= "menuthongtinsp = '" . $menuthongtinsp . "', "; $sql .= "link_page = '" . $linkpage . "' "; $sql .= "where idpage = '" . $idpage . "'"; } } //echo $sql; $config = $store->InsertDeleteUpdateQuery($sql); if ($config == 1) { echo "<script>ThongBaoLoi3('Lưu Thành Công.');</script>"; } else { echo "<script>ThongBaoLoi3('Lưu không thành công<br/>Vui Lòng thực hiện lại thao tác.');</script>"; } }
public function indexAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $facebook = new Ishali_Facebook(); if ($facebook->getParameterUrl() != null) { $param = $facebook->getParameterUrl(); $data = explode('-', $param); $id = $data[0]; $sp = $data[1]; $host = APP_DOMAIN; header("location: {$host}/product?id={$id}&sp={$sp}"); //http://localhost/appfb/ishalistore/product?id=Mg==&sp=MTg= } //356730004423499 //$idpage = $_SESSION['idpage']; //$this->view->idpage = $idpage; if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } else { //$idpage = $_GET["idpage"]; $idpage = $this->_request->getParam("idpage"); $this->view->idpage = $idpage; } $sql = "select count(*) as tongsp "; $sql .= "from ishali_sanpham "; $sql .= "where anhien = 1 and showindex=1 and idpage = " . $idpage; $data = $store->SelectQuery($sql); $tongsp = $data[0]['tongsp']; $sp1trang = 12; if ($tongsp > $sp1trang) { $sotrang = ceil($tongsp / $sp1trang); if ($this->_request->getParam("page") == "") { $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where showindex = 1 and anhien = 1 and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit 0," . $sp1trang; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } else { $npage = base64_decode($this->_request->getParam("page")); $sp_start = $sp1trang * ($npage - 1); $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where showindex = 1 and anhien = 1 and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit " . $sp_start . "," . $sp1trang; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } $this->view->sotrang = $sotrang; } else { $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where (showindex = 1 || ngaycapnhat < now()) and anhien = 1 and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit 0,12"; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } $sql = "select donvitien from ishali_config where idpage = '" . $idpage . "'"; $data = $store->SelectQuery($sql); if (count($data) == 0) { $donvitien = "VNĐ"; } else { if ($data[0]['donvitien'] == "") { $donvitien = "VNĐ"; } else { $donvitien = $data[0]['donvitien']; } } $this->view->donvitien = $donvitien; }
public function checkhavechildcatAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $store = App_Models_StoreModel::getInstance(); $idcat = $_POST['idcat']; $sql = "select count(*) as count_child_cat from ishali_loaisp where parent_id = '{$idcat}'"; $data = $store->SelectQuery($sql); echo $data[0]['count_child_cat']; }
public function deleteAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $idnoidung = $_GET['idnd']; $sql = "Select tenhinh from ishali_noidung_chiase where idnoidung = '" . $idnoidung . "'"; $bn = $store->SelectQuery($sql); if ($bn[0]['tenhinh'] != "") { $tenhinh = $bn[0]['tenhinh']; if (file_exists('application/layouts/tmplikepage/images/noidung/' . $tenhinh)) { unlink('application/layouts/tmplikepage/images/noidung/' . $tenhinh); } } $sql = "delete from ishali_noidung_chiase where idnoidung = '" . $idnoidung . "'"; $data = $store->InsertDeleteUpdateQuery($sql); if ($data == 1) { $link = ROOT_DOMAIN . '/admin/noidungchiase'; echo "<script>ThongBaoDongY('Xóa thành công.', '{$link}');</script>"; } else { echo "<script>ThongBaoDongY('Xóa không thành công<br/>Vui Lòng thực hiện lại thao tác.', '{$link}');</script>"; } }
public function xulyconfigAction() { //$this->_helper->viewRenderer->setNoRender(true); //$this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); $banner = ""; /* @$file=$_FILES['banner']; if($file['name']!="")//Neu nhu NSD co upload file { $banner=time().'_'.$file['name']; move_uploaded_file($file['tmp_name'],'public/images/banner/'.$banner); } */ $idpage = $_POST['idpage']; $shopname = isset($_POST['shopname']) ? $_POST['shopname'] : ""; $phone = isset($_POST['phone']) ? $_POST['phone'] : ""; $emailfrom = isset($_POST['emailfrom']) ? $_POST['emailfrom'] : ""; $donvitien = isset($_POST['donvitien']) ? $_POST['donvitien'] : ""; $checkout = isset($_POST['checkout']) ? $_POST['checkout'] : ""; $delivery = isset($_POST['delivery']) ? $_POST['delivery'] : ""; $contact = isset($_POST['contact']) ? $_POST['contact'] : ""; $email_cart = isset($_POST['email_cart']) ? $_POST['email_cart'] : ""; $footer = isset($_POST['footer']) ? $_POST['footer'] : ""; $emailsmtp = isset($_POST['emailsmtp']) ? $_POST['emailsmtp'] : ""; $passsmtp = isset($_POST['passsmtp']) ? $_POST['passsmtp'] : ""; $titlemail = isset($_POST['titlemail']) ? $_POST['titlemail'] : ""; $subjectemail = isset($_POST['subjectemail']) ? $_POST['subjectemail'] : ""; $bg_color_menu = isset($_POST['bg_color_menu']) ? $_POST['bg_color_menu'] : ""; $color_text_menu = isset($_POST['color_text_menu']) ? $_POST['color_text_menu'] : ""; $bg_color_menu_act = isset($_POST['bg_color_menu_act']) ? $_POST['bg_color_menu_act'] : ""; $color_text_menu_act = isset($_POST['color_text_menu_act']) ? $_POST['color_text_menu_act'] : ""; $linkpage = isset($_POST['linkpage']) ? $_POST['linkpage'] : ""; if (@$_POST['thongtinsp'] != "") { $thongtinsp = 1; } else { $thongtinsp = 0; } $menuthongtinsp = isset($_POST['menuthongtinsp']) ? $_POST['menuthongtinsp'] : ""; if ($menuthongtinsp == "") { $thongtinsp = 0; } $sql = "Select 1 from ishali_config where idpage = '" . $idpage . "'"; $data = $store->SelectQuery($sql); if (count($data) == 0) { if ($banner == "") { $sql = "insert into ishali_config(footer, emailsmtp, passsmtp, emailfrom, title_from, subject_from, idpage, bg_color_menu, color_text_menu, bg_color_menu_act, color_text_menu_act, donvitien, thongtinsp, menuthongtinsp, link_page, shopname, phone, checkout, delivery, contact, email_cart) "; $sql .= "value('{$footer}', '{$emailsmtp}', '{$passsmtp}', '{$emailfrom}', '{$titlemail}', '{$subjectemail}', '{$idpage}', '{$bg_color_menu}', '{$color_text_menu}', '{$bg_color_menu_act}', '{$color_text_menu_act}', '{$donvitien}', '{$thongtinsp}', '{$menuthongtinsp}', '{$linkpage}', '{$shopname}', '{$phone}', '{$checkout}', '{$delivery}', '{$contact}', '{$email_cart}')"; } else { $sql = "insert into ishali_config(banner, footer, emailsmtp, passsmtp, emailfrom, title_from, subject_from, idpage, bg_color_menu, color_text_menu, bg_color_menu_act, color_text_menu_act, donvitien, thongtinsp, menuthongtinsp, link_page, shopname, phone, checkout, delivery, contact, email_cart) "; $sql .= "value('{$banner}', '{$footer}', '{$emailsmtp}', '{$passsmtp}', '{$emailfrom}', '{$titlemail}', '{$subjectemail}', '{$idpage}', '{$bg_color_menu}', '{$color_text_menu}', '{$bg_color_menu_act}', '{$color_text_menu_act}', '{$donvitien}', '{$thongtinsp}', '{$menuthongtinsp}', '{$linkpage}', '{$shopname}', '{$phone}', '{$checkout}', '{$delivery}', '{$contact}', '{$email_cart}')"; } } else { if ($banner == "") { $sql = "Update ishali_config set "; $sql .= "footer = '" . $footer . "', "; $sql .= "emailsmtp = '" . $emailsmtp . "', "; $sql .= "passsmtp = '" . $passsmtp . "', "; $sql .= "emailfrom = '" . $emailfrom . "', "; $sql .= "title_from = '" . $titlemail . "', "; $sql .= "subject_from = '" . $subjectemail . "', "; $sql .= "bg_color_menu = '" . $bg_color_menu . "', "; $sql .= "color_text_menu = '" . $color_text_menu . "', "; $sql .= "bg_color_menu_act = '" . $bg_color_menu_act . "', "; $sql .= "color_text_menu_act = '" . $color_text_menu_act . "', "; $sql .= "donvitien = '" . $donvitien . "', "; $sql .= "thongtinsp = '" . $thongtinsp . "', "; $sql .= "menuthongtinsp = '" . $menuthongtinsp . "', "; $sql .= "link_page = '" . $linkpage . "', "; $sql .= "shopname = '" . $shopname . "', "; $sql .= "phone = '" . $phone . "', "; $sql .= "checkout = '" . $checkout . "', "; $sql .= "delivery = '" . $delivery . "', "; $sql .= "contact = '" . $contact . "', "; $sql .= "email_cart = '" . $email_cart . "' "; $sql .= "where idpage = '" . $idpage . "'"; } else { $sql = "Select banner from ishali_config where idpage = '" . $idpage . "'"; $bn = $store->SelectQuery($sql); if ($bn[0]['banner'] != "") { $banner_old = $bn[0]['banner']; if (file_exists('public/images/banner/' . $banner_old)) { unlink('public/images/banner/' . $banner_old); } } $sql = "Update ishali_config set "; $sql .= "banner = '" . $banner . "', "; $sql .= "footer = '" . $footer . "', "; $sql .= "emailsmtp = '" . $emailsmtp . "', "; $sql .= "passsmtp = '" . $passsmtp . "', "; $sql .= "emailfrom = '" . $emailfrom . "', "; $sql .= "title_from = '" . $titlemail . "', "; $sql .= "subject_from = '" . $subjectemail . "', "; $sql .= "bg_color_menu = '" . $bg_color_menu . "', "; $sql .= "color_text_menu = '" . $color_text_menu . "', "; $sql .= "bg_color_menu_act = '" . $bg_color_menu_act . "', "; $sql .= "color_text_menu_act = '" . $color_text_menu_act . "', "; $sql .= "donvitien = '" . $donvitien . "', "; $sql .= "thongtinsp = '" . $thongtinsp . "', "; $sql .= "menuthongtinsp = '" . $menuthongtinsp . "', "; $sql .= "link_page = '" . $linkpage . "', "; $sql .= "shopname = '" . $shopname . "', "; $sql .= "phone = '" . $phone . "', "; $sql .= "checkout = '" . $checkout . "', "; $sql .= "delivery = '" . $delivery . "', "; $sql .= "contact = '" . $contact . "' "; $sql .= "email_cart = '" . $email_cart . "' "; $sql .= "where idpage = '" . $idpage . "'"; } } $config = $store->InsertDeleteUpdateQuery($sql); if ($config == 1) { //echo "<script>$(window).scrollTop(0);</script>"; echo "<script>ThongBaoLoi3('Lưu Thành Công.');</script>"; $link = ROOT_DOMAIN . '/admin/config'; echo "<script>top.location.href='{$link}'</script>"; } else { echo "<script>ThongBaoLoi3('Lưu không thành công<br/>Vui Lòng thực hiện lại thao tác.');</script>"; } }
public function getLinkNoiDungCuaPage($idpage) { $store = App_Models_StoreModel::getInstance(); $sql = "SELECT linktintuc "; $sql .= "FROM ishali_noidung_chiase inc, ishali_noidung_page inp "; $sql .= "WHERE inc.idnoidung = inp.idnoidung AND inp.idpage = '{$idpage}'"; $data = $store->SelectQuery($sql); return $data[0]['linktintuc']; }
public function viewcustomerdetailsAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); if ($this->_request->getParam("idpage") != "") { $idpage = $this->_request->getParam("idpage"); $_SESSION['idpage'] = $idpage; } @($idpage = $_SESSION['idpage']); $name = $_POST['name']; $phone = $_POST['phone']; $city = $_POST['city']; $district = $_POST['district']; $address = $_POST['address']; $latest_order = $_POST['latest_order']; $rating = $_POST['rating']; $fb_address = $_POST['fb_address']; $idpage = $_POST['idpage']; $email = $_POST['email']; $total_revenue = 0; $real_revenue = 0; $virtual_revenue = 0; $total_orders = 0; $delivered_orders = 0; $pending_orders = 0; $cancelled_orders = 0; $config = $this->view->config = $store->getConfig($idpage); /*Get cart and cart details of a customer*/ $infoCarts = $store->getCustomerOrders($idpage, $email); foreach ($infoCarts as $key => $cart) { $idcart = $cart['id_cart']; $sql = "Select SUM(gia) From detail_cart Where id_cart = '{$idcart}' and idpage = '{$idpage}'"; $result = $store->SelectQuery($sql); $price = $result[0]['SUM(gia)']; if ($cart['status'] == 1 || $cart['status'] == 0) { $pending_orders++; $virtual_revenue = $virtual_revenue + $price; } else { if ($cart['status'] == 2) { $real_revenue = $real_revenue + $price; $delivered_orders++; } else { if ($cart['status'] == -1) { $cancelled_orders++; } } } if ($cart['status'] != -1) { $total_revenue = $total_revenue + $price; } $total_orders++; } ?> <div class="header_popup_content"> Thông Tin Khách Hàng <?php echo $name; ?> <p class="close_popup" onclick="close_popup()"><img src="<?php echo APP_DOMAIN; ?> /application/templates/giaodien_admin/images/delete.png"/></p> </div> <div class="popup_content"> <table class="table_detail_cart"> <tr> <td align='left'><strong>Thông tin khách hàng</strong></td> <td></td> </tr> <tr> <td align='right'>Họ và tên:</td> <td><?php echo $name; ?> </td> </tr> <tr> <td align='right'>Số điện thoại:</td> <td><?php echo $phone; ?> </td> </tr> <tr> <td align='right'>Địa chỉ:</td> <td><?php echo $address . " " . $district . " " . $city; ?> </td> </tr> <tr><td colspan="2"></td></tr> <tr> <td align='left'><strong>Thông tin liên lạc</strong></td> <td></td> </tr> <tr> <td align='right'>Email:</td> <td><?php echo $email; ?> </td> </tr> <tr> <td align='right'>Facebook:</td> <td><?php echo $fb_address; ?> </td> </tr> <tr> <td align='left'><strong>Thông tin mua hàng</strong></td> <td></td> </tr> <tr> <td align='right'>Doanh thu đã nhận:</td> <td><b><?php echo number_format($real_revenue, 0, ',', '.') . ' ' . $config['donvitien']; ?> </b></td> </tr> <tr> <td align='right'>Doanh thu chưa nhận:</td> <td><b><?php echo number_format($virtual_revenue, 0, ',', '.') . ' ' . $config['donvitien']; ?> </b></td> </tr> <tr> <td align='right'>Tổng doanh thu:</td> <td><b><?php echo number_format($total_revenue, 0, ',', '.') . ' ' . $config['donvitien']; ?> </b></td> </tr> <tr> <td align='left'><strong>Thông tin hoạt động</strong></td> <td></td> </tr> <tr> <td align='right'>Lần mua hàng gần nhất:</td> <td><?php echo $latest_order; ?> </td> </tr> <tr> <td align='right'>Mức độ uy tín:</td> <td><?php echo $rating; ?> </td> </tr> <tr> <td align='right'>Đơn hàng đã giao:</td> <td><b><?php echo $delivered_orders . " / " . $total_orders; ?> </b></td> </tr> <tr> <td align='right'>Đơn hàng chưa giao:</td> <td><b><?php echo $pending_orders . " / " . $total_orders; ?> </b></td> </tr> <tr> <td align='right'>Đơn hàng đã huỷ:</td> <td><b><?php echo $cancelled_orders . " / " . $total_orders; ?> </b></td> </tr> <tr> <td align='left'><strong>Danh sách đơn hàng</strong></td> <td></td> </tr> <tr> <table class="tbl-home" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="12%">Mã ĐH</th> <th width="10%">Ngày đặt</th> <th width="10%">Tình trạng</th> <th width="10%">Tổng giá</th> <th width="20%">Công cụ</th> </tr> <?php foreach ($infoCarts as $key => $value) { $datecreate = strtotime(substr($value['date_create'], 0, 10)); $datecreate = date('d-m-Y', $datecreate); $idcart = $value['id_cart']; $sql = "Select SUM(gia) From detail_cart Where id_cart = '{$idcart}' and idpage = '{$idpage}'"; $result = $store->SelectQuery($sql); $total_price = $result[0]['SUM(gia)']; ?> <tr> <td><?php echo $value['id_cart']; ?> </td> <td><?php echo $datecreate; ?> </td> <td> <div style="position: relative;"> <?php $st = ""; $status = ""; if ($value['status'] == -1) { $st = "cancel"; $status = "Hủy ĐH"; } if ($value['status'] == 0) { $st = "orange"; $status = "Chưa đọc"; } if ($value['status'] == 1) { $st = "green"; $status = "Chưa giao"; } if ($value['status'] == 2) { $st = "grey"; $status = "Đã giao"; } ?> <p class="status_cart status_cart_<?php echo $value['id_cart']; ?> <?php echo $st; ?> "><?php echo $status; ?> </p> </div> </td> <td><?php echo $total_price; ?> </td> <td align="center"> <a onclick="viewCart('<?php echo $value['id_cart']; ?> ')" href="javascript:void(0)"><img title="Chi tiết đơn hàng" alt="detail" src="<?php echo APP_DOMAIN . '/application/templates/giaodien_admin/images/setting.png'; ?> "/></a> </td> </tr> <?php } ?> </table> </tr> </table> </div> <?php }
public function dathangAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $store = $this->view->info = App_Models_StoreModel::getInstance(); $config = Zend_Registry::get(APPLICATION_CONFIG); $path_image = $config->config->path_image; $prefix = $config->config->prefix; $appid = $config->facebook->appid; $idpage = $_POST['idpage']; $pageConfig = $store->getConfig($idpage); $pageInfo = $store->getInfoPage($idpage); $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $city = $_POST['city']; $district = $_POST['district']; $address = $_POST['address']; $comment = $_POST['comment']; $idpage = $this->view->idpage; $isfbuser = $_POST['isfbuser']; $linkfb = $_POST['linkfb']; $idfb = $_POST['idfb']; /* if ($isfbuser == 1) { $_sql = "select * from customer where fb_id = '".$idfb."'"; $_rs = mysql_query($_sql); if (mysql_num_rows($_rs) == 0) { $_sql = "Insert into customer (`name`, `phone`, `email`, `city`, `district`, `address`, `fb_address`, `fb_id`, `idpage`) values ('$name', '$phone', '$email', '$city', '$district', '$address', '$linkfb', '$idfb', '$idpage')"; mysql_query($_sql); } } else if ($isfbuser == 0) { $_sql = "select * from customer where email = '".$email."'"; $_rs = mysql_query($_sql); if (mysql_num_rows($_rs) == 0) { $_sql = "Insert into customer (`name`, `phone`, `email`, `city`, `district`, `address`, `idpage`) values ('$name', '$phone', '$email', '$city', '$district', '$address', '$idpage')"; mysql_query($_sql); } } */ $_sql = "select * from customer where email = '" . $email . "'"; $_rs = mysql_query($_sql); if (mysql_num_rows($_rs) == 0) { $_sql = "Insert into customer (`name`, `phone`, `email`, `city`, `district`, `address`, `latest_order`, `fb_address`, `fb_id`, `idpage`)\r\n\t\t\t\t\t\t\t\t\tvalues ('{$name}', '{$phone}', '{$email}', '{$city}', '{$district}', '{$address}', now(), '{$linkfb}', '{$idfb}', '{$idpage}')"; mysql_query($_sql); } else { $_sql = "Update customer Set `phone` = '{$phone}', `city` = '{$city}', `district` = '{$district}', `address` = '{$address}', `latest_order` = now(), `fb_address` = '{$linkfb}', `fb_id` = '{$idfb}', Where `idpage` = '{$idpage}' and `email` = '{$email}'"; mysql_query($_sql); } $sql = "select id_cart from cart order by id_cart DESC"; $rs = mysql_query($sql); if (mysql_num_rows($rs) >= 1) { $row = mysql_fetch_row($rs); $last_idCart = $row[0]; $index_cart = explode('_', $last_idCart); $index_cart = $index_cart[1]; $index_cart = $index_cart + 1; } else { $index_cart = 1; } $len = strlen($index_cart); if ($len == 1) { $id_cart = $prefix . '_0000' . $index_cart; } if ($len == 2) { $id_cart = $prefix . '_000' . $index_cart; } if ($len == 3) { $id_cart = $prefix . '_00' . $index_cart; } if ($len == 4) { $id_cart = $prefix . '_0' . $index_cart; } if ($len == 5) { $id_cart = $prefix . '_' . $index_cart; } if (!isset($id_cart)) { $id_cart = $prefix . '_' . $index_cart; } $sql = "Insert into cart \r\n (`id_cart`, `date_create`, `date_modify`, `status`, `name`, `phone`, `email`, `city`, `district`, `address`, `comment`, `fb_id`, `idpage`)\r\n values ('{$id_cart}', now(), now(), '0', '{$name}','{$phone}', '{$email}', '{$city}', '{$district}', '{$address}', '{$comment}', '{$idfb}', '{$idpage}')"; mysql_query($sql); $cart = $_SESSION["cart_{$idpage}"]; $arraySanPham = array(); foreach ($cart as $idsp => $value) { $detailSanPham = $store->getProductById($idpage, $idsp); $arraySanPham[$idsp]['detail'] = $detailSanPham; $arraySanPham[$idsp]['soluong'] = $value['soluong']; //$arraySanPham[$idsp]['size'] = $value['size']; } foreach ($arraySanPham as $key => $value) { $idsp = $value['detail']['idsp']; $gia = $value['detail']['gia']; $giagiam = $value['detail']['giagiam']; $soluong = $value['soluong']; $sql = "insert into detail_cart (`id_cart`, `idsp`, `gia`, `giagiam`, `soluong`, `idpage`)\r\n values('{$id_cart}', '{$idsp}', '{$gia}', '{$giagiam}', '{$soluong}', '{$idpage}')"; mysql_query($sql); } $contentCart = "<table width='600' border='1' cellspacing='0' cellpadding='0'>"; $contentCart .= "<tr><td colspan='6'>Mã Đơn hàng: <span style='color:red; font-weight:bold'>{$id_cart}</span></td></tr>"; $contentCart .= "<tr><th width='30' bgcolor='#CCCCCC' scope='col'>STT</th><th width='125' bgcolor='#CCCCCC' scope='col'>HÌNH</th><th width='180' bgcolor='#CCCCCC' scope='col'>TÊN SP</th><th width='50' bgcolor='#CCCCCC' scope='col'>SL</th><th width='101' bgcolor='#CCCCCC' scope='col'>GIÁ</th><th width='100' bgcolor='#CCCCCC' scope='col'>THÀNH TIỀN</th></tr>"; $i = 1; $tongthanhtien = 0; foreach ($arraySanPham as $key => $value) { $stt = $i++; $image = $value['detail']['hinhchinh']; $tensp = $value['detail']['tensp']; $sl = $value['soluong']; //$size = $value['size']; $gia = $value['detail']['giagiam'] != 0 ? $value['detail']['giagiam'] : $value['detail']['gia']; $tonggia = $gia * $sl; $tongthanhtien += $tonggia; $gia = number_format($gia, 0, ',', '.'); $tonggia = number_format($tonggia, 0, ',', '.'); $contentCart .= "<tr><td align='center' valign='middle'>{$stt}</td><td align='center' valign='middle'><img width='85' height='65' src='{$image}'/></td><td>{$tensp}</td><td align='center' valign='middle'>{$sl}</td><td align='center' valign='middle'>{$gia}</td><td align='center' valign='middle'>{$tonggia}</td></tr>"; } $tongthanhtien = number_format($tongthanhtien, 0, ',', '.'); $contentCart .= "<tr><td colspan='5' align='center' valign='middle'><strong>TỔNG CỘNG</strong></td><td colspan='2' align='center' valign='middle'><strong>{$tongthanhtien}</strong></td></tr></table>"; //$contentCart_Email = $pageConfig['email_cart']; $path_template_email = APP_DOMAIN . '/application/layouts/bookshop/email/template_email.html'; $contentCart_Email = file_get_contents($path_template_email); $delivery = $pageConfig['delivery']; $contact = $pageConfig['contact']; $datenow = date("d-m-Y H:i:s"); $link_app = $pageInfo['link_page'] . '/app_' . $appid; $contentCart_Email = str_replace('[gio_hang]', $contentCart, $contentCart_Email); $contentCart_Email = str_replace('[id_cart]', $id_cart, $contentCart_Email); $contentCart_Email = str_replace('[name_shop]', $pageConfig['shopname'], $contentCart_Email); $contentCart_Email = str_replace('[link_page]', $pageInfo['link_page'], $contentCart_Email); $contentCart_Email = str_replace('[link_app]', $link_app, $contentCart_Email); $contentCart_Email = str_replace('[date_now]', $datenow, $contentCart_Email); $contentCart_Email = str_replace('[name]', $name, $contentCart_Email); $contentCart_Email = str_replace('[phone]', $phone, $contentCart_Email); $contentCart_Email = str_replace('[email]', $email, $contentCart_Email); $contentCart_Email = str_replace('[delivery]', $delivery, $contentCart_Email); $contentCart_Email = str_replace('[contact]', $contact, $contentCart_Email); $contentCart_Email = str_replace('[cart]', $contentCart, $contentCart_Email); unset($_SESSION["cart_{$idpage}"]); $titleEmail = $pageConfig['shopname']; $subjectEmail = $pageConfig['shopname'] . ' Thong tin don hang.'; $contentCart1 = $contentCart_Email; $subjectEmail2 = "ĐƠN HÀNG - {$name} - {$phone}"; $contentCart2 = "<p>Thông tin đơn hàng</p>"; $contentCart2 .= "Tên : {$name}<br/>"; $contentCart2 .= "Email : {$email}<br/>"; $contentCart2 .= "SĐT : {$phone}<br/>"; $contentCart2 .= "Thành phố : {$city}<br/>"; $contentCart2 .= "Quận : {$district}<br/>"; $contentCart2 .= "Địa chỉ : {$address}<br/>"; $contentCart2 .= "Ghi chú : {$comment}<br/>"; $contentCart2 .= $contentCart; $contact_email = $pageConfig['emailfrom']; //Email gui KH $send1 = $this->sendmail($email, $name, $titleEmail, $subjectEmail, $contentCart1, $titleEmail, $contact_email); //Email gui cho Quan ly echo $send2 = $this->sendmail($contact_email, $titleEmail, $name, $subjectEmail2, $contentCart2, $name, $email); if ($send2 == 1) { unset($_SESSION["cart_{$idpage}"]); } }
public function deleteAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $idcat = base64_decode($this->_request->getParam("idcat")); $sql = "Delete from ishali_loaisp where idloaisp = " . $idcat; $data = $store->InsertDeleteUpdateQuery($sql); header("location: ../category"); }
public function indexAction() { $config = Zend_Registry::get(APPLICATION_CONFIG); $store = $this->view->info = App_Models_StoreModel::getInstance(); if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } //$idpage = '356730004423499'; $sort = isset($_GET['sort']) ? $_GET['sort'] : ""; $sortSP = ""; switch ($sort) { case 'asc': $sortSP = "order by gia asc"; break; case 'desc': $sortSP = "order by gia desc"; break; case 'new': $sortSP = "order by idsp desc"; break; case '': $sortSP = ""; break; } $tab = isset($_GET['tab']) ? $_GET['tab'] : "1"; $where = ""; switch ($tab) { case '1': $where = ""; break; case '2': $where = "and spmoi = 1"; break; case '3': $where = "and sale_off != 0"; break; case '': $where = ""; break; } $page = @$_GET['page']; $cate = @$_GET['id']; $parent_cate = @$_GET['idp']; //$cate = round($cate); $cate = max(1,$cate); $num_page = $store->getNumPage($idpage, $cate, 0, $where, $parent_cate); $page = round($page); $page = max(1, $page); $page = min($num_page, $page); $this->view->listProduct = $store->getListProductByIdCate($idpage, $cate, 0, $page, $where, $sortSP, $parent_cate); $this->view->num_page = $num_page; $this->view->curent_page = $page; $sort = $sort != "" ? "&sort={$sort}" : ""; $tab = $tab != "1" ? "&tab={$tab}" : ""; $cate = $cate != "" ? "&id={$cate}" : ""; $parent_cate = $parent_cate != "" ? "&idp={$parent_cate}" : ""; $link = APP_DOMAIN . "/category?idpage=" . $idpage . $tab . $sort . $cate . $parent_cate . "&page=np"; $this->view->cate = $cate; $this->view->parent_cate = $parent_cate; $this->view->pagination = $store->pagination(5, $num_page, $link, $page); $this->view->pageConfig = $store->getConfig($idpage); }
public function indexAction() { $config = Zend_Registry::get(APPLICATION_CONFIG); $store = $this->view->info = App_Models_StoreModel::getInstance(); if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } if (isset($_GET['tabs_added'])) { $tabs_added = $_GET['tabs_added']; foreach ($tabs_added as $idpage => $status) { $appid = $config->facebook->appid; } //$linkPage = "http://facebook.com/$idpage?sk=app_$appid"; $linkPage = FB_APP_DOMAIN . '/admin'; echo "<p style=''>INSTALL APP SUCCESS. <a target='_top' href='{$linkPage}'>CLICK</a> TO CONFIG APP.</p>"; exit; } //$idpage = '356730004423499'; $sort = isset($_GET['sort']) ? $_GET['sort'] : ""; $sortSP = ""; switch ($sort) { case 'asc': $sortSP = "order by gia asc"; break; case 'desc': $sortSP = "order by gia desc"; break; case 'new': $sortSP = "order by idsp desc"; break; case '': $sortSP = ""; break; } $tab = isset($_GET['tab']) ? $_GET['tab'] : "1"; $where = ""; switch ($tab) { case '1': $where = ""; break; case '2': $where = "and spmoi = 1"; break; case '3': $where = "and sale_off != 0"; break; case '': $where = ""; break; } $page = @$_GET['page']; $num_page = $store->getNumPage($idpage, 0, 0, $where); $page = round($page); $page = max(1, $page); $page = min($num_page, $page); $this->view->listProduct = $store->getListProductByIdCate($idpage, 0, 0, $page, $where, $sortSP); $this->view->num_page = $num_page; $this->view->curent_page = $page; $sort = $sort != "" ? "&sort={$sort}" : ""; $tab = $tab != "1" ? "&tab={$tab}" : ""; $link = APP_DOMAIN . '?idpage=' . $idpage . $tab . $sort . '&page=np'; $this->view->pagination = $store->pagination(5, $num_page, $link, $page); }