require_once '../init.php';
session_start();
require_once 'dbconnect_utf.php';
require_once './api/getimgbaseurl.php';
require_once '../engine/Normalproduct.class.php';
$img_base_url=getImgBaseUrl();//2014-8-27 reed add 引入图片空间路径
$platform=$_SERVER['HTTP_PLATFORM'];
$version=$_SERVER['HTTP_VERSION'];
if($platform&&$version){
$_SESSION['platform']=$platform;
$_SESSION['version']=$version;
}else{
$platform=$_SESSION['platform'];
$version=$_SESSION['version'];
}
$version_arr=explode(".",$version);
?>
产品列表 - 淘不出手产品列表
$id = $_GET['id']?$_GET['id']:0;
$jid = $_GET['jid']?$_GET['jid']:0;
$p= $_GET['p']?$_GET['p']:1;
$items=6;
//聚合商品id
if($jid){
$sql = sprintf("select goods_id from mall_juheproductdetail where pid in (%s) order by listorder asc",$jid);
$q=mysql_query($sql);
$jid_goods_id='';
while($row = mysql_fetch_array($q)){
$jid_goods_id.=$row['goods_id'].',';
}
$jid_goods_id=$jid_goods_id?substr($jid_goods_id,0,-1):'';
}
// $sql_num="select * from blog_article where aid in (".$id.")";
// $q_num=mysql_query($sql_num);
// $num = mysql_numrows($q_num);
//
//
//
//
// if($num<=4){
// $rand = 0;
// }else{
// $max = $num-2;
// $rand = mt_rand(0, $max);
// }
// if($num==2){
// $sql="select * from blog_article where aid in (".$id.") limit 0,1";
// }else{
// $sql="select * from blog_article where aid in (".$id.") limit ".$rand.",2";
// }
$items=$items*$p;
if($jid){
$sql="select a.* from blog_article as a,mall_juheproductdetail as b where a.aid in (".$jid_goods_id.") and a.is_on_sale = 1 and a.aid=b.goods_id and b.pid=".$jid." order by b.listorder asc limit 0,$items";
$q=mysql_query($sql);
}
if($id){
$sql="select * from blog_article where aid in (".$id.") and is_on_sale = 1 order by listorder asc limit 0,$items";
$q=mysql_query($sql);
}
// $sql="select * from blog_article where aid in (".$id.")";
// $q=mysql_query($sql);
//
//echo $sql;
$str_left=$str_right='';
$i=1;
$flag=0;
$maodian = '';
$last_aid=0;
$total_item=0;
$Normalproduct =new Normalproduct();
while($row=mysql_fetch_array($q)){
//读取活动单价
$row['F_Price'] = $Normalproduct->getSinglePrice($row['aid'],'app');
$flag=1;
$total_item+=1;
$last_aid=$row['aid'];
if($i%2){
$str_left.='
¥'.$row['F_Price'].'
¥'.(($row['oldprice']>$row['F_Price'])?$row['oldprice']:($row['F_Price']+10)).'
';
}else{
$str_right.='
¥'.$row['F_Price'].'
¥'.(($row['oldprice']>$row['F_Price'])?$row['oldprice']:($row['F_Price']+10)).'
';
}
$i++;
//echo $last_aid;
if($last_aid==$_GET['lastid']){
$flag=0;
$maodian='id="maodian"';
}
else
{
$maodian = '';
}
}
// $rand_ = $rand+2;
// if($num==2){
// $sql="select * from blog_article where aid in(".$id.") limit 1,1";
// }else{
// $sql="select * from blog_article where aid in(".$id.") limit ".$rand_.",2";
// }
// $q=mysql_query($sql);
// while($row=mysql_fetch_array($q)){
// }
?>
<?php if($total_item>=$items){ ?>
查看更多
function addCart(id){
// alert(count);
$.ajax({
url:"ajaxAddCart.php",
type: "GET",
data:{"id":id,"count":1,"act":"add"},
dataType:'text',
success:function(e){
if(e==1){
$("#"+id).css("display","block");
}else{
alert("加入购物车失败,请重新操作")
}
},
error:
function(){
alert("error");
}
});
}
function closeAddCartOk(id){
// alert(11);
$("#"+id).css("display","none");
}
function gettuijian(id){
$.ajax({
url:"ajaxAddCart.php",
type: "GET",
data:{"act":"gettuijian"},
dataType:'text',
success:function(e){
var arr=e.split("|||");
$('.waterfall_left').html(arr[1]);
$('.waterfall_right').html(arr[0]);
$('#tuijian_more').css('display','none');
},
error:
function(){
alert("error");
}
});
}
$(window).scroll(function(){
var scrollPos;
if (typeof window.pageYOffset != 'undefined') {
scrollPos = window.pageYOffset-1;
}
else if (typeof document.compatMode != 'undefined' &&
document.compatMode != 'BackCompat') {
scrollPos = document.documentElement.scrollTop-1;
}
else if (typeof document.body != 'undefined') {
scrollPos = document.body.scrollTop - 1;
}
if(($(window).scrollTop() >= $(document).height() - $(window).height())&&$(window).scrollTop() >0){
// alert("滚动到底部啦!");
if("<?php echo $flag;?>">0){
// window.location.href="./tiaozhuanchart.php?id=<?php echo $jid?$jid:$id;?>&p=<?php echo $flag?($p+1):$p;?>&jid=<?php echo $jid;?>&lastid=<?php echo $last_aid?>&scrollTop="+scrollPos;
if("<?php echo $platform;?>"=='ios'&&"<?php echo $version_arr[1];?>"<2){
window.location.href="./tiaozhuanchart.php?id=<?php echo $id;?>&p=<?php echo $flag?($p+1):$p;?>&jid=<?php echo $jid;?>&lastid=<?php echo $last_aid?>&scrollTop="+scrollPos;
}else{
window.location.href="./tiaozhuanchart.php?id=<?php echo $id;?>&p=<?php echo $flag?($p+1):$p;?>&jid=<?php echo $jid;?>&lastid=<?php echo $last_aid?>&scrollTop="+scrollPos+'#maodian';
}
}
}
});
window.onbeforeunload = function () {
var scrollPos;
if (typeof window.pageYOffset != 'undefined') {
scrollPos = window.pageYOffset-1;
}
else if (typeof document.compatMode != 'undefined' &&
document.compatMode != 'BackCompat') {
scrollPos = document.documentElement.scrollTop-1;
}
else if (typeof document.body != 'undefined') {
scrollPos = document.body.scrollTop - 1;
}
document.cookie = "scrollTop=" + scrollPos; //存储滚动条位置到cookies中
}
if("<?php echo $platform;?>"=='ios'&&"<?php echo $version_arr[1];?>"<2){
window.onload = function () {
if (document.cookie.match(/scrollTop=([^;]+)(;|$)/) != null) {
var arr = document.cookie.match(/scrollTop=([^;]+)(;|$)/); //cookies中不为空,则读取滚动条位置
document.documentElement.scrollTop = parseInt(arr[1]);
document.body.scrollTop = parseInt(arr[1]);
}
}
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史