public function cart_list($sessionID)
 {
     $list = $this->where("session_id='" . $sessionID . "'")->select();
     if (empty($list)) {
         return array();
     }
     $data = array();
     $dao = D("Products");
     foreach ($list as $k => $val) {
         $product_info = $dao->getpriceInfo($val['pid'], $val['count'], $val['model']);
         if (!empty($val['model'])) {
             $attr_tmp = unserialize($val['model']);
             foreach ($attr_tmp as $vo) {
                 $row['attr'] .= "{$vo['name']}: {$vo['value']}   ";
             }
         }
         $row['id'] = $product_info['id'];
         $row['cateid'] = $product_info['cateid'];
         $row['name'] = $product_info['name'];
         $row['url'] = build_url($product_info, 'pro_url');
         $row['price'] = $product_info['price'];
         $row['pricespe'] = getprice($product_info['price'], $product_info['pricespe'], false);
         $row['bigimage'] = build_url($product_info, 'pro_bigimage');
         $row['smallimage'] = build_url($product_info, 'pro_smallimage');
         $row['count'] = $product_info['count'];
         $row['price_total'] = $product_info['price_total'];
         $row['pricespe_total'] = $product_info['pricespe_total'];
         $row['total'] = $product_info['total'];
         $row['costprice'] = $product_info['costprice'];
         $row['provider'] = $product_info['provider'];
         $data[] = $row;
     }
     return $data;
 }
Exemple #2
0
function build_url($vo, $type)
{
    switch ($type) {
        case 'pro_url':
            $url = U(tourlstr($vo['name']) . '@', array('pid' => $vo['id']));
            if (strcasecmp(GROUP_NAME, 'Member') == 0 || strcasecmp(GROUP_NAME, 'Admin') == 0) {
                $url = str_replace(GROUP_NAME . '-', '', $url);
            }
            return $url;
        case 'pid':
            $url = U(tourlstr($vo['name']) . '@', array('pid' => $vo['pid']));
            if (strcasecmp(GROUP_NAME, 'Member') == 0 || strcasecmp(GROUP_NAME, 'Admin') == 0) {
                $url = str_replace(GROUP_NAME . '-', '', $url);
            }
            return $url;
        case 'products_id':
            $url = U(tourlstr($vo['products_name']) . '@', array('pid' => $vo['products_id']));
            if (strcasecmp(GROUP_NAME, 'Member') == 0 || strcasecmp(GROUP_NAME, 'Admin') == 0) {
                $url = str_replace(GROUP_NAME . '-', '', $url);
            }
            return $url;
        case 'pro_name':
            return $vo['name'];
        case 'pro_smallimage':
            return __ROOT__ . '/' . $vo['smallimage'];
        case 'pro_bigimage':
            return __ROOT__ . '/' . $vo['bigimage'];
        case 'altimg':
            if (GetSettValue('isBigimg') == 0) {
                return '';
            }
            return __ROOT__ . '/' . $vo['bigimage'];
        case 'pro_price':
            return getprice($vo['price'], $vo['pricespe']);
            //特价表示
            //return $vo['price'];
        //特价表示
        //return $vo['price'];
        case 'pro_pricespe':
            return $vo['pricespe'];
        case 'cate_url':
            return U(tourlstr($vo['name']) . '@', array('cid' => $vo['id']));
        case 'cate_name':
            return $vo['name'];
        case 'ad_name':
            return $vo['name'];
        case 'ad_remark':
            return $vo['remark'];
        case 'ad_link':
            return $vo['link'];
        case 'ad_img':
            return __ROOT__ . '/' . $vo['img_url'];
        case 'article_url':
            return U('Article/index', array('id' => $vo['id']));
        case 'article_title':
            return $vo['title'];
        case 'article_dateline':
            return date('Y-m-d H:i:s', $vo['dateline']);
        case 'cate_img':
            return __ROOT__ . '/' . $vo['imgurl'];
        case 'g_bigimage':
            return __ROOT__ . '/' . $vo['img_url'];
        case 'g_smallimage':
            return __ROOT__ . '/' . $vo['thumb_url'];
        case 'hotmail':
            //msn
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "msnim:chat?contact=" . $v;
            }
            return $r;
        case 'yahoo':
            //yahoo
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "ymsgr:sendIM?" . $v;
            }
            return $r;
        case 'email':
            //email
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "mailto:" . $v;
            }
            return $r;
        case 'skype':
            //skype
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "callto://" . $v;
            }
            return $r;
        case 'qq':
            //qq
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "tencent://Message/?Menu=YES&Uin=" . $v . "&websiteName=im.qq.com";
            }
            return $r;
        case 'gtalk':
            //gtalk
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "gtalk:chat?jid=" . $v . "&from_jid=";
            }
            return $r;
        case 'tel':
            //tel
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = $v;
            }
            return $r;
    }
}
		</div>
              </div>
              </div>
             <div class="right_goods">
                
                <div class="goods_name"><strong><?php 
