<?php /* TODO: Add code here */ require 'config/globalconfig.php'; include_once 'class/model_product.php'; include_once 'class/model_property.php'; include_once 'class/model_productproperty.php'; include_once 'class/model_propertygroup.php'; include_once 'class/model_productprice.php'; include_once 'class/model_articletype.php'; include_once 'class/model_retailer.php'; include_once 'class/model_status.php'; include_once 'class/model_city.php'; $objProduct = new Model_Product($objConnection); $objProperty = new Model_Property($objConnection); $objProductProperty = new Model_ProductProperty($objConnection); $objPropertyGroup = new Model_PropertyGroup($objConnection); $objProductPrice = new Model_ProductPrice($objConnection); $objArticleType = new Model_ArticleType($objConnection); $objRetailer = new Model_Retailer($objConnection); if ($_pgR["act"] == Model_Product::ACT_ADD || $_pgR["act"] == Model_Product::ACT_UPDATE) { if (global_common::isCLogin()) { //get user info $c_userInfo = $_SESSION[global_common::SES_C_USERINFO]; $properties = $_pgR['Properties']; //$properties = html_entity_decode($properties,ENT_COMPAT ,'UTF-8' ); $productName = $_pgR['ProductName']; $productName = html_entity_decode($productName, ENT_COMPAT, 'UTF-8'); $catalogueID = $_pgR['CatalogueID']; $catalogueID = html_entity_decode($catalogueID, ENT_COMPAT, 'UTF-8'); $imageLink = $_pgR['ImageLink'];
include_once 'class/model_property.php'; include_once 'class/model_productproperty.php'; include_once 'class/model_retailer.php'; include_once 'class/model_city.php'; include_once 'class/model_property.php'; include_once 'class/model_productprice.php'; include_once 'class/model_productproperty.php'; include_once 'class/model_propertygroup.php'; include_once 'class/model_datatype.php'; include_once 'class/model_manufactory.php'; $objStatus = new Model_Status($objConnection); $objProduct = new Model_Product($objConnection); $objProductProperty = new Model_ProductProperty($objConnection); $objArticleType = new Model_ArticleType($objConnection); $objProductPrice = new Model_ProductPrice($objConnection); $objProperty = new Model_Property($objConnection); $objComment = new Model_Comment($objConnection); $objManufactory = new Model_Manufactory($objConnection); $objRetailer = new Model_Retailer($objConnection); $objCity = new Model_City($objConnection); $_arrCategories = $objArticleType->getAllArticleType(0, null, '`ParentID`=0', 'Level'); if ($_pgR["rid"]) { $retailerID = $_pgR["rid"]; $retailer = $objRetailer->getRetailerByID($retailerID, '*', '`Status`=1'); $_currentProductID = $retailer[global_mapping::ProductID]; //product properties $productProperties = $objProperty->getPropertyByProduct($retailerID, global_common::STATUS_RETAILER_PROPERTY); //shipping properties $shippingProperty = $objProperty->getPropertyByProduct($retailerID, global_common::STATUS_RETAILER_SHIPPING); $_SESSION[global_common::SES_C_CUR_PAGE] = 'retailer_detail.php?rid=' . $retailerID; }
* This file was automatically generated By Code Smith * Modifications will be overwritten when code smith is run * * PLEASE DO NOT MAKE MODIFICATIONS TO THIS FILE * Date Created 5/6/2012 * */ /// <summary> /// Implementations of slpropertys represent a Property /// /// </summary> chdir(".."); /* TODO: Add code here */ require 'config/globalconfig.php'; include_once 'class/model_property.php'; $objProperty = new Model_Property($objConnection); if ($_pgR["act"] == model_Property::ACT_ADD) { if (global_common::isCLogin()) { //get user info //$c_userInfo = $_SESSION[consts::SES_C_USERINFO]; //if ($objMenu->getMenuByName($_pgR['name'])) { // echo global_common::convertToXML($arrHeader, array("rs",'info'), array(0,global_common::STRING_NAME_EXIST), array(0,1)); // return; //} $propertyID = $_pgR['PropertyID']; $propertyID = global_editor::rteSafe(html_entity_decode($propertyID, ENT_COMPAT, 'UTF-8')); $propertyName = $_pgR['PropertyName']; $propertyName = global_editor::rteSafe(html_entity_decode($propertyName, ENT_COMPAT, 'UTF-8')); $productID = $_pgR['ProductID']; $productID = global_editor::rteSafe(html_entity_decode($productID, ENT_COMPAT, 'UTF-8')); $propertyValue = $_pgR['PropertyValue'];
public function getTopPropertyValue($catID, $sizeProperty, $sizeValue) { $whereClause = 'WHERE ' . global_mapping::ArticleTypeID . ' = \'' . $catID . '\' '; $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('*', Model_PropertyGroup::TBL_SL_PROPERTY_GROUP, $whereClause)); $propertyGroups = $this->_objConnection->selectCommand($strSQL); //print_r($propertyGroups); $arrPropertyGroupIDs = global_common::getArrayColumn($propertyGroups, global_mapping::PropertyGroupID); $strQueryIN = global_mapping::PropertyGroupID . ' IN(' . global_common::convertToQueryIN($arrPropertyGroupIDs) . ')'; //echo $strQueryIN; $objProperty = new Model_Property($this->_objConnection); $allProperties = $objProperty->getAllProperty(0, '*', $strQueryIN, '`Order`'); $arrPropertyIDs = global_common::getArrayColumn($allProperties, global_mapping::PropertyID); //print_r($allProperties); $strQueryIN = global_mapping::PropertyID . ' IN(' . global_common::convertToQueryIN($arrPropertyIDs) . ')'; $temp = array(); foreach ($allProperties as $key => $info) { $temp[$info[global_mapping::PropertyID]] = $info; unset($allProperties[$key]); } $allProperties = $temp; //print_r($allProperties); //get top properties used $strQueryIN = global_mapping::PropertyID . ' IN(' . global_common::convertToQueryIN($arrPropertyIDs) . ')'; $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array(PropertyID, self::TBL_SL_PRODUCT_PROPERTY, 'WHERE ' . $strQueryIN . ' GROUP BY PropertyID ORDER BY COUNT(*) DESC LIMIT 0,' . $sizeProperty . '')); //echo '<br>SQL:'.$strSQL; $arrTopPropertyIDs = $this->_objConnection->selectCommand($strSQL); if (!$arrTopPropertyIDs || count($arrTopPropertyIDs) <= 0) { return; } //print_r($arrTopPropertyIDs); $arrTopPropertyIDs = global_common::getArrayColumn($arrTopPropertyIDs, global_mapping::PropertyID); $strQueryIN = 'WHERE ' . global_mapping::PropertyID . ' IN(' . global_common::convertToQueryIN($arrTopPropertyIDs) . ')'; $strQueryIN .= ' Group By ' . global_mapping::PropertyID . ',' . global_mapping::PropertyValue; $strQueryIN .= ' Order By ' . global_mapping::PropertyID . ',COUNT(' . global_mapping::PropertyValue . ') DESC'; $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('distinct ' . global_mapping::PropertyID . ',' . global_mapping::PropertyValue, self::TBL_SL_PRODUCT_PROPERTY, $strQueryIN)); //echo '<br>SQL:'.$strSQL; $arrTopProperties = $this->_objConnection->selectCommand($strSQL); //print_r($arrTopProperties); $arrResult = array(); foreach ($arrTopPropertyIDs as $item) { //echo $item; $arrResult[$item] = $allProperties[$item]; $arrValue = array(); $limit = $sizeValue; //print_r($arrTopProperties); //echo ' PropID:'.$item; foreach ($arrTopProperties as $value) { if ($value[global_mapping::PropertyID] == $item && $limit > 0) { //echo $value[global_mapping::PropertyValue]; //echo $value[global_mapping::PropertyValue]; $arrValue = array_merge($arrValue, array($value[global_mapping::PropertyValue])); $limit--; } } //print_r($arrValue); $arrResult[$item][global_mapping::PropertyValue] = $arrValue; } //print_r($arrResult); return $arrResult; }
/// <summary> /// Implementations of Property represent a Property /// /// </summary> chdir(".."); /* TODO: Add code here */ require 'config/globalconfig.php'; require 'include/_permission_admin.inc'; include_once 'class/model_user.php'; include_once 'class/model_property.php'; include_once 'class/model_propertygroup.php'; include_once 'class/model_adtype.php'; include_once 'class/model_articletype.php'; include_once 'class/model_datatype.php'; $objArticleType = new Model_ArticleType($objConnection); $objProperty = new Model_Property($objConnection); $objAdType = new Model_AdType($objConnection); $objDataType = new Model_Datatype($objConnection); $objGroup = new Model_PropertyGroup($objConnection); $allCats = $objArticleType->getAllArticleType(0, null, '', null); if ($_pgR["act"] == Model_Property::ACT_ADD || $_pgR["act"] == Model_Property::ACT_UPDATE) { //get user info $c_userInfo = $_SESSION[global_common::SES_C_USERINFO]; $propertyName = $_pgR[global_mapping::PropertyName]; $propertyName = html_entity_decode($propertyName, ENT_COMPAT, 'UTF-8'); $dataTypeID = html_entity_decode($_pgR[global_mapping::DataTypeID], ENT_COMPAT, 'UTF-8'); $propertyGroupID = html_entity_decode($_pgR[global_mapping::PropertyGroupID], ENT_COMPAT, 'UTF-8'); $propertyValue = html_entity_decode($_pgR[global_mapping::PropertyValue], ENT_COMPAT, 'UTF-8'); $order = html_entity_decode($_pgR[global_mapping::Order], ENT_COMPAT, 'UTF-8'); $status = 1; if ($_pgR["act"] == Model_Property::ACT_ADD) {
* Date Created 5/6/2012 * */ /// <summary> /// Implementations of slarticles represent a Article /// /// </summary> chdir(".."); /* TODO: Add code here */ require 'config/globalconfig.php'; require 'include/_permission_admin.inc'; include_once 'class/model_property.php'; include_once 'class/model_propertygroup.php'; include_once 'class/model_articletype.php'; include_once 'class/model_datatype.php'; $objProperty = new Model_Property($objConnection); $objPropertyGroup = new Model_PropertyGroup($objConnection); print_r($_FILES["f"]); if ($_FILES["f"] && strtolower(end(explode('.', $_FILES['f']['name']))) == 'csv') { $filePath = $_FILES['f']['tmp_name']; if (($handle = fopen($filePath, 'r')) !== FALSE) { // necessary if a large csv file set_time_limit(0); $c_userInfo = $_SESSION[global_common::SES_C_USERINFO]; $createdBy = $c_userInfo[global_mapping::UserID]; $row = 0; $stack = array(); //ignore header $line_of_text = fgetcsv($handle); while (!feof($handle)) { $line_of_text = fgetcsv($handle);
public function getPropertyInfoByID($objID) { $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('*', Model_ProductProperty::TBL_SL_PRODUCT_PROPERTY, 'WHERE ProductID = \'' . $objID . '\' Order by `' . global_mapping::Order . '`')); //echo $strSQL; $arrResult = $this->_objConnection->selectCommand($strSQL); if (!$arrResult) { global_common::writeLog('get sl_product ByID:' . $strSQL, 1, $_mainFrame->pPage); return null; } else { //print_r($arrResult); $propertyIDs = global_common::getArrayColumn($arrResult, global_mapping::PropertyID); $propertyIDs = array_unique($propertyIDs); //print_r($propertyIDs); $objProperty = new Model_Property($this->_objConnection); $objPropertyGroup = new Model_PropertyGroup($this->_objConnection); $properties = $objProperty->getPropertyByIDs($propertyIDs); $temp = array(); foreach ($propertyIDs as $item) { foreach ($properties as $subitem) { if ($item == $subitem[global_mapping::PropertyID]) { //echo $item.':'; $temp = array_merge($temp, array($subitem)); } } } $properties = $temp; //print_r($properties); $propertyGroupIDs = global_common::getArrayColumn($properties, global_mapping::PropertyGroupID); $propertyGroupIDs = array_unique($propertyGroupIDs); //print_r($propertyGroupIDs); $propertyGroups = $objPropertyGroup->getPropertyGroupByIDs($propertyGroupIDs); $temp = array(); foreach ($arrResult as $key => $info) { $temp[$info[global_mapping::PropertyID]] = $info; unset($arrResult[$key]); } $arrResult = $temp; $temp = array(); foreach ($propertyGroupIDs as $item) { foreach ($propertyGroups as $subitem) { if ($item == $subitem[global_mapping::PropertyGroupID]) { //echo $item.':'; $temp = array_merge($temp, array($subitem)); } } } $propertyGroups = $temp; //print_r($arrResult); //print_r($propertyGroups); $count = count($propertyGroups); for ($i = 0; $i < $count; $i++) { foreach ($properties as $item) { if ($item[global_mapping::PropertyGroupID] == $propertyGroups[$i][global_mapping::PropertyGroupID]) { //change defaut value to product property value $item[global_mapping::PropertyValue] = $arrResult[$item[global_mapping::PropertyID]][global_mapping::PropertyValue]; $item[global_mapping::Status] = $arrResult[$item[global_mapping::PropertyID]][global_mapping::Status]; $item[global_mapping::TypeID] = $arrResult[$item[global_mapping::PropertyID]][global_mapping::TypeID]; $item[global_mapping::StatusID] = $arrResult[$item[global_mapping::PropertyID]][global_mapping::StatusID]; $item[global_mapping::Order] = $arrResult[$item[global_mapping::PropertyID]][global_mapping::Order]; $propertyGroups[$i]['Properties'] = $propertyGroups[$i]['Properties'] ? $propertyGroups[$i]['Properties'] : array(); $propertyGroups[$i]['Properties'] = array_merge($propertyGroups[$i]['Properties'], array($item)); } } } } //print_r($propertyGroups); return $propertyGroups; }
include_once 'include/_permission.inc'; include_once 'include/_header.inc'; include_once 'class/model_articletype.php'; include_once 'class/model_article.php'; include_once 'class/model_comment.php'; include_once 'class/model_user.php'; include_once 'class/model_propertygroup.php'; include_once 'class/model_property.php'; include_once 'class/model_product.php'; include_once 'class/model_manufactory.php'; include_once 'class/model_productproperty.php'; include_once 'class/model_datatype.php'; $objArticle = new Model_Article($objConnection); $objArticleType = new Model_ArticleType($objConnection); $objPropertyGroup = new Model_PropertyGroup($objConnection); $objProperty = new Model_Property($objConnection); $objProduct = new Model_Product($objConnection); $objProductProperty = new Model_ProductProperty($objConnection); $objManufactory = new Model_Manufactory($objConnection); //$propertyInfo = $objProduct->getPropertyInfoByID(30); //print_r($propertyInfo); $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]; $allGroups = $objPropertyGroup->getAllPropertyGroup(0, '*', '', ''); $allManuFactories = $objManufactory->getAllManufactory(0, '*', '', global_mapping::ManufactoryName); //print_r($allGroups); $allGroupIDs = global_common::getArrayColumn($allGroups, global_mapping::PropertyGroupID);