public function edit($id)
 {
     $view = new View("product/edit.php");
     $modelProduct = new Product();
     $product = $modelProduct->getProduct($id);
     $view->set('product', $product);
     $view->output();
 }
 public function showAction($name, $id)
 {
     $product = new Product();
     $product->getProduct($name, $id);
     $this->view->product = $product->product;
     $this->view->category_name = $product->productCategoryName;
     $this->view->productOpinions = $product->productOpinions;
     $this->view->opinionVotes = OpinionVote::getVotesByUserId($this->session->get('id'));
 }
Example #3
0
 /**
  * Make link fix product
  *
  * @author MinhNV
  * Date 2010/07/07
  */
 private function makeLinkProduct()
 {
     $link_depart = '';
     $link_section = '';
     $link_product = '';
     $link_url = '';
     $depart_id = Url::get('depart_id', 0);
     $cat_id = Url::get('cat_id', 0);
     $cat_name = Url::get('cat_name', '');
     $url_filter = Url::get('url_filter');
     $arySerialize = array();
     $url_serialize = '';
     $url_product = Url::get('url_product');
     $aryParamFilter = array();
     $is_same_cat = Url::get('is_same_cat', 0);
     $is_same_depart = Url::get('is_same_depart', 0);
     $is_new = Url::get('is_new', 0);
     $is_discount_new = Url::get('is_discount_new', 0);
     $is_discount = Url::get('is_discount', 0);
     $is_attention = Url::get('is_attention', 0);
     $type_special = 0;
     if ($is_new == 1) {
         $type_special = IS_NEW;
     }
     if ($is_discount_new == 1) {
         $type_special = IS_DISCOUNT_NEW;
     }
     if ($is_discount == 1) {
         $type_special = IS_DISCOUNT;
     }
     if ($is_attention == 1) {
         $type_special = NUM_CLASSIFIED;
     }
     $city_id = Url::get('city_id', 0);
     $district_id = Url::get('district_id', 0);
     if ($url_filter) {
         $aryParamFilter = $this->buildArrayFromURL($url_filter);
     }
     if ($url_product) {
         $aryProduct = explode(',', $url_product);
         if (is_array($aryProduct) && count($aryProduct) == 1) {
             $page = '';
             $aryProduct = Product::getProduct($url_product);
             $link_product = Product::buildLinkProductDetail(0, $aryProduct['category_id'], $aryProduct['id'], $aryProduct['name']);
             $arySerialize = array('page' => $page, 'params' => array('id' => $url_product, 'title' => EClassApi::safe_title($aryProduct['name'])));
         } else {
             if ($is_same_cat == 1) {
                 $page = CGlobal::$aryDepartName[$depart_id] . '_section';
                 $link_product = Url::build($page, array('cat_product_id' => $cat_id, 'title' => EClassApi::safe_title($cat_name), 'product_id' => $url_product));
                 $arySerialize = array('page' => $page, 'params' => array('cat_product_id' => $cat_id, 'title' => EClassApi::safe_title($cat_name), 'product_id' => $url_product));
             } else {
                 $page = 'list_product';
                 $link_product = Url::build($page, array('product_id' => $url_product));
                 $arySerialize = array('page' => $page, 'params' => array('product_id' => $url_product));
             }
         }
     } else {
         if ($depart_id) {
             $page = CGlobal::$aryDepartName[$depart_id];
             //Neu co tinh thanh
             if ($city_id > 0) {
                 $aryCity = SoLib::getListOptionCity();
                 if ($district_id > 0) {
                     //Get quan huyen
                     $aryDistrict = EClassApi::getDistrict($city_id);
                     //$districtName = $this->getDistrictName ( $district_id );
                     $aryParams = array('city_id' => $city_id, 'district_id' => $district_id, 'title' => safe_title($aryDistrict['name']));
                     $arySerialize = array('page' => $page, 'params' => $aryParams);
                     $link_depart = Url::build($page, $aryParams);
                 } else {
                     $aryParams = array('city_id' => $city_id, 'title' => safe_title($aryCity[$city_id]));
                     $arySerialize = array('page' => $page, 'params' => $aryParams);
                     $link_depart = Url::build($page, $aryParams);
                 }
             } else {
                 if ($url_filter) {
                     if ($depart_id == CGlobal::THOI_TRANG || $depart_id == CGlobal::SACH) {
                         $page = CGlobal::$aryDepartName[$depart_id] . '_section';
                         $aryParams = array('cat_product_id' => $depart_id, 'title' => safe_title(CGlobal::$aryDepart[$depart_id]));
                         $aryParams = array_merge($aryParams, $aryParamFilter);
                     } else {
                         $aryParams = $aryParamFilter;
                     }
                     $arySerialize = array('page' => $page, 'params' => $aryParams);
                     $link_depart = Url::build($page, $aryParams);
                 } else {
                     $arySerialize = array('page' => $page, 'params' => array());
                     $link_depart = Url::build($page, array());
                 }
             }
             if ($cat_id) {
                 $page = CGlobal::$aryDepartName[$depart_id] . '_section';
                 if ($city_id > 0) {
                     $aryCity = SoLib::getListOptionCity();
                     if ($district_id > 0) {
                         //Get quan huyen
                         $aryDistrict = EClassApi::getDistrict($city_id);
                         //$aryDistrict = EClassApi::getDistrict($city_id);
                         $aryParams = array('cat_product_id' => $cat_id, 'city_id' => $city_id, 'district_id' => $district_id, 'title' => safe_title($aryDistrict['name']));
                     } else {
                         $aryParams = array('cat_product_id' => $cat_id, 'city_id' => $city_id, 'title' => safe_title($aryCity[$city_id]));
                     }
                     $arySerialize = array('page' => $page, 'params' => $aryParams);
                     $link_depart = Url::build($page, $aryParams);
                 } else {
                     if ($type_special > 0) {
                         $page = 'list_special';
                         $aryParams = array('cat_product_id' => $cat_id, 'type' => $type_special, 'title' => safe_title($cat_name));
                     } else {
                         $aryParams = array('cat_product_id' => $cat_id, 'title' => safe_title($cat_name));
                     }
                     if ($url_filter) {
                         $aryParams = array_merge($aryParams, $aryParamFilter);
                     }
                     $arySerialize = array('page' => $page, 'params' => $aryParams);
                     $link_depart = Url::build($page, $aryParams);
                 }
             }
         }
     }
     if ($link_product) {
         $link_url = $link_product;
     } else {
         if ($link_depart) {
             $link_url = $link_depart;
         }
     }
     if (is_array($arySerialize) && count($arySerialize) > 0) {
         $url_serialize = serialize($arySerialize);
     }
     $aryData = array();
     $aryData['link_product_fix'] = $link_url;
     $aryData['url_serialize'] = $url_serialize;
     $aryData['intIsOK'] = 1;
     echo json_encode($aryData);
     exit;
 }
