示例#1
0
 /**
  * 返回国家列表
  * @access public
  */
 function index()
 {
     $key = strtolower(get_post_value('key'));
     $field = array('product_url', 'title_cn', 'title_th', 'category_3_id', 'floor_3_id', 'image_url', 'product_url', 'shop', 'shop_id', 'shop_url', 'product_id', 'status', 'category_1_id', 'sales_price');
     $m = new Products();
     $m->clear();
     $m->setTable('vcb_product');
     //设置表名
     $m->setField($field);
     $m->setWhere('title_cn', 'LIKE', '%' . $key . '%', 'and', '(');
     $m->setWhere('title_th', 'LIKE', '%' . $key . '%', 'or');
     $m->setWhere('shop', 'LIKE', '%' . $key . '%', 'or', ')');
     $count = $m->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->setPage();
     $page->setListRows(5);
     $m->setLimit($page->listRows);
     $data = $m->select();
     $this->assign('data', $data);
     $this->assign('key', $key);
     $this->assign('showPage', $showPage);
     //输出分页
     $this->assign('showTotal', $showTotal);
 }
 function get_size()
 {
     $id = get_post_value("id");
     $field = array('id', 'size', 'sku');
     $m = new Products();
     $m->clear();
     $m->setTable(' vcb_product_ksize ');
     //设置表名
     $m->setField($field);
     $m->setWhere('product_kind_id', '=', $id);
     $data = $m->select();
     $this->assign('json', $data);
     $this->setReturnType('json');
 }
 /**
  * 返回更新国家信息
  * @access public
  */
 function update()
 {
     $id = get_post_value('id');
     $field = array('product_url', 'title_cn', 'title_th', 'category_3_id', 'floor_3_id', 'purchase_price', 'image_url', 'product_url', 'shop_id', 'shop_url', 'product_id', 'status', 'shop', 'sales_price', 'purchase_price', 'preferential_price');
     $m = new Products();
     $m->clear();
     $m->setTable('vcb_product');
     //设置表名
     $m->setWhere('product_id', '=', $id);
     $m->setField($field);
     $data = $m->select();
     var_dump($data);
     $this->assign('data', $data);
     $upload = new Upload();
     $this->assign('upload', $upload->show());
 }
 private function verify_kind($id)
 {
     $m = new Products();
     $field = array('id');
     $m->clear();
     $m->setField($field);
     $m->setTable(' vcb_product_kind ');
     $m->setWhere('id', ' = ', $id);
     $data = $m->select();
     return $data;
 }
           <?php 
require_once 'tables.php';
$product = new Products();
$res = $product->select();
for ($i = 0; $i < count($res); $i++) {
    echo "<tr><td>" . $res[$i][1] . "</td>";
    echo "<td>" . $res[$i][4] . " EPG</td>";
    echo "<td><img width='60px' height='60px' src='images/" . $res[$i][2] . "'/></td>";
    echo "<td><button class='Availability' >Availability</button><button>DEL</button><button>Edit</button></td></tr>";
}
?>
               
       </table>
      
 
示例#6
0
<?php

