Ejemplo n.º 1
0
<?php

/**
 */
require "../libraries/common.inc.php";
require "wap.share.php";
require "../share.inc.php";
require CACHE_PATH . "cache_typeoption.php";
//require(LIB_PATH. 'page.class.php');
require APP_ROOT . './libraries/page.class.php';
//require(LIB_PATH."Tera-WURFL/TeraWurfl.php");
uses("company", "industry", "product", "area", "productcategory");
$page = new Pages();
$page->pagetpl_dir = $theme_name;
$product = new Products();
$productcategories = new Productcategories();
setvar("ProductcategoryOptions", $productcategories->getTypeOptions($_GET['category']));
$conditions = array();
//Default page load
$conditions[] = "ifnew=1";
if (isset($_GET['page']) && $_GET['page'] == 'new') {
    setvar("Page", 'new');
    $conditions = NULL;
    $conditions[] = "ifnew=1";
} elseif (isset($_GET['page']) && $_GET['page'] == 'recommend') {
    setvar("Page", 'recommend');
    $conditions = NULL;
    $conditions[] = "ifrecommend=1";
} elseif (isset($_GET['page']) && $_GET['page'] == 'promotion') {
    setvar("Page", 'promotion');
    $conditions = NULL;
Ejemplo n.º 2
0
/**
 * PHPB2B :  Opensource B2B Script (http://www.phpb2b.com/)
 * Copyright (C) 2007-2010, Ualink. All Rights Reserved.
 * 
 * Licensed under The Languages Packages Licenses.
 * Support : phpb2b@hotmail.com
 * 
 * @version $Revision$
 */
require "../libraries/common.inc.php";
uses("productcategory", "typeoption");
require LIB_PATH . 'page.class.php';
require LIB_PATH . 'cache.class.php';
require "session_cp.inc.php";
$productcategories = new Productcategories();
$cache = new Caches();
$page = new Pages();
$typeoption = new Typeoption();
$type_models = new Typeoptions();
$conditions = array();
$tpl_file = "productcategory";
setvar("AskAction", $typeoption->get_cache_type("common_option"));
if (isset($_POST['save']) && !empty($_POST['data'])) {
    if ($_POST['data']['method'] == 2) {
        $result = $type_models->copy("productcategories", $_POST['data']['truncate'], $_POST['data']['coverage']);
    } else {
        $vals = array();
        $vals = $_POST['data']['productcategory'];
        $vals['level'] = intval($pdb->GetOne("SELECT level AS new_level FROM {$tb_prefix}productcategories WHERE id='" . $vals['parent_id'] . "'") + 1);
        if (!empty($_POST['id'])) {
Ejemplo n.º 3
0
/**
 *      [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 $
 */
function smarty_function_category($params, &$smarty)
{
    $conditions[] = 'available=1';
    $result = array();
    if (class_exists("Productcategories")) {
        $cat = new Productcategories();
        $cat_controller = new Productcategory();
    } else {
        uses("productcategory");
        $cat = new Productcategories();
        $cat_controller = new Productcategory();
    }
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $cat->setCondition($conditions);
    $table_name = $cat->table_prefix . $cat_controller->pluralize($params['name']);
    $cat->dbstuff->setFetchMode(ADODB_FETCH_ASSOC);
    if (isset($params['depth'])) {
        //depth
        if ($params['depth'] == -1) {
            $result = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition());
            return $result;
        }
    }
    $level = intval($params['depth']);
    $return = array();
    switch ($level) {
        case 1:
            $conditions[] = "level IN (" . $level . ")";
            $cat->setCondition($conditions);
            $return = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition() . " ORDER BY display_order ASC");
            break;
        case 2:
            $conditions[] = "level IN (1,2)";
            $cat->setCondition($conditions);
            $result = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition() . " ORDER BY display_order ASC");
            foreach ($result as $val) {
                if ($val['level'] == 1) {
                    $result_1[$val['id']] = $val;
                } elseif ($val['level'] == 2) {
                    $result_2[] = $val;
                }
            }
            unset($result);
            foreach ($result_2 as $val2) {
                if ($val2['parent_id'] == $result_1[$val2['parent_id']]['id']) {
                    $result_1[$val2['parent_id']]['child'][] = $val2;
                }
            }
            $return = $result_1;
            unset($result, $result_1, $result_2);
            break;
        case 3:
            $conditions[] = "level IN (1,2,3)";
            $cat->setCondition($conditions);
            $result = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition() . " ORDER BY display_order ASC");
            foreach ($result as $val) {
                if ($val['level'] == 1) {
                    $return[$val['id']] = $val;
                } elseif ($val['level'] == 2) {
                    $return[$val['parent_id']]['child'][$val['id']] = $val;
                } elseif ($val['level'] == 3) {
                    $return[$val['top_parentid']]['child'][$val['parent_id']]['child'][] = $val;
                }
            }
            unset($result);
            break;
        default:
            break;
    }
    //$cat->setLimitOffset($offset, $limit);
    if (isset($params['output'])) {
        return $return;
    } else {
        if (empty($params['var'])) {
            $params['var'] = "category";
        }
        $smarty->assign($params['var'], $return);
        unset($return);
    }
}
Ejemplo n.º 4
0
<?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";
uses("productprice", "productcategory");
require LIB_PATH . 'page.class.php';
require LIB_PATH . 'cache.class.php';
require "session_cp.inc.php";
include CACHE_PATH . "cache_typeoption.php";
$productprices = new Productprices();
$productcategory = new Productcategories();
$cache = new Caches();
$page = new Pages();
$conditions = array();
$tpl_file = "price";
setvar("Measuries", $_PB_CACHE['measuring']);
setvar("Monetaries", $_PB_CACHE['monetary']);
setvar("PriceTypes", $_PB_CACHE['price_type']);
setvar("PriceTrends", $_PB_CACHE['price_trends']);
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    $action = trim($_GET['action']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "search") {