Example #4
0
<?php

//首页文件
//接受用户动作
$act = isset($_REQUEST['act']) ? $_REQUEST['act'] : 'index';
//加载初始化文件
include_once './includes/init.php';
//判断动作,处理动作
if ($act == 'index') {
    //查看所有分类信息
    $category = new Product();
    $categories = $category->getProduct();
    //产看特价和热销产品
    $goods = new Goods();
    $goods_offer = $goods->getGoods(8);
    $goods_hot = $goods->getGoods(12);
    $_SESSION['uri'] = $_SERVER['REQUEST_URI'];
    //查寻新闻
    $news = new News();
    $lists = $news->AllList();
    //加载首页显示模板
    include_once YIMAI_TEMP . 'index.html';
} elseif ($act == 'display') {
    //获取分类ID
    $c_id = $_GET['id'];
    //接受商品列表显示页码
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $pagecount = $config['pagecount'];
    //var_dump($pagecount);
    //获取该类商品的总记录数
    $goods = new Goods();
Example #5
0
	$('#modal-close-callsback').click(function(){
		window.location = api.base_url + '/product';
	});

});
</script>
<?php 
include_once "api/product.php";
$Products = new Product();
?>
<div class="container">
<h2>Edit Product</h2><br>
<div class="row">
<?php 
if ($id) {
    $getProduct = $Products->getProduct($id);
    if (count($getProduct)) {
        ?>
	<div class="col-md-8">

	<form class="form-horizontal" role="form">
		<div class="form-group">
			<label for="product" class="col-sm-2 control-label">Product</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" id="product" placeholder="Enter product name" value="<?php 
        echo $getProduct->product;
        ?>
" />
			</div>
		</div>
		<div class="form-group">
Example #6
0
echo utf8_encode($product->getCategoryName());
?>
</a>
		  <span class="navigation-pipe">/</span> 
		  <a title="" href="product-grid2.php?idSubCategory=<?php 
echo $infos['id_ss_categorie'];
?>
"><?php 
echo utf8_encode($product->getSubCategoryName());
?>
</a>
		  <span class="navigation-pipe">/</span> 
		  <span class="navigation_page">
			<?php 
$product = new Product($db, $_GET['idProduit']);
$infos = $product->getProduct();
echo utf8_encode($infos['libelle_produit']);
?>
		  </span> 
	  </div>
      <div class="clearfix" id="primary_block"> 
        
        <!-- right infos-->
        <div id="pb-right-column"> 

          <!-- product img-->
          <div id="image-block">
            <link rel="stylesheet" href="css/prettyPhoto.css" />
            <script src="js/jquery.prettyPhoto.js"></script> 
            <script type="text/javascript">
if (isset($_POST['submitedit'])) {
    $as = array();
    foreach ($_POST['auto_subscribe_lists'] as $network => $list) {
        if ($list > 0) {
            $as[] = $list;
        }
    }
    $_POST['auto_subscribe_lists'] = join(",", $as);
    $p->Edit($_POST);
    Misc::Redirect('product_list.php');
}
if (isset($_POST['submitdelete'])) {
    $p->Delete($_POST['id']);
    Misc::Redirect('product_list.php');
}
$pr = $p->getProduct($_GET['id']);
$pr['auto_subscribe_lists'] = explode(',', $pr['auto_subscribe_lists']);
include 'include/top.php';
?>

<form method="post">
	<input type="hidden" id="hidden" name="id" value="<?php 
echo $pr['id'];
?>
" />
	<p>
		<label><span>Title</span></label>
		<input type="text" name="title" id="title" placeholder="Enter product title" value="<?php 
echo $pr['title'];
?>
" />
Example #8
0
 /**
  * @param $slug
  * @return mixed
  */
 public function getProduct($slug)
 {
     $data['content_header'] = ucfirst($slug);
     $values = Product::getProduct($slug);
     $data['values'] = $values;
     $data['slug_tag'] = $slug;
     return View::make('admin.product.product', $data);
 }
Example #9
0
    if ($product->HasGoods($id)) {
        //存在商品 ,不允许删除
        redirect('productClass.php', '当前分类下还存在商品,不允许直接删除');
    }
    //删除商品分类
    if ($product->DeletePreductId($id)) {
        redirect('productClass.php', '删除成功', 1000);
    }
} elseif ($act == 'edit') {
    //编辑分类信息
    //接收用户id
    $id = $_GET['id'];
    $product = new Product();
    $pro = $product->getProductById($id);
    //获取 商品分类信息
    $products = $product->getProduct();
    //加载模板
    include_once ADMIN_TEMP . "productClass-modify.html";
} elseif ($act == 'update') {
    //更新商品分类
    $id = $_GET['id'];
    //获取用户提交的数据
    $c_name = trim($_POST['className']);
    $c_parent_id = trim($_POST['parentId']);
    //合法性判断
    //合法性验证
    if (empty($c_name)) {
        //如果为空,跳转到添加页面
        redirect('productClass.php?act=edit', '分类名不能为空!');
    }
    //合理性验证
Example #10
0
<?php

require 'include/config.php';
if (!isset($_GET['email']) || !isset($_GET['product'])) {
    die('Both email and product id are required!');
}
require 'include/class.product.php';
$p = new Product($db);
$product = $p->getProduct($_GET['product']);
if (!isset($product['id'])) {
    die('Product does not exist!');
}
include "go_template.html";
require 'include/class.user.php';
$u = new User($db);
$user = $u->getUserByEmail($_GET['email']);
if (!isset($user['id'])) {
    $u->Insert(array('name' => 'Unknown user', 'email' => $_GET['email'], 'source' => isset($_GET['source']) ? $_GET['source'] : ''));
    $user = $u->getUserByEmail($_GET['email']);
}
require 'include/class.tracking.php';
$t = new Tracking($db);
$hash = $t->newSession(array('user_id' => $user['id'], 'product_id' => $product['id'], 'source' => 'forwarder', 'cid' => $_GET['cid']));
$link = $product['networkLink'];
if (strlen($product['parameter']) > 0) {
    if (strpos($link, '?') !== false) {
        $link .= "&" . $product['parameter'];
    } else {
        $link .= "?" . $product['parameter'];
    }
}
 public function testProduct()
 {
     $product = $this->getMock('JLM\\ProductBundle\\Model\\ProductInterface');
     $this->assertSame($this->entity, $this->entity->setProduct($product));
     $this->assertSame($product, $this->entity->getProduct());
 }
Example #12
0
?>
		
		</div>			

		<div class="row package-option">	
			
			<?php 
Product::getProduct(26, 'Динозавры', '26.jpg', '', 290, 0, 'Аксесуары', 0);
?>
			
			<?php 
Product::getProduct(27, 'Животные', '27.jpg', '', 290, 0, 'Аксесуары', 0);
?>
			
			<?php 
Product::getProduct(28, 'Зверята', '28.jpg', '', 100, 0, 'Аксесуары', 0);
?>
			
			
			<?php 
//Product::getProduct(30,'Динозавр','30.jpg','', 290, 0,'Аксесуары',0);
?>
		
		</div>	
				
	</div>
</div>

<!-- /.client section -->
<div id="delivery"> 
		<div class="container">
Example #13
0
        } else {
            $oResponse->safe = $tag->probs[1] > 0.5;
        }
    } else {
        $oResponse->data = array($response->status_msg);
    }
    echoResponse($oResponse);
});
$app->get("/product", function () use($app) {
    $product = Product::getProducts();
    $oResponse = $product;
    echoResponse($oResponse);
});
$app->get("/product/:id", function ($id) use($app) {
    $oResponse = new stdObject();
    $product = Product::getProduct($id);
    $oResponse->product = $product;
    echoResponse($oResponse);
});
$app->post("/product", function () use($app) {
    $params = $app->request->post();
    $oResponse = new stdObject();
    $name = $params['name'];
    $seller = $params['seller'];
    $photo = $params['photo'];
    $price = $params['price'];
    $docid = "";
    $verify_photo = \Clarifai\NSFW::retrieve($photo);
    $safe = false;
    if ($verify_photo->status_code == "OK") {
        $docid = $verify_photo->results[0]->docid;