echo build_url($list, 'pro_name');
?>
</strong></div>
                <div class="goods_stock"><strong style=" color:#000000;">Product ID:</strong> &nbsp;&nbsp;<?php 
echo $list["serial"];
?>
</div>
                <div class="goods_pri"><strong>Price:</strong>  <font color="#FF6600" style="font-size:18px;">
     <span id="product_price"><?php 
echo getprice($list['price'], $list['pricespe'], false);
?>
 </span></font><span id="attr_price"></span></div>
                <div class="goods_stock"><strong style=" color:#000000;">Availability:</strong> &nbsp;&nbsp;<?php 
if ($list['isdown'] == "0") {
    ?>
In Stock  <?php 
} else {
    ?>
Out Of Stock<?php 
}
?>
</div>
			    <div class="goods_size">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
Exemple #4
0
function current_area_new($city_id = '0', $group_id = '0', $pid = '0', $sid = '0', $oid = '0', $direction = '0',$area_id,$sub_area_id) {
	global $city;
	$daytime = strtotime(date('Y-m-d'));
	$condition = array('team_type' => 'normal', "begin_time <= '{$daytime}'", "end_time > '{$daytime}'", );
	if ($sid)
		$condition['sub_id'] = $sid;
	if ($pid)
		$condition[] = getprice($pid);
	if ($group_id)
		$condition['group_id'] = $group_id;
	$team_all = Table::Count('team', $condition);
	//	$a = array(
	//			"/team/indexTeam.php?group_id={$group_id}&pid={$pid}" => "所有({$team_all})",
	//			);
	if ($city_id == '0') { $a = " <a href=\"/team/indexTeam.php?group_id={$group_id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}&area_id={$area_id}&suba_id={$sub_area_id}\" class=\"r_xz\">所有<span>({$team_all})</span></a> ";
	} else { $a = " <a href=\"/team/indexTeam.php?group_id={$group_id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}&area_id={$area_id}&suba_id={$sub_area_id}\">所有<span>({$team_all})</span></a> ";
	}

	$categorys = DB::LimitQuery('category', array('condition' => array('zone' => 'city', 'fid' => '0', 'display' => 'Y'), 'order' => 'ORDER BY sort_order DESC, id DESC', ));
	$categorys = Utility::OptionArray($categorys, 'id', 'name');
	foreach ($categorys AS $id => $name) {
		if ($id)
			$condition[100] = "((city_ids like '%@{$id}@%' or city_ids like '%@0@%') or city_id in(0,{$id}))";
		//		$con_area = array('team_type' => 'normal', "begin_time <= '{$daytime}'", "end_time > '{$daytime}'", );
		//		$con_area = "((city_ids like '%@{$id}@%' or city_ids like '%@0@%') or city_id in(0,{$id})) AND team_type = 'normal' AND begin_time <= $daytime AND end_time > $daytime ";
		//		$result = DB::GetQueryResult('select count(*) as num from team where '.$con_area, true);
		//		$team_num = $result['num'];
		$team_num = Table::Count('team', $condition);
		//		$a["/team/indexTeam.php?group_id={$group_id}&city_id={$id}&pid={$pid}"] = $name . "({$team_num})";
		if ($id == $city_id) { $a .= " <a href=\"/team/indexTeam.php?group_id={$group_id}&city_id={$id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}&area_id={$area_id}&suba_id={$sub_area_id}\" class=\"r_xz\">$name<span>({$team_num})</span></a> ";
		} else { $a .= " <a href=\"/team/indexTeam.php?group_id={$group_id}&city_id={$id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}&area_id={$area_id}&suba_id={$sub_area_id}\">$name<span>({$team_num})</span></a> ";
		}
	}
	//	$l = "/team/indexTeam.php?group_id={$group_id}&city_id={$city_id}&pid={$pid}";
	//	if (!$city_id) $l = "/team/indexTeam.php?group_id={$group_id}&pid={$pid}";
	//	return current_link_new($l, $a);
	return $a;
}
            echo build_url($vo, 'pro_url');
            ?>