require_once 'tables.php';
// header('Content-Type: text/event-stream');
// header('Cache-Control: no-cache');
/*
code=0 ----------> pagination 
code=1 ----------> delete 
code=2 ----------> edit 
*/
$product = new Products();
$totalRes = $product->select();
if ($_GET['code'] == "1") {
    $product->pid = $_GET['PID'];
    //////////////////////
    $Product = new Products();
    $Product->pname = $name_product;
    $Product->productPicture = $upimage;
    $Product->price = $price_prodect;
    $Product->available = '1';
    $Product->cid = $category;
    //////////////
    //  $product->updatecolumn('pname',$Product->pname);
} else {
    if ($_GET['code'] == "2") {
        $product = new Products();
        $product->pid = $_GET['pid'];
        $Op = new orderProducts();
        $Op->pid = $_GET['pid'];
        $Op->deleteByPID();
        $product->delete();
 function addtaobaosave()
 {
     $product_url = get_post_value('product_url');
     $title_cn = get_post_value('title_cn');
     $title_th = get_post_value('title_th');
     $category_1 = get_post_value('category_1');
     $category_2 = get_post_value('category_2');
     $category_3 = get_post_value('category_3');
     $floor_1 = get_post_value('floor_1');
     $floor_2 = get_post_value('floor_2');
     $floor_3 = get_post_value('floor_3');
     $purchase_price = trim(get_post_value('purchase_price'));
     $sales_price = trim(get_post_value('sales_price'));
     $start_time = get_post_value('start_time');
     $end_time = get_post_value('end_time');
     $image_url = get_post_value('image_url');
     $product_url = get_post_value('product_url');
     $shop_id = get_post_value('shop_id');
     $shop = get_post_value('shop');
     $shop_url = get_post_value('shop_url');
     $preferential_price = get_post_value('preferential_price');
     $shop_img = get_post_value('shop_img');
     $type0 = get_post_value('type0');
     $type1 = get_post_value('type1');
     $type2 = get_post_value('type2');
     $location = get_post_value('location');
     $imgsrc = get_post_value('imgsrc');
     $imgsrc = explode('|', $imgsrc);
     $array_type0 = explode('|', $type0);
     $array_type1 = explode('|', $type1);
     $array_type2 = explode('|', $type2);
     $now = date('Y');
     $p_name = time() . ".png";
     $p_url_ = "Upload/Products/" . date('Y') . "/" . date('m') . "/" . date('d') . "/";
     $purl_ = "Products/" . date('Y') . "/" . date('m') . "/" . date('d') . "/";
     get_file($shop_img, $p_url_, $p_name);
     $field = array('product_url' => trim($product_url), 'title_cn' => trim($title_cn), 'title_th' => trim($title_th), 'category_1_cn' => trim($category_1), 'category_2_cn' => trim($category_2), 'category_3_cn' => trim($category_3), 'floor_3_id' => trim($floor_3), 'purchase_price' => intval($purchase_price), 'sales_price' => intval($sales_price), 'preferential_price' => intval($preferential_price), 'old_price' => intval($preferential_price), 'image_path' => $purl_ . $p_name, 'shop' => trim($shop), 'start_time' => $start_time, 'end_time' => $end_time, 'hits' => '0', 'buys' => '0', 'favorites' => '0', 'created' => date('Y-m-d H:i:s', time()), 'created_name' => '', 'upload_name' => '', 'status' => '10000');
     $m = new Products();
     $m->clear();
     $m->setTable('vcb_product');
     //设置表名
     $m->setField($field);
     //设置更新字段及值,(键值数组)
     $data1 = $m->insert();
     //插入数据
     $field = array('product_id');
     $m->clear();
     $m->setField($field);
     $m->setTable('vcb_product');
     $m->setWhere('image_path', '=', $purl_ . $p_name);
     $data = $m->select();
     $product_id = $data[0]['product_id'];
     //这部分得修改aa:aa01|bb:bb01|cc:cc01
     foreach ($array_type0 as $key => $type0) {
         foreach ($array_type1 as $type1) {
             foreach ($array_type2 as $type2) {
                 $sku_name_cn = "颜色:" . $type0 . "|尺码:" . $type1 . "|重量:5kg";
                 $field = array('product_id' => $product_id, 'sku_code' => 'aa:aa01|bb:bb01|cc:cc01', 'sku_name_cn' => $sku_name_cn, 'sku_name_th' => NULL, 'sku_name_en' => NULL, 'qty' => '100', 'sales_price' => '1000', 'old_price' => '800');
                 $m->clear();
                 $m->setTable('vcb_product_sku');
                 $m->setField($field);
                 $data2 = $m->insert();
             }
         }
     }
     //这部分得修改aa:aa01|bb:bb01|cc:cc01
     for ($i = 0; $i < 1; $i++) {
         get_file($shop_img, $p_url_, $p_name . $i);
         $field = array('product_id' => $product_id, 'imgShowPath' => $purl_ . $p_name, 'imgDetailPath' => $purl_ . $p_name);
         $m->clear();
         $m->setTable('vcb_product_img_detail');
         $m->setField($field);
         $data3 = $m->insert();
     }
     //插入数据是否成功。
     if ($data1 && $data2 && $data3) {
         echo '<br>保存成功,<a href="add1">继续添加</a>,<a href="index">返回</a><br>';
     } else {
         echo '<br>保存失败<br>';
     }
 }
示例#8
0
 function get_orders()
 {
     $id = get_post_value("id");
     $order = get_post_value('order');
     $field = array('product_url', 'title_cn', 'title_th', 'category_3_id', 'floor_3_id', 'purchase_price', 'image_url', 'sales_price', 'product_url', 'shop', 'shop_id', 'shop_url', 'product_id', 'status', 'buys', 'category_1_id');
     $m = new Products();
     $m->clear();
     $m->setTable('vcb_product');
     //设置表名
     $m->setField($field);
     $count = $m->getRowsCount();
     //var_dump($count);
     $page = new Page($count, 2);
     $parameter = array();
     $page->setParameter($parameter);
     $showPage = $page->showPage();
     $showTotal = $page->showTotal();
     //var_dump($showPage);
     //var_dump($showTotal);
     $m->setPage();
     $page->setListRows(2);
     $m->setWhere('category_1_id', '=', $id);
     $m->setLimit($page->listRows);
     $m->setOrderBy(array($order => 'DESC'));
     $data = $m->select();
     $this->assign('data', $data);
 }