Exemplo n.º 1
0
require_once $realLibPath . "model/v_categoryPro.model.php";
require_once $realLibPath . "model/v_product.model.php";
require_once $realLibPath . "model/images.model.php";
//获取所有类别
$vcPro = new VCategoryPro();
$result = $vcPro->query(array("status" => "Y", "parentID" => '0'), array("ID", "name"));
$lastResult = $result;
$lastResult = array_slice($lastResult, 4, 1);
//var_dump($lastResult);
$result = array_slice($result, 0, 4);
$vpm = new VProduct();
$img = new Images();
//根据类别id获取所有商品信息
foreach ($result as $item) {
    //获取所有子类信息
    $childIdArray = $vcPro->getChildIDArray($item['ID']);
    ?>
<!--开始混便html-->
	   			<div id='pro_<?php 
    echo $item['ID'];
    ?>
'>
				<div id="hm_product">
				<img src="../shop-images/ti-pic<?php 
    echo $item['ID'];
    ?>
.png"  />
				<div id="hm_product_ti_word" ><span><?php 
    echo $item['name'];
    ?>
</span></div>
Exemplo n.º 2
0
require_once "../admin/web.config.php";
require_once $realLibPath . "model/v_product.model.php";
require_once $realLibPath . "model/v_categoryPro.model.php";
$vcp = new VCategoryPro();
$vpd = new VProduct();
$option = $_POST['option'];
switch ($option) {
    case 'search':
        //echo 'search';
        $conditionArray = array('status' => 'Y', 'name' => $_POST['name']);
        $targetArray = array("ID", "name", "realPrice", "label", "defaultImg", "selledNum", 'createTime', 'isDiscount', 'isPromotion', 'isPost');
        echo $vpd->muddyQueryJson($conditionArray, $targetArray);
        break;
    case 'parentCat':
        //echo 'parentCat';
        $childIDArray = $vcp->getChildIDArray($_POST['catID']);
        $result = array();
        foreach ($childIDArray as $item) {
            $conditionArray = array('status' => 'Y', 'category' => $item['ID']);
            $targetArray = array("ID", "name", "realPrice", "label", "defaultImg", "selledNum", 'createTime', 'isDiscount', 'isPromotion', 'isPost');
            $result = array_merge($result, $vpd->query($conditionArray, $targetArray));
        }
        echo json_encode($result);
        break;
    case 'childCat':
        //echo 'childCat';
        $conditionArray = array('status' => 'Y', 'category' => $_POST['catID']);
        $targetArray = array("ID", "name", "realPrice", "label", "defaultImg", "selledNum", 'createTime', 'isDiscount', 'isPromotion', 'isPost');
        echo $vpd->queryJson($conditionArray, $targetArray);
        break;
    case 'post':