" target="_blank"><?php 
            echo $vo['id'];
            ?>
</a></td>
    <td bgcolor="#F5f5f5" height="30" align="center"><a href="<?php 
            echo build_url($vo, 'pro_url');
            ?>
" target="_blank"><img src="<?php 
            echo build_url($vo, 'pro_smallimage');
            ?>
" width="100" height="100" border="0" /></a></td>

    <td bgcolor="#F5f5f5" height="30" align="center"><font color="#FF0000"><?php 
            echo getprice($vo["price"], $vo["pricespe"], false);
            ?>
</font></td>
    <td bgcolor="#F5f5f5" height="30" align="center"><a href="<?php 
            echo build_url($vo, 'pro_url');
            ?>
">Add to Cart</a><br/><a href="<?php 
            echo U('Member-Index/Delprofav', array('id' => $vo['id']));
            ?>
">Delete</a></td>
  </tr><?php 
        }
    }
} else {
    echo "";
}
Exemple #6
0
function build_url($vo, $type)
{
    switch ($type) {
        case 'pro_url':
            $url = U('Products/detail', array('pid' => $vo['id']));
            return $url;
        case 'pid':
            $url = U('Products/detail', array('pid' => $vo['id']));
            return $url;
        case 'products_id':
            $url = U('Products/detail', array('pid' => $vo['products_id']));
            return $url;
        case 'pro_name':
            return $vo['name'];
        case 'pro_smallimage':
            $vo['smallimage'] = ltrim($vo['smallimage'], './');
            return IMG_DOMAIN . '/' . $vo['smallimage'];
        case 'pro_bigimage':
            $vo['bigimage'] = ltrim($vo['bigimage'], './');
            return IMG_DOMAIN . '/' . $vo['bigimage'];
        case 'altimg':
            if (GetValue('isBigimg') == 0) {
                return '';
            }
            $vo['bigimage'] = ltrim($vo['bigimage'], './');
            return IMG_DOMAIN . '/' . $vo['bigimage'];
        case 'pro_price':
            return getprice($vo['price'], $vo['pricespe']);
            //特价表示
            //return $vo['price'];
        //特价表示
        //return $vo['price'];
        case 'pro_pricespe':
            return $vo['pricespe'];
        case 'cate_url':
            return $url = U('Cate/index', array('cid' => $vo['id']));
        case 'cate_list_url':
            return $url = U('Cate/lists', array('cid' => $vo['id']));
        case 'cate_name':
            return $vo['name'];
        case 'ad_name':
            return $vo['name'];
        case 'ad_remark':
            return $vo['remark'];
        case 'ad_link':
            return $vo['link'];
        case 'ad_img':
            $vo['imgurl'] = ltrim($vo['imgurl'], './');
            return IMG_DOMAIN . '/' . $vo['img_url'];
        case 'article_url':
            return U('Article/index', array('id' => $vo['id']));
        case 'article_title':
            return $vo['title'];
        case 'article_dateline':
            return date('Y-m-d H:i:s', $vo['dateline']);
        case 'cate_img':
            $vo['imgurl'] = ltrim($vo['imgurl'], './');
            return IMG_DOMAIN . '/' . $vo['imgurl'];
        case 'g_bigimage':
            $vo['img_url'] = ltrim($vo['img_url'], './');
            return IMG_DOMAIN . '/' . $vo['img_url'];
        case 'g_smallimage':
            $vo['thumb_url'] = ltrim($vo['thumb_url'], './');
            return IMG_DOMAIN . '/' . $vo['thumb_url'];
        case 'hotmail':
            //msn
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "msnim:chat?contact=" . $v;
            }
            return $r;
        case 'yahoo':
            //yahoo
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "ymsgr:sendIM?" . $v;
            }
            return $r;
        case 'email':
            //email
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "mailto:" . $v;
            }
            return $r;
        case 'skype':
            //skype
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "callto://" . $v;
            }
            return $r;
        case 'qq':
            //qq
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "tencent://Message/?Menu=YES&Uin=" . $v . "&websiteName=im.qq.com";
            }
            return $r;
        case 'gtalk':
            //gtalk
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = "gtalk:chat?jid=" . $v . "&from_jid=";
            }
            return $r;
        case 'tel':
            //tel
            $r = array();
            foreach (explode(',', $vo) as $k => $v) {
                $r[$v] = $v;
            }
            return $r;
    }
}
Exemple #7
0
function current_area_new($city_id='0', $group_id='0', $pid='0', $sid='0', $oid='0', $direction='0') {
	global $city;
	$daytime = strtotime(date('Y-m-d'));
	$condition = array(
		'team_type' => 'normal',
		"begin_time <= '{$daytime}'",
		"end_time > '{$daytime}'",
	);
	if($sid) $condition['sub_id'] = $sid;
	if($pid) $condition[] = getprice($pid);
	if ($group_id) $condition['group_id'] = $group_id;
	$team_all = Table::Count('team', $condition);
//	$a = array(
//			"/team/indexTeam.php?group_id={$group_id}&pid={$pid}" => "所有({$team_all})",
//			);
	if($city_id=='0') { $a =  " <a href=\"/team/indexTeam.php?group_id={$group_id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}\" class=\"r_xz\">所有({$team_all})</a> "; }
	else { $a =  " <a href=\"/team/indexTeam.php?group_id={$group_id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}\">所有({$team_all})</a> "; }

    $categorys = DB::LimitQuery('category', array(
		'condition' => array( 'zone' => 'city','fid' => '0','display' => 'Y' ),
		'order' => 'ORDER BY sort_order DESC, id DESC',
	));
	$categorys = Utility::OptionArray($categorys, 'id', 'name');
	foreach($categorys AS $id=>$name) {
		if($id) $condition[100] = "((city_ids like '%@{$id}@%' or city_ids like '%@0@%') or city_id in(0,{$id}))";

		$team_num = Table::Count('team', $condition);
		if($id==$city_id) { $a .=  " <a href=\"/team/indexTeam.php?group_id={$group_id}&city_id={$id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}\" class=\"r_xz\">$name({$team_num})</a> "; }
		else { $a .=  " <a href=\"/team/indexTeam.php?group_id={$group_id}&city_id={$id}&pid={$pid}&sid={$sid}&oid={$oid}&did={$direction}\">$name({$team_num})</a> "; }
	}
	return $a;
}
                ?>
		<?php 
                if (!empty($vo['serial'])) {
                    ?>
Serail:<?php 
                    echo $vo["serial"];
                }
                ?>

       </td>
       <td align="center"><font color="#CC9900"><strong><?php 
                echo getprice($vo['price'], $vo['pricespe'], false);
                ?>
</strong></font></td>
       <td align="center"><font color="#339900"><strong><?php 
                echo getprice($vo['price_total'], $vo['pricespe_total'], false);
                ?>
</strong></font></td>

       <td>
<a href="<?php 
                echo U('Cart/delete', array('id' => $vo['id']));
                ?>
"><img src="../Public/images/small_delete.gif"  border="0"/></a></td>
     </tr><?php 
            }
        }
    } else {
        echo "";
    }
    ?>