Files
orico-official-website-old/app/th/view/product/detail.phtml
2024-10-29 14:04:59 +08:00

539 lines
22 KiB
PHTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{include file="include/head-seo" /}
{include file="include/head-product" /}
<script type="text/javascript" src="__PUBLIC__/webth/scripts/comment.js"></script>
<script type="text/javascript">
var navID = "1";
</script>
</head>
<body>
<!--top-->
<header class="header-PC header-Product">
<div id="header" class="theme-black">
{include file="include/top" /}
{include file="include/top-header" /}
</div>
</header>
{include file="include/top-header-mobile" /}
<!--top End-->
<script type="text/javascript" src="__PUBLIC__/web/scripts/large.js"></script>
<div class="indexbox-product cpmbox">
<div class="swt-Container">
<div class="product_address">
<a href="/index" class="href_01">Home</a>
<span class="icon-arrow arrow_address"></span><?php if($pid==''){?>
<a href="__ORICOROOT__<?php echo url_rewrite('product', ['id' => $cid['id']]); ?>" class="href_02"><?php echo $cid['name'];?></a>
<?php }else{?>
<a href="__ORICOROOT__<?php echo url_rewrite('product', ['id' => $pid['id']]); ?>" class="href_02"><?php echo $pid['name'];?></a>
<?php }?>
<span class="icon-arrow arrow_address"></span> <a href="__ORICOROOT__<?php echo url_rewrite('productsub', ['id' => $detail['cid']]); ?>" class="href_02"><?php echo $category['name'];?></a>
</div>
<!-- 产品 s -->
<div class="cp outBox">
<div class="cpfl">
<?php
$color = '/uploads/product/' . $color . '.jpg';
$proimages = [];
$images = [];
if ($product_images):
foreach ($product_images as $imgrow) {
$proimages[$imgrow['image_color']][] = $imgrow['image_url'];
}
if (isset($proimages[$color])) {
$images = $proimages[$color];
} else {
$images = $proimages[$product_images[0]['image_color']];
}
?>
<!--preview start-->
<div class="preview">
<div class="smallImg">
<div class="scrollbutton smallImgUp disabled"></div>
<div id="imageMenu">
<ul>
<?php
$firstimage = '';
foreach ($images as $k => $img):
?>
<li<?php if ($k == 0):$firstimage = $images[0]; ?> id="onlickImg"<?php endif; ?>>
<img src="<?php echo getImage($img); ?>"></li>
<?php endforeach; ?>
</ul>
</div>
<div class="scrollbutton smallImgDown"></div>
</div><!--smallImg end-->
<div id="vertical" class="bigImg">
<img src="<?php echo getImage($firstimage); ?>" id="midimg"/>
</div><!--bigImg end-->
</div>
<!--preview end-->
<!-- phone s-->
<div class="swiper-container banners">
<div class="swiper-wrapper">
<?php foreach ($images as $img): ?>
<div class="swiper-slide"><a href="javascript:void(0);"><img
src="<?php echo getImage($img); ?>"></a></div>
<?php endforeach; ?>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination bandot"></div>
</div>
<script type="text/javascript">
var swiper = new Swiper('.banners', {
loop: true,
autoplay: true,
pagination: {el: '.bandot',},
});
$(function () {
$(".plbtn").click(function () {
$(".play").show();
var video = document.getElementById("pvideo");
video.play();
});
$(".pcha").click(function () {
var video = document.getElementById("pvideo");
video.pause();
$(".play").hide();
});
});
</script>
<!-- phone e -->
<?php endif; ?>
<!-- 视频播放 s -->
<?php if ($detail['videopath'] == "") { ?><?php } else { ?>
<div class="play play1">
<a href="javascript:;" class="pcha"><img src="__PUBLIC__/web/images/images/cha1.png"></a>
<div class="moimg">
<video id="pvideo" width="100%" height="auto" controls
poster="<?php echo getImage($detail['picture']); ?>">
<source src="<?php echo $detail['videopath']; ?>">
您的浏览器不支持 video 标签。
Your browser does not support HTML5 video.
</video>
</div>
</div>
<div class="plbtn"><a href="javascript:;"><img src="__PUBLIC__/web/images/images/play.png"></a>
</div>
<?php } ?>
<!-- 视频播放 e -->
</div>
<div class="cprh">
<div class="cpcon">
<p class="ctit1"><?php echo $detail['name']; ?></p>
<p class="ctit2"><?php echo $detail['shortname']; ?></p>
</div>
<!-- 规格参数 s -->
<div class="proTfg">
<?php
if ($detail['product_view']) {
$detail_views = unserialize($detail['product_view']);
if ($detail_views) {
?>
<ul class="msul swt-Table">
<li class="Table-Row">
<div class="ms3 Table-Cell">Product Code</div>
<div class="ms2 Table-Cell"></div>
<div class="ms4 Table-Cell"><?php echo $detail['brand_id']; ?></div>
</li>
<?php foreach ($detail_views as $detail_view): ?>
<li class="Table-Row">
<div class="ms3 Table-Cell"><?php echo $detail_view['desc_title']; ?></div>
<div class="ms2 Table-Cell "></div>
<div class="ms4 Table-Cell"><?php echo $detail_view['desc_desc']; ?></div>
</li>
<?php endforeach; ?>
</ul>
<?php
}
}
?>
</div>
<!-- 规格参数 e -->
<?php if ($proimages): ?>
<div class="hd">
<ul>
<?php foreach ($proimages as $c => $imgclrs): $b = trim(strrchr($c, '/'), '/');
$b = substr($b, 0, strpos($b, '.')); ?>
<?php if ($c == '') { ?>
<?php } else { ?>
<li class="img-responsive<?php if ($c == $color): ?> on<?php endif; ?>">
<a <?php echo 'style="background: url(__PUBLIC__/web/images/' . $c . '.png);" href="__ORICOROOT__' . url_rewrite('productdetail', ['id' => $detail['id'], 'color' => $b]) . '"'; ?>><img
src="<?php echo $c; ?>" alt=""
style="width:10px; height: 10px; border-radius: 5px; margin:3px;"></a>
<?php } ?>
</li>
<?php endforeach; ?>
<?php if ($c == '') { ?>
<?php } else { ?>
<span>Color</span>
<?php } ?>
</ul>
</div>
<?php endif; ?>
<!--<div class="buy">
<?php if ($detail['url_tm']): ?>
<a href="<?php echo $detail['url_tm']; ?>" target="_blank" onclick="add_click(<?php echo $detail['id']; ?>, 3, '<?php echo $detail['url_tm']; ?>')">Buy Amazon</a>
<?php endif; ?>
<?php if ($detail['url_jd']): ?>
<a href="<?php echo $detail['url_jd']; ?>" target="_blank" onclick="add_click(<?php echo $detail['id']; ?>, 4, '<?php echo $detail['url_tm']; ?>')">Buy Newegg</a>
<?php endif; ?>
</div>-->
</div>
<div class="clear"></div>
</div>
<!-- 产品 e -->
</div>
</div>
<div class="warp">
<div class="warpa">
<!-- 锚链接 s -->
<ul class="cpa">
<li><a href="#link1">Product Description</a></li>
<li><a href="#link2">Related Products</a></li>
<li><a href="#link3">Related Download</a></li>
<!--<li><a href="#link4">评论</a></li>-->
<div class="clear"></div>
</ul>
<!-- 锚链接 e-->
</div>
<div class="swt-Container">
<!--产品详情-->
<div class="products_des"><?php echo $detail['ld_md_content']; ?></div>
</div>
<!-- 关联产品 s <?php //if ($product_relateds)print_r($product_relateds); ?>-->
<div class="warp2 proTfg">
<div class="swt-Container">
<div class="gltit" id="link2">Related Products</div>
<?php if ($product_relateds): ?>
<div class="cpBox">
<div class="owl-carousel">
<?php foreach ($product_relateds as $product):; ?>
<div class="item wow">
<?php $img = getProductReated($product['id']); ?>
<a href="__ORICOROOT__<?php echo url_rewrite('productdetail', ['id' => $product['id']]); ?>">
<div class="glimg img-responsive"><img src="<?php echo $product['list_bk_img']; ?>">
<!--换成一级列表图--></div>
<div class="gltext">
<p class="gl1"><?php echo $product['name']; ?></p>
<p class="gl2"> <?php echo $product['brand_id']; ?></p>
<!-- <p class="gl2">-->
<?php //echo $product['shortname']; ?><!--</p>-->
</div>
<div class="clear"></div>
</a>
</div>
<?php endforeach; ?>
</div>
<script>
var owl = $(".cpBox .owl-carousel");
owl.owlCarousel({
autoplay: true,
navigationText: ["", ""],
responsive: {
0: {
items: 1,
margin: 0
},
420: {
items: 1,
margin: 0,
smartSpeed: 80,
dots: false
},
640: {
items: 2,
margin: 0,
smartSpeed: 80,
dots: false
},
998: {
items: 3,
margin: 0,
smartSpeed: 80,
dots: false
},
},
})
</script>
</div>
<?php endif; ?>
</div>
</div>
<!-- 相关下载 s -->
<?php if (!$product_dls) { ?>
<?php } else { ?>
<div class="nybox proTfg">
<div class="swt-Container">
<div class="sptit" id="link3">Related Download</div>
<?php
if ($product_dls):
$selectTypeArr = config("product_dltype");
$prodls = [];
foreach ($product_dls as $dlrow) {
$prodls[$dlrow['dl_type']][] = $dlrow;
}
?>
<?php foreach ($prodls as $type => $dlclrs): ?>
<div class="xz">
<p class="xztit"><?php echo isset($selectTypeArr[$type]) ? $selectTypeArr[$type] : ''; ?></p>
<?php foreach ($dlclrs as $dl): ?>
<p class="xz1"><a
href="__ORICOROOT__<?php echo url('/download/prodownload', ['id' => $dl['id']]); ?>"><i></i><?php echo $dl['dl_name']; ?>
</a></p>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<?php } ?>
<!-- 相关下载 e -->
<script type="text/javascript">
$(function () {
var $category = $(".ans .anbox");
$category.hide();
$(".ans .antit").click(function () {
if ($(this).next(".anbox").is(":visible")) {
$(this).removeClass('on').next().slideUp(800);
$(this).parent('.ans').removeClass('on');
$(this).children("i").removeClass("ons")
} else {
$category.hide();
$(".ans .antit").removeClass('on');
$(this).children("i").addClass("ons")
$(this).addClass('on').next().slideDown(800);
$(this).parent('.ans').addClass('on');
}
});
});
$(function () {
$('a[href*=#],area[href*=#]').click(function () {
console.log(this.pathname)
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']');
if ($target.length) {
var targetOffset = $target.offset().top - 50;
$('html,body').animate({
scrollTop: targetOffset
}, 800);
return false; //页面锚点跳转动画 后面的800是锚点跳转的时间 800ms
}
}
});
})
$(document).ready(function () {
//获取div-one距离顶部的距离
var navtop = $(".warpa").offset().top;
$(document).scroll(function () {
//获取滚动条滚动的高度
var scroltop = $(document).scrollTop();
if (scroltop > navtop) {
$(".warpa").css({
"position": "fixed",
"top": "0px",
"left": "0px",
"right": "0px",
"z-index": "999"
})
} else {
$(".warpa").css({
"position": "",
"top": "",
"left": "",
"right": "",
"z-index": ""
})
}
})
})
$("input").click(function () {
$(this).siblings("div").children("span").addClass("active");
$(this).parents("div").siblings("div").find("span").removeClass("active");
});
$(function () {
$(window).scroll(function () {
var arr = []
$.each($(".proTfg"), function (k, v) {
arr[k] = $(this).offset().top + $(this).height();
})
$.each(arr, function (k, v) {
if (($(window).scrollTop() + $(".cpa li").eq(k - 1).height() + 10) < v) {
if (!$(".cpa li").eq(k).hasClass("current")) {
$(".cpa li").eq(k).attr("class", "current").siblings().removeClass();
}
return false;
}
})
})
})
</script>
</div>
<div class="enlarge-img" style="display: none;">
<div class="scrollbutton_01 smallImgUp disabled"></div>
<img src="<?php echo getImage($firstimage); ?>">
<div class="scrollbutton_01 smallImgDown"></div>
<div class="close"><span class="icon-close"></div>
</div>
<!--详情新增样式-->
<script>
$(function () {
var obj = new commentMove('.tm-m-photos', '.tm-m-photo-viewer');
obj.init()
})
</script>
<script type="text/javascript">
window.onload = function () {
var oStar = document.getElementById("star");
var aLi = oStar.getElementsByTagName("li");
var oUl = oStar.getElementsByTagName("ul")[0];
var oSpan = oStar.getElementsByTagName("span")[1];
var oP = oStar.getElementsByTagName("p")[0];
var i = iScore = iStar = 0;
for (i = 1; i <= aLi.length; i++) {
aLi[i - 1].index = i;
//鼠标移过显示分数
aLi[i - 1].onmouseover = function () {
fnPoint(this.index);
//浮动层显示
oP.style.display = "block";
//计算浮动层位置
oP.style.left = oUl.offsetLeft + this.index * this.offsetWidth - 104 + "px";
//匹配浮动层文字内容
oP.innerHTML = "<em><b>" + this.index + "</b> 分 " + aMsg[this.index - 1].match(/(.+)\|/)[1] + "</em>" + aMsg[this.index - 1].match(/\|(.+)/)[1]
};
//鼠标离开后恢复上次评分
aLi[i - 1].onmouseout = function () {
fnPoint();
//关闭浮动层
oP.style.display = "none"
};
//点击后进行评分处理
aLi[i - 1].onclick = function () {
iStar = this.index;
oP.style.display = "none";
oSpan.innerHTML = "<strong>" + (this.index) + " 分</strong> (" + aMsg[this.index - 1].match(/\|(.+)/)[1] + ")"
}
}
//评分处理
function fnPoint(iArg) {
//分数赋值
iScore = iArg || iStar;
for (i = 0; i < aLi.length; i++) aLi[i].className = i < iScore ? "on" : "";
}
};
</script>
<script>
/*图片放大效果*/
$(".bigImg").click(function () {
$(".enlarge-img").show();
});
$(".enlarge-img .close").click(function () {
$(".enlarge-img").hide();
});
</script>
<script>
/*图片放大效果*/
$(".bigImg").click(function () {
$(".enlarge-img").show();
});
$(".enlarge-img .close").click(function () {
$(".enlarge-img").hide();
});
</script>
<!-- bottom s -->
{include file="include/bottom" /}
<!-- bottom e -->
</body>
</html>
<script type="text/javascript">
$(function() {
})
function add_click(content_id, type, url) {
$.ajax({
url: '/id/clicksum/add_click',
data: {
content_id: content_id,
type: type,
customer_id: 0,
country_code: 'TH',
url:url
},
type: 'post',
dataType: 'json',
success: function(res) {
}
})
}
</script>