【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:cla.products.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?php
/*--------------------------------------------------------------
[dzsw] includes/admin/cla.gbook.php
--------------------------------------------------------------*/
include DIR_dzsw.'includes/cla.products_p.php';
class products extends products_p{
var $type = '';
var $multilink = '';
var $image_savepath = '';
function products(){
global $db;
$this->db = $db;
}
function __get($name){
return $this->$name;
}
function __set($name, $value){
$this->$name = $value;
}
function set_type($type){
$this->type = $type;
}
function set_sql_select(){
if($this->type == 'specials'){
$sql_select = array(
'distinct' => '',
'p__products_id' => '',
'p__name' => 'pname',
'p__price' => '',
'p__s_p' => '',
'p__quantity' => '',
'p__status' => '',
'IF' => 'IF(p.s_p>0, sp.s_price, NULL) as s_price',
);
}elseif($this->type == 'search'){
$sql_select = array(
'distinct' => '',
'p__products_id' => '',
'p__name' => 'pname',
'p__price' => '',
'p__s_p' => '',
'p__quantity' => '',
'p__status' => '',
'IF' => 'IF(p.s_p>0, sp.s_price, NULL) as s_price',
);
}elseif($this->type == 'detail'){
$sql_select = array(
'p__products_id' => '',
'p__name' => 'pname',
'p__price' => '',
'p__s_p' => '',
'p__quantity' => '',
'p__image' => '',
'p__status' => '',
'p__description' => '',
'p__base_info' => '',
'p__manufacturer' => '',
'p__model' => '',
'p__weight' => '',
);
}
$this->sql_select($sql_select);
}
function set_sql_where($s_where = ''){
global $settings;
if($this->sql_where != ''){
return true;
}
$sql_where = $s_where ? $s_where : array();
if($this->type == 'specials'){
$sql_where['s_p'] = '1';
}
$this->sql_where($sql_where);
}
function set_sql_pam(){
$sql_pam = array(
'group_by' => 'p.products_id',
'order_by' => 'p.date_added, p.products_id',
'esc_desc' => 'DESC',
);
$this->sql_pam($sql_pam);
}
function set_sql_from(){
if($this->type == 'specials'){
$sql_from = array(
'ptoc' => 'false',
'so' => 'false',
'sp' => 'true',
);
}elseif($this->type == 'search'){
$sql_from = array(
'ptoc' => 'true',
'so' => 'true',
'sp' => 'true',
);
}else{
$
sql_from = array(
'ptoc' => 'false',
'so' => 'false',
'sp' => 'false',
);
}
$this->sql_from($sql_from);
}
function set_multilink(){
if($this->type == 'specials'){
$this->multilink = 'admin.php?act=products&type=specials';
}elseif($this->type == 'search'){
parse_str($_SERVER['QUERY_STRING'], $getlinks);
$stringlink = 'admin.php';
$pam = '?';
foreach($getlinks as $key => $value) {
if($key == 'page') {
continue;
}
$stringlink .= $pam.$key.'='.rawurlencode($value);
$pam = '&';
}
$this->multilink = $stringlink;
}else{
$this->multilink = 'admin.php?act=products';
}
}
function get_list($sql_where = ''){
global $settings, $page;
$num_of_row = (is_numeric($settings['productlist_numofrow']) && $settings['productlist_numofrow']>0) ? $settings['productlist_numofrow'] : 10;
$this->set_multilink();
$s_array = array(
'page' => $page,
'num' => $num_of_row,
'link' => $this->multilink,
);
$this->set_sql_select();
$this->set_sql_from();
$this->set_sql_where($sql_where);
$this->set_sql_pam();
$products_array = $this->products_list($s_array);
return $products_array;
}
function get_detail(){
$this->set_sql_select();
$this->set_sql_from();
$product_detail = $this->product_detail();
return $product_detail;
}
function get_image(){
$product_image = $this->product_image();
$product_image_array = array();
$key = $key_t = 0;
$img_num_a_row = 4;
foreach($product_image as $v){
$product_image_array[$key_t][imageid][] = $v['id'];
$product_image_array[$key_t][imagesrc][] = get_image_src($v,'small');
$product_image_array[$key_t][type][] = $v['type'];
$product_image_array[$key_t][name][] = $v['title'] ? $v['title'] : date('Y-m-d',$v['dateadd']);
$key_t= !(++$key % $img_num_a_row) ? ++$key_t : $key_t;
}
return $product_image_array;
}
function get_classes(){
$product_classes = $this->product_classes('_blank');
$product_classes_array = array();
foreach($product_classes as $key=>$val){
$product_classes_array[] = array(
'id' => $key,
'string' => $val,
);
}
return $product_classes_array;
}
fun