Exemplo n.º 1
0
 function index()
 {
     if (!Login::verifyLogin()) {
         header("Location: ../../home/login/index");
         exit;
     }
     $user_id = "";
     if (isset($_SESSION['user_id'])) {
         $user_id = $_SESSION['user_id'];
         if (!empty($user_id)) {
             $user_data = Login::verify_login($user_id);
             if (!empty($user_data)) {
                 // var_dump($user_data);
                 $this->assign('user_data', $user_data);
             }
         }
     }
     $m_order = new Orders();
     $field = array('ord.id', 'ord.order_no', 'ord.created', 'ord.status', 'ord.product_id', 'ord.qty', 'ord.freight', 'pr.product_url', 'pr.title_cn', 'pr.title_th', 'pr.category_3_id', 'pr.floor_3_id', 'pr.image_url', 'pr.product_url', 'pr.shop', 'pr.shop_id', 'pr.shop_url', 'pr.product_id', 'pr.status', 'pr.category_1_id', 'pr.sales_price');
     $m_order->clear();
     $m_order->setField($field);
     $m_order->setTable(' vcb_order as ord');
     $m_order->setJoin(' vcb_product as pr ', 'ord.product_id=pr.product_id');
     $count = $m_order->getRowsCount();
     //var_dump($count);
     $page = new Page($count, 5);
     $parameter = array();
     $page->setParameter($parameter);
     $showPage = $page->showPage();
     $showTotal = $page->showTotal();
     //var_dump($showPage);
     //var_dump($showTotal);
     $m_order->setPage();
     $page->setListRows(5);
     $m_order->setWhere('ord.user_id', '=', $user_id);
     $m_order->setWhere('ord.status', '!=', 60000);
     $m_order->setLimit($page->listRows);
     $order_data = $m_order->select();
     //	var_dump($order_data);
     /* $product_data = array();
               $m_product = new products();
               for($i = 0;$i<count($order_data);$i++){
     
               $product_data[$i] = $m_product->getproducts_id($order_data[$i]['product_id']);
     
               } */
     //var_dump($product_data);
     $this->assign('order_data', $order_data);
     $this->assign('showPage', $showPage);
     $this->assign('showTotal', $showTotal);
     //$this->assign('pro_data', $product_data);
 }
Exemplo n.º 2
0
 function index()
 {
     if (!Login::verifyLogin()) {
         header("Location: ../../home/login/index");
         exit;
     }
     if (isset($_SESSION['user_id'])) {
         $user_id = $_SESSION['user_id'];
         if (!empty($user_id)) {
             $user_data = Login::verify_login($user_id);
             if (!empty($user_data)) {
                 // var_dump($user_data);
                 $this->assign('user_data', $user_data);
             }
         }
     }
 }
Exemplo n.º 3
0
 function add_favorites()
 {
     if (!Login::verifyLogin()) {
         header("Location: ../login/index");
         exit;
     }
     $shop_id = get_post_value('shop_id');
     $shop_site = get_post_value('shop_site');
     $shop_username = get_post_value('shop_username');
     $shop_url = get_post_value('shop_url');
     $product_id = get_post_value('product_id');
     $product = get_post_value('product');
     $product_url = get_post_value('product_url');
     $image_url = get_post_value('image_url');
     $m = new Favorites();
     $data = $m->addFavorites($shop_site, $shop_id, $shop_username, $shop_url, $product_id, $product_url, $product, $image_url);
     $this->assign('message', $data);
     $this->setReturnType('message');
 }
