$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");
<?php /** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2075 $ */ require "../libraries/common.inc.php"; require "room.share.php"; uses("trade", "product"); check_permission("offer"); $product = new Products(); $trade = new Trades(); $trade_controller = new Trade(); $trade_type_names = $trade_controller->getTradeTypes(); $conditions = "member_id = " . $the_memberid; $amount = $pdb->GetArray("select Trade.type_id as TradeTypeId,count(Trade.id) as CountTrade from " . $trade->getTable(true) . " where " . $conditions . " group by Trade.type_id"); if (is_array($amount)) { $stats = array(); foreach ($amount as $val) { $stats[$val['TradeTypeId']] = array("Amount" => $val['CountTrade'], "name" => $trade_type_names[$val['TradeTypeId']]); } } setvar("UserTradeStat", $stats); setvar("ProductAmount", $product->findCount(null, $conditions, "Product.id")); template("stat");
$producttype = new Producttypes(); $attachment = new Attachment('pic'); $conditions[] = "member_id = " . $the_memberid; setvar("Countries", $countries = cache_read("country")); setvar("ProductSorts", $_PB_CACHE['productsort']); setvar("ProductTypes", $producttype->findAll('id,name', null, $conditions, "id DESC")); setvar("Productcategories", $productcategory->getTypeOptions()); $tpl_file = "product"; if (!$company->Validate($companyinfo)) { flash("pls_complete_company_info", "company.php", 0); } if (isset($_POST['save'])) { $company->newCheckStatus($companyinfo['status']); if (!empty($_POST['data']['product'])) { $product->setParams(); $now_product_amount = $product->findCount(null, "created>" . $today_start . " AND member_id=" . $the_memberid); $check_product_update = $g['product_check']; if ($check_product_update == 0) { $product->params['data']['product']['status'] = 1; } else { $product->params['data']['product']['status'] = 0; $message_info = 'msg_wait_check'; } if (isset($_POST['id'])) { $id = intval($_POST['id']); } if (!empty($_FILES['pic']['name'])) { $attach_id = empty($id) ? "product-" . $the_memberid . "-" . ($product->getMaxId() + 1) : "product-" . $the_memberid . "-" . $id; $attachment->rename_file = $attach_id; $attachment->upload_process(); $product->params['data']['product']['picture'] = $attachment->file_full_url;
if ($_GET['industryid']) { $conditions[] = "Product.industry_id =" . $_GET['industryid']; } if ($_GET['provinceid']) { $conditions[] = "c.province_code_id =" . $_GET['provinceid']; } 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($joins, $conditions, "Product.id"); unset($joins); $joins[] = "LEFT JOIN {$tb_prefix}companies c ON c.id=Product.company_id"; $page->setPagenav($amount); $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.if_commend 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'] = df($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);
$product = new Products(); $producttype = new Producttypes(); $attachment = new Attachment('pic'); $conditions[] = "member_id = " . $_SESSION['MemberID']; setvar("ProductSorts", $_PB_CACHE['productsort']); setvar("ProductTypes", $producttype->findAll('id,name', null, $conditions, "id DESC")); setvar("Productcategories", $productcategory->getTypeOptions()); $tpl_file = "product"; if (empty($companyinfo)) { flash("pls_complete_company_info", "company.php", 0); } if (isset($_POST['save'])) { $company->newCheckStatus($companyinfo['status']); if (!empty($_POST['data']['product'])) { $product->setParams(); $now_product_amount = $product->findCount(null, "created>" . $today_start . " AND member_id=" . $_SESSION['MemberID']); $check_product_update = $g['product_check']; if ($check_product_update == 0) { $product->params['data']['product']['status'] = 1; } else { $product->params['data']['product']['status'] = 0; $message_info = 'msg_wait_check'; } if (isset($_POST['id'])) { $id = intval($_POST['id']); } if (!empty($_FILES['pic']['name'])) { $attach_id = empty($id) ? "product-" . $_SESSION['MemberID'] . "-" . ($product->getMaxId() + 1) : "product-" . $_SESSION['MemberID'] . "-" . $id; $attachment->rename_file = $attach_id; $attachment->upload_process(); $product->params['data']['product']['picture'] = $attachment->file_full_url;