示例#1
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_block_price($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "price";
    }
    if (class_exists("Productprice")) {
        $productprice = new Productprices();
        $productprice_controller = new Productprice();
    } else {
        uses("productprice");
        $productprice = new Productprices();
        $productprice_controller = new Productprice();
    }
    if (isset($params['productid'])) {
        $conditions[] = "p.product_id='" . intval($params['productid']) . "'";
    }
    if (isset($params['companyid'])) {
        $conditions[] = "p.company_id=" . $params['companyid'];
    }
    if (isset($params['memberid'])) {
        $conditions[] = "p.member_id=" . $params['memberid'];
    }
    if (isset($params['typeid'])) {
        $conditions[] = "p.type_id='" . $params['typeid'] . "'";
    }
    if (!empty($params['areaid'])) {
        $conditions[] = "p.area_id='" . $params['areaid'] . "'";
    }
    $orderby = null;
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . trim($params['orderby']) . " ";
    } else {
        $orderby = " ORDER BY id DESC ";
    }
    $productprice->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $productprice->setLimitOffset($offset, $limit);
    $sql = "SELECT id,title,description,description as content,price,units,currency,created FROM {$productprice->table_prefix}productprices  p " . $productprice->getCondition() . "{$orderby}" . $productprice->getLimitOffset();
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $productprice->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $url = $productprice->getPermaLink($item['id'], 'product/price.php');
        $item['url'] = $url;
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $item['pubdate'] = @date("m/d", $item['created']);
        $item['link'] = '<a title="' . $item['title'] . '" href="' . $url . '">' . $item['title'] . '</a>';
        $smarty->assign($params['name'], $item);
    } else {
        $repeat = false;
        reset($smarty->blockvars[$param_count]);
    }
    if (!is_null($content)) {
        print $content;
    }
    if (!$repeat) {
        $smarty->blockvars[$param_count] = array();
    }
}
示例#2
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") {
示例#3
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: 2098 $
 */
require "../libraries/common.inc.php";
require "room.share.php";
require LIB_PATH . 'page.class.php';
uses("productprice", "productcategory");
require LIB_PATH . 'time.class.php';
require CACHE_COMMON_PATH . "cache_typeoption.php";
$productprices = new Productprices();
$productcategory = new Productcategories();
$page = new Pages();
//check_permission("price");
$tpl_file = "price";
if (!$company->Validate($companyinfo)) {
    flash("pls_complete_company_info", "company.php", 0);
}
if (isset($_POST['do'])) {
    pb_submit_check('do');
    $company->newCheckStatus($companyinfo['status']);
    if (!empty($_POST['product']['name'])) {
        $vals = $_POST['price'];
        $vals['description'] = strip_tags(trim($vals['description']));
        $vals['member_id'] = $the_memberid;
        $vals['company_id'] = $company_id;
        if (!empty($_POST['product']['id'])) {
示例#4
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";
require "room.share.php";
require LIB_PATH . 'page.class.php';
uses("productprice", "productcategory");
require LIB_PATH . 'time.class.php';
require CACHE_PATH . "cache_typeoption.php";
$productprices = new Productprices();
$productcategory = new Productcategories();
$page = new Pages();
//check_permission("price");
$tpl_file = "price";
if (empty($companyinfo)) {
    flash("pls_complete_company_info", "company.php", 0);
}
if (isset($_POST['save'])) {
    $company->newCheckStatus($companyinfo['status']);
    if (!empty($_POST['price']['title'])) {
        $vals = $_POST['price'];
        $vals['description'] = strip_tags(trim($vals['description']));
        $vals['member_id'] = $_SESSION['MemberID'];
        $vals['company_id'] = $company_id;
        if (!empty($_POST['product_id'])) {
示例#5
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: 2048 $
 */
define('CURSCRIPT', 'price');
require "../libraries/common.inc.php";
require "../share.inc.php";
require CACHE_PATH . "cache_typeoption.php";
require CACHE_PATH . "cache_type.php";
require CACHE_PATH . "cache_area.php";
uses("productprice", "productcategory");
$price = new Productprices();
$productcategory = new Productcategories();
$conditions = array();
setvar("PriceTypes", $_PB_CACHE['price_type']);
setvar("Productcategory", $_PB_CACHE['productcategory']);
setvar("Measuries", $_PB_CACHE['measuring']);
setvar("Monetaries", $_PB_CACHE['monetary']);
setvar("Areas", am($_PB_CACHE['area'][1], $_PB_CACHE['area'][2], $_PB_CACHE['area'][3]));
$tpl_file = "product/price";
$viewhelper->setTitle(L("product_prices", "tpl"));
$viewhelper->setPosition(L("product_prices", "tpl"), "product/price.php");
if (isset($_GET['action'])) {
    $action = trim($_GET['action']);
    switch ($action) {
        case "search":
            if (isset($_GET['catid'])) {