Exemple #1
0
    $conditions = NULL;
    $conditions[] = "iffree=1";
} elseif (isset($_GET['page']) && $_GET['page'] == 'all') {
    setvar("Page", 'all');
    $conditions = NULL;
}
if (isset($_GET['category'])) {
    if ($_GET['category'] != 0) {
        setvar("parent_id", $_GET['category']);
        $conditions[] = "Product.category_id=" . $_GET['category'];
    }
}
$conditions[] = "Product.status=1 ";
if (isset($_GET['p'])) {
    if ($_GET['p'] == 'pg-search' && trim($_GET['search']) != '') {
        $conditions[] = "Product.name like '%" . trim($_GET['search']) . "%'";
    }
}
$joins = null;
if ($device_id != '') {
    $joins[] = 'LEFT JOIN ' . $tb_prefix . 'productdevices d ON d.product_id=Product.id';
    //$conditions[] = "d.device_id='" . $device_id . "' ";
}
$amount = $product->findCount(null, $conditions, "Product.id");
$page->displaypg = 5;
$page->setPagenav($amount);
$result = $product->findAll("DISTINCT Product.cache_companyname AS companyname,Product.*", $joins, $conditions, "Product.ifcommend desc,Product.id desc", $page->firstcount, $page->displaypg);
$result = $product->formatResultWap($result);
setvar("Items", $result);
setvar("ByPages", $page->getPagenav());
template("index");
Exemple #2
0
        }
    }
    if (($do == "del" || $_GET['act'] == "del") && !empty($id)) {
        $res = $product->read("id", $id);
        if ($res) {
            if (!$product->del($_GET['id'], $conditions)) {
                flash();
            }
        } else {
            flash("data_not_exists");
        }
    }
}
if (isset($_GET['typeid']) && !empty($_GET['typeid'])) {
    $conditions[] = "producttype_id = " . $_GET['typeid'];
}
$amount = $product->findCount(null, $conditions, "Product.id");
$page->setPagenav($amount);
$result = $product->findAll("sort_id,id,name,picture,content,created,status,state", null, $conditions, "Product.id DESC", $page->firstcount, $page->displaypg);
if ($result) {
    $i_count = count($result);
    for ($i = 0; $i < $i_count; $i++) {
        $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '../', 'small');
    }
}
setvar("Items", $result);
setvar("nlink", $page->nextpage_link);
setvar("plink", $page->previouspage_link);
setvar("CheckStatus", explode(",", L('product_status', 'tpl')));
uaAssign(array("pagenav" => $page->getPagenav()));
template($tpl_file);
Exemple #3
0
        }
        if ($_GET['FromDate'] && $_GET['FromDate'] != "None" && $_GET['ToDate'] && $_GET['ToDate'] != "None") {
            $condition = "Product.created BETWEEN ";
            $condition .= Times::dateConvert($_GET['FromDate']);
            $condition .= " AND ";
            $condition .= Times::dateConvert($_GET['ToDate']);
            $conditions[] = $condition;
        }
    }
}
$amount = $product->findCount(null, $conditions, "Product.id", null);
unset($joins);
$joins[] = "LEFT JOIN {$tb_prefix}companies c ON c.id=Product.company_id";
$page->setPagenav($amount);
//print_r($amount);
//exit;
$fields = "Product.id,Product.company_id AS CompanyID,c.id AS CID,c.name AS companyname,Product.name AS ProductName,Product.status AS ProductStatus,Product.created,Product.ifcommend as Ifcommend, Product.state as ProductState,Product.picture as ProductPicture ";
$result = $product->findAll($fields, $joins, $conditions, "Product.id DESC", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['pubdate'] = date("Y-m-d", $result[$i]['created']);
        if (!empty($result[$i]['picture'])) {
            $result[$i]['image'] = pb_get_attachmenturl($result[$i]['ProductPicture'], "../", "small");
        }
    }
}
setvar("Items", $result);
setvar("ByPages", $page->pagenav);
//print_r($page->pagenav);
//exit;
template($tpl_file);
        </tr>
      </thead>
    
      <tbody id="alter_rows">
       <?php 
$count_record = Products::countProducts(1);
if (!isset($_REQUEST['page'])) {
    $page = 1;
} else {
    $page = $_GET[page];
}
$pagination = new Pagination();
//for display
$pg = $pagination->page_pagination(20, $count_record, $page, 20);
//$result_prod = mysql_query($query_Recordset2.$pg[1]);
$product = Products::findAll($pg[1], 1);
?>
		  	<? if($count_record == 0) { ?>
            	  <tr>
                  	<td colspan="6" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#F00; font-weight:bold">No Record Found</td>
                  </tr>
            <? } else { 
					foreach($product as $products) { 
						$image = $products->fldProductsImage;
			?>		
                <tr>
                  <td> <?php 
echo $products->fldProductsId;
?>
 </td>
                  <td>