Example #1
0
    if ($search) {
        $search .= ' and (`' . global_mapping::ProductName . '` like \'%' . global_common::escape_mysql_string($keyword) . '%\' or `' . global_mapping::Description . '` like \'%' . global_common::escape_mysql_string($keyword) . '%\')';
    } else {
        $search .= '(`' . global_mapping::ProductName . '` like \'%' . global_common::escape_mysql_string($keyword) . '%\' or `' . global_mapping::Description . '` like \'%' . global_common::escape_mysql_string($keyword) . '%\')';
    }
}
if ($manu) {
    if ($search) {
        $search .= ' and (`' . global_mapping::ManufactoryID . '` = ' . global_common::escape_mysql_string($manu) . ')';
    } else {
        $search .= '(`' . global_mapping::ManufactoryID . '` = ' . global_common::escape_mysql_string($manu) . ')';
    }
}
$products = $objProduct->getAllProduct(0, '*', $search, null);
$productIDs = global_common::getArrayColumn($products, global_mapping::ProductID);
$allManuFactories = $objManufactory->getAllManufactory(0);
//print_r($productIDs);
//if($expired)
//{
//	$condidtion = ' And '.global_mapping::EndDate.' < \''.global_common::nowDateSQL().'\'';
//}
//else
//{
//	$condidtion = ' And '.global_mapping::StartDate.' <= \''.global_common::nowDateSQL().'\''.' And '.global_mapping::EndDate.' >= \''.global_common::nowDateSQL().'\'';
//}
$inactive = $_pgR["inactive"];
$status = $inactive ? 0 : 1;
$type = $_pgR["type"];
$city = $_pgR['ct'];
$allRetailers = $objRetailer->getRetailerByProducts($page, $productIDs, $type, $city, $status, $total);
//print_r($allRetailers);
Example #2
0
        $arrHeader = global_common::getMessageHeaderArr($banCode);
        //$banCode
        echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, ($status ? 'Xóa' : 'Deactivate') . ' thành công'), array(0, 1));
        return;
    } else {
        echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, ($isActivate ? 'Xóa' : 'Deactivate') . ' unsuccessfully'), array(0, 1));
        return;
    }
}
$catID = $_pgR["cid"];
//$page = $_pgR["p"];
if ($catID) {
    $searchGroup = global_mapping::CategoryID . '= \'' . $catID . '\'';
}
//show all Manu, not paging
$allManus = $objManufactory->getAllManufactory(0, '', $searchGroup, '');
$_SESSION[global_common::SES_C_CUR_PAGE] = "admin/admin_manufactory.php";
include_once 'include/_admin_header.inc';
?>
<script type="text/javascript" src="<?php 
echo $_objSystem->locateJs('user_manufactory.js');
?>
"></script>
<div id="admin-manufactory" class="admin-page">
	<div class="row-fluid">
		<div class="span12">
			<!-- BEGIN PAGE TITLE & BREADCRUMB-->
			<h3 class="page-title">
				Manage Manufactory
			</h3>
		</div>
Example #3
0
include_once 'include/_permission.inc';
include_once 'include/_header.inc';
include_once 'class/model_articletype.php';
include_once 'class/model_user.php';
include_once 'class/model_product.php';
include_once 'class/model_manufactory.php';
$objArticleType = new Model_ArticleType($objConnection);
$objManufactory = new Model_Manufactory($objConnection);
$objProduct = new Model_Product($objConnection);
$intMode = 0;
//add mode
$parentTypes = $objArticleType->getAllArticleType(0, null, 'ParentID=0', 'Level');
$allTypes = $objArticleType->getAllArticleType(0, null, 'ParentID!=0', 'Level');
//set default selected section
$currentParentType = $parentTypes[0][global_mapping::ArticleTypeID];
$allManuFactories = $objManufactory->getAllManufactory(0, '*', '', global_mapping::ManufactoryName);
$cmArea = $_pgR["cmArea"];
$cmCategory = $_pgR["cmCategory"];
$cmManufactory = $_pgR["cmManufactory"];
$txtKeyword = $_pgR["txtKeyword"];
$lastPage = '';
$condition = '(' . global_mapping::IsDeleted . ' IS NULL or ' . global_mapping::IsDeleted . ' = \'0\') ';
if ($_pgR["pid"]) {
    $preferProduct = $objProduct->getProductByID($_pgR["pid"]);
    $preferedCat = $objArticleType->getArticleTypeByID($preferProduct[global_mapping::CatalogueID]);
    $cmArea = $preferedCat[global_mapping::ParentID];
    $cmCategory = $preferedCat[global_mapping::ArticleTypeID];
    $cmManufactory = $preferProduct[global_mapping::ManufactoryID];
    $txtKeyword = $preferProduct[global_mapping::ProductName];
}
if ($cmArea) {
Example #4
0
 public function getAllProduct($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '', &$total)
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy;
     }
     if ($intPage > 0) {
         $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Product::TBL_SL_PRODUCT, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
         $strSQLCount = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('count(*)', Model_Product::TBL_SL_PRODUCT, $whereClause . $orderBy));
     } else {
         $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Product::TBL_SL_PRODUCT, $whereClause . $orderBy));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_product:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //echo '<br>$strSQLCount:'.$strSQLCount;
     if ($strSQLCount) {
         $arrTotal = $this->_objConnection->selectCommand($strSQLCount);
         $total = $arrTotal[0][0];
     }
     $objManu = new Model_Manufactory($this->_objConnection);
     $objArticleType = new Model_ArticleType($this->_objConnection);
     $allManus = $objManu->getAllManufactory();
     $allCats = $objArticleType->getAllArticleType();
     $manus = array();
     foreach ($allManus as $key => $info) {
         $manus[$info[global_mapping::ManufactoryID]] = $info;
         unset($allManus[$key]);
     }
     $cats = array();
     foreach ($allCats as $key => $info) {
         $cats[$info[global_mapping::ArticleTypeID]] = $info;
         unset($allCats[$key]);
     }
     $count = count($arrResult);
     for ($index = 0; $index < $count; $index++) {
         if ($manus[$arrResult[$index][global_mapping::ManufactoryID]]) {
             $arrResult[$index][global_mapping::ManufactoryName] = $manus[$arrResult[$index][global_mapping::ManufactoryID]][global_mapping::ManufactoryName];
         }
         if ($cats[$arrResult[$index][global_mapping::CatalogueID]]) {
             $arrResult[$index][global_mapping::ArticleTypeName] = $cats[$arrResult[$index][global_mapping::CatalogueID]][global_mapping::ArticleTypeName];
         }
     }
     $arrResult = global_common::mergeUserInfo($arrResult, $this->_objConnection);
     //print_r($arrResult);
     return $arrResult;
 }