Exemplo n.º 4
0
 function add_cart()
 {
     $shop_site = get_post_value('shop_site');
     $image_url = get_post_value('image_url');
     $product = get_post_value('product');
     $product_url = get_post_value('product_url');
     $product_id = get_post_value('product_id');
     $shop_url = get_post_value('shop_url');
     $shop_username = get_post_value('shop_username');
     $qty = get_post_value('qty');
     $sku = get_post_value('sku');
     $sku_name = get_post_value('sku_name');
     $price = get_post_value('price_cn');
     $shop_id = get_post_value('shop_id');
     if (!Login::verifyLogin()) {
         // var_dump($cart_array);
         if (empty($_COOKIE['shop_cart_info'])) {
             //   $cart_info[0]['shop_site'] = $shop_site;
             $cart_info[0]['image_url'] = $image_url;
             //   $cart_info[0]['product'] = $product;
             //   $cart_info[0]['product_url'] = $product_url;
             $cart_info[0]['product_id'] = $product_id;
             // $cart_info[0]['shop_url'] = $shop_url;
             //$cart_info[0]['shop_username'] = $shop_username;
             $cart_info[0]['qty'] = $qty;
             $cart_info[0]['sku'] = $sku;
             $cart_info[0]['sku_name'] = $sku_name;
             // $cart_info[0]['price'] = $price;
             //$cart_info[0]['shop_id'] = $shop_id;
             setcookie("shop_cart_info", serialize($cart_info), time() + 3600 * 24, '/');
             $this->assign('message', 2);
             $this->setReturnType('message');
         } else {
             $cart_array = unserialize(stripslashes($_COOKIE['shop_cart_info']));
             $ar_keys = array_keys($cart_array);
             rsort($ar_keys);
             $max_array_keyid = $ar_keys[0] + 1;
             //  $cur_cart_array[$max_array_keyid]['shop_site'] = $shop_site;
             $cart_array[$max_array_keyid]['image_url'] = $image_url;
             // $cur_cart_array[$max_array_keyid]['product'] = $product;
             // $cur_cart_array[$max_array_keyid]['product_url'] = $product_url;
             $cart_array[$max_array_keyid]['product_id'] = $product_id;
             // $cur_cart_array[$max_array_keyid]['shop_url'] = $shop_url;
             // $cur_cart_array[$max_array_keyid]['shop_username'] = $shop_username;
             $cart_array[$max_array_keyid]['qty'] = $qty;
             $cart_array[$max_array_keyid]['sku'] = $sku;
             $cart_array[$max_array_keyid]['sku_name'] = $sku_name;
             //  $cur_cart_array[$max_array_keyid]['price'] = $price;
             // $cur_cart_array[$max_array_keyid]['shop_id'] = $shop_id;
             setcookie("shop_cart_info", serialize($cart_array), time() + 3600 * 24, '/');
             $this->assign('message', 2);
             $this->setReturnType('message');
         }
     } else {
         if (isset($_SESSION['user_id'])) {
             $user_id = $_SESSION['user_id'];
         } else {
             $this->assign('message', 0);
             $this->setReturnType('message');
             exit;
         }
         // 保存数据
         $m = new Cart();
         $field = array('created' => date('Y-m-d H:i:s', time()), 'user_id' => $user_id, 'shop_username' => $shop_username, 'shop_url' => $shop_url, 'product_id' => $product_id, 'product_url' => $product_url, 'shop_url' => $shop_url, 'shop_username' => $shop_username, 'qty' => $qty, 'sku' => $sku, 'sku_name' => $sku_name, 'status' => '10000', 'product' => $product, 'image_url' => $image_url, 'price' => $price, 'shop_id' => $shop_id, 'shop_site' => $shop_site);
         $m->clear();
         $m->setField($field);
         $m->setTable('vcb_cart');
         $data = $m->insert();
         if (!empty($data)) {
             $data = 1;
         } else {
             $data = 0;
         }
         $this->assign('message', 1);
         $this->setReturnType('message');
     }
 }
Exemplo n.º 5
0
 function delete()
 {
     $id = get_post_value('id');
     if (!Login::verifyLogin()) {
         header("Location:../error/login_error");
     } else {
         $m = new Cart();
         $m->deleteCart($id);
         header("Location: index");
     }
 }
Exemplo n.º 6
0
<?php

require_once "../loadenv.php";
require_once LIBDIR . "Login.php";
/* Check if posted from form, if not send back to index.php */
if (!isset($_POST['submit'])) {
    header("Location: index.php");
    exit;
} else {
    echo "Login";
    $login = new Login();
    $login->verifyLogin($_POST['username'], $_POST['password']);
}