2 Star 1 Fork 2

徐子玉 / 品贷网

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
product.php 12.97 KB
一键复制 编辑 原始数据 按行查看 历史
徐子玉 提交于 2017-07-05 11:21 . + pdw
<?php
include_once 'config.php';
include_once 'user_head.php';
include_once 'ad_head.php';
include_once 'search_head.php';
include_once 'user_right.php';
include_once 'sidebar.php';
include_once 'foot.php';
header ("Content-Type: text/html; charset=UTF-8");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$id = isset($_GET["id"]) ? $_GET["id"] : "0";
$productId = isset($_GET["productId"]) ? $_GET["productId"] : "0";
$factoryId = isset($_GET["factoryId"]) ? $_GET["factoryId"] : "0";
$typeId = isset($_GET["typeId"]) ? $_GET["typeId"] : "0";
$subTypeId = isset($_GET["subTypeId"]) ? $_GET["subTypeId"] : "0";
if (is_numeric($id))
{
$client = new SoapClient($GLOBAL_REMOTE_API);
$productInfo = array("factoryId"=>$factoryId, "userProxyId"=>$user_id, "productId"=>$id);
$productInfo_result = $client->PD_getProductInfo($productInfo);
if(!is_soap_fault($getProduct_result))
{
$broser = array("fid"=>$factoryId, "pid"=>$id, "uid"=>$user_id, "ip"=>$_SERVER["REMOTE_ADDR"]);
$client->Log_Broser($broser);
$getProduct = array("factoryId"=>$factoryId);
$getProduct_result = $client->PD_getProductTypeByfid($getProduct);
//根据厂商id获取厂商产品类型
$getProductResult = $getProduct_result->PD_getProductTypeByfidResult;
$getProductResultArray = json_decode($getProductResult, TRUE);
//开始解析
//产品类型
$getProduct_totalCount = $getProductResultArray[0]['totalCount'];
$getProduct_success = $getProductResultArray[0]['success'];
$getProduct_data = $getProductResultArray[0]['data'];
if ($getProduct_totalCount > 0 && $getProduct_success == true)
{
//产品类型
$Producthtml = '';
foreach($getProduct_data as $key=>$d){
$store_typeId = $getProduct_data[$key]['typeId'];
$store_typeName = $getProduct_data[$key]['typeName'];
$store_subType = $getProduct_data[$key]['subType'];
foreach($store_subType as $k=>$pd){
$goods_subTypeId = $store_subType[$k]['SubTypeId'];
$goods_subTypeName = $store_subType[$k]['SubTypeName'];
if ($subTypeId == $goods_subTypeId)
{
$lihtmlArr[] = '<li class="cur"><a href="store.php?id=' .$factoryId. '&typeId=' .$store_typeId. '&subTypeId=' .$goods_subTypeId. '">' .$goods_subTypeName. '</a></li>';
}
else {
$lihtmlArr[] = '<li><a href="store.php?id=' .$factoryId. '&typeId=' .$store_typeId. '&subTypeId=' .$goods_subTypeId. '">' .$goods_subTypeName. '</a></li>';
}
}
$lihtml = implode('', $lihtmlArr);
if ($typeId == $store_typeId)
{
$ulhtmlArr[] = '<li><a href="javascript:;" class="active">' .$store_typeName. '</a><ul class="sub-menu" style="display: block;">' .$lihtml. '</ul></li>';
}
else {
$ulhtmlArr[] = '<li><a href="javascript:;">' .$store_typeName. '</a><ul class="sub-menu" style="display: none;">' .$lihtml. '</ul></li>';
}
$lihtml = "";
$lihtmlArr = "";
}
$Producthtml = implode('', $ulhtmlArr);
}
//获取产品信息
$ProductInfoResult = $productInfo_result->PD_getProductInfoResult;
$result = strtr($ProductInfoResult, "\t", ' ');
$ProductInfoResultArray = json_decode($result, TRUE);
//开始解析
//获取产品信息
$ProductInfo_totalCount = $ProductInfoResultArray[0]['totalCount'];
$ProductInfo_success = $ProductInfoResultArray[0]['success'];
$ProductInfo_data = $ProductInfoResultArray[0]['data'];
//获取产品信息
$ProductInfohtml = '';
if ($ProductInfo_totalCount > 0 && $ProductInfo_success == true)
{
$productName = $ProductInfo_data[0]['productName'];
$Color = $ProductInfo_data[0]['Color'];
$color = "颜色:";
$PicUrl = $ProductInfo_data[0]['PicUrl'];
$memo = base64_decode($ProductInfo_data[0]['memo']);
$product_spec1 = '';
$product_spec1_color = '';
$product_spec1_original_price = '';
$product_spec1_price = '';
$product_spec1_discount = '';
$product_spec1_pkgunit = '';
$product_spec1_color=$Color;
if ($product_spec1_color == "") {
$color ='';
}else{
$product_spec1_color =$color. $Color;
}
if(isset($ProductInfo_data[0]['productColor']))
{
$productColor = $ProductInfo_data[0]['productColor'];
foreach ($productColor as $item) {
$ProductId = $item['ProductId'];
$Color1 = $item['Color'];
if ($product_spec1_color == '') $product_spec1_color = $Color;
if($id == $ProductId){
$product_spec_color_htmlArr[] = '<div class="color-cell selected"><b></b><a href="product.php?factoryId='. $factoryId .'&id='. $ProductId .'">'.$Color.'</a></div>';
}
else{
$product_spec_color_htmlArr[] = '<div class="color-cell"><b></b><a href="product.php?factoryId='. $factoryId .'&id='. $ProductId .'">'.$Color1.'</a></div>';
}
}
$product_spec_color_html = implode('', $product_spec_color_htmlArr);
}
if(isset($ProductInfo_data[0]['productStandard']))
{
$productStandard = $ProductInfo_data[0]['productStandard'];
foreach($productStandard as $specItem){
$Standard = $specItem['Standard'];
$originalPrice = $specItem['originalPrice'];
$Price = $specItem['price'];
$pkgUnit = $specItem['Unit'];
$discount = $specItem['discount'];
$discount = ($discount == 10.0) ? '注册会员享受优惠' : $discount . ' 折';
if ($product_spec1 == '') $product_spec1 = $Standard;
if ($product_spec1_original_price == '') $product_spec1_original_price = $originalPrice;
if ($product_spec1_price == '') $product_spec1_price = $Price;
if ($product_spec1_discount == '') $product_spec1_discount = $discount;
if ($product_spec1_pkgunit == '') $product_spec1_pkgunit = $pkgUnit;
$product_spec_htmlArr[] = '<a href="javascript:;" price="'.$Price.'" originalPrice="'.$originalPrice.'" pkgUnit="'.$pkgUnit.'">'.$Standard.'</a>';
$pkgUnitArr[] = $pkgUnit;
}
$out = array();
foreach ($pkgUnitArr as $key=>$value) {
if (!in_array($value, $out)){
$product_spec_pkgunit_htmlArr[] = '<a href="javascript:;">' . $value . '</a>';
$out[$key] = $value;
}
}
$product_spec_html = implode('', $product_spec_htmlArr);
$product_spec_pkgunit_html = implode('', $product_spec_pkgunit_htmlArr);
}
else
{
$product_spec_html = '';
}
$product_info_bigimg = '';
if(isset($ProductInfo_data[0]['productPic']))
{
$productPic = $ProductInfo_data[0]['productPic'];
foreach($productPic as $picItem){
$PicUrl = $picItem['PicUrl'];
if ($product_info_bigimg == '') $product_info_bigimg = '<img src="'.$PicUrl.'" width="420px;" height="260px;" />';
$product_pic_htmlArr[] = '<li class="img-link" src="'.$PicUrl.'"><img src="'.$PicUrl.'" width="99" height="62" alt="" /></li>';
if($k > 4) break;
}
$product_pic_html = implode('', $product_pic_htmlArr);
}
else{
$product_info_bigimg = '<img src="images/pro_defaultimg.png" width="420px;" height="260px;"/>';
}
}
$filename = "product_info.html";
$file = @fopen($filename,"r");
if ($file) {
$ProductInfohtml = @fread($file, filesize($filename));
$ProductInfohtml = str_replace("{\$product_info_title}", $productName, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_info_memo}", $memo, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$color}", $color, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_factory_id}", $factoryId, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_id}", $id, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_spec_color_html}", $product_spec_color_html, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_spec1}", $product_spec1, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_spec1_original_price}", $product_spec1_original_price, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_spec1_price}", $product_spec1_price, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_spec1_pkgunit}", $product_spec1_pkgunit, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_spec1_discount}", $product_spec1_discount, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_info_bigimg}", $product_info_bigimg, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_info_imglist}", $product_pic_html, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_info_html}", $product_spec_html, $ProductInfohtml);
$ProductInfohtml = str_replace("{\$product_info_pkgunit_html}", $product_spec_pkgunit_html, $ProductInfohtml);
fclose($file);
}
$factoryInfo = array("factoryId"=>$factoryId);
$factoryInfo_result = $client->PD_getFactoryInfoById($factoryInfo);
//根据厂商id获取厂商产品类型
$factoryInfoResult = $factoryInfo_result->PD_getFactoryInfoByIdResult;
$factoryInfoResultArray = json_decode($factoryInfoResult, TRUE);
//开始解析
$factoryInfo_totalCount = $factoryInfoResultArray[0]['totalCount'];
$factoryInfo_success = $factoryInfoResultArray[0]['success'];
$factoryInfo_data = $factoryInfoResultArray[0]['data'];
if ($factoryInfo_totalCount > 0 && $factoryInfo_success == true ) {
$Abbreviation = $factoryInfo_data[0]['Abbreviation'];
$Slogan = $factoryInfo_data[0]['Slogan'];
$Address = $factoryInfo_data[0]['Address'];
$Telphone = $factoryInfo_data[0]['Telphone'];
$Logo = $factoryInfo_data[0]['Logo'];
$Email = $factoryInfo_data[0]['Email'];
$Website = $factoryInfo_data[0]['Website'];
$HomeAD = $factoryInfo_data[$i]['HomeAD'];
if($HomeAD != ""){
$factoryInfohtml = '<a class="dp-logo" fname=' . $Abbreviation . ' href="store.php?id=' . $factoryId . '"><img src="' . $Logo . '"></a><div class="dp-img"><img src="' . $HomeAD . '"></div>';
}
else{
$factoryInfohtml = '<a class="dp-logo" fname=' . $Abbreviation . ' href="store.php?id=' . $factoryId . '"><img src="' . $Logo . '"></a><div class="dp-img"><img src="images/storedd.png"></div>';
}
}
$seo_param = array("productId"=>$productId);
$ProductSEO_result = $client->SEO_Product ($seo_param);
$ProductSEOResult = $ProductSEO_result->SEO_ProductResult;
$ProductSEOResultArray = json_decode( $ProductSEOResult,TRUE);
$SEO_ProductName = "";
$SEO_Abbreviation = "";
$SEO_BusinessScope = "";
$SEO_Address = "";
$SEO_SeiresNames = "";
$ProductSEO_totalCount = $ProductSEOResultArray[0]['totalCount'];
$ProductSEO_success = $ProductSEOResultArray[0]['success'];
$ProductSEO_data = $ProductSEOResultArray[0]['data'];
if ($ProductSEO_success == true) {
foreach ($ProductSEO_data as $item) {
$SEO_ProductName = $item["ProductName"];
$SEO_Abbreviation = $item["Abbreviation"];
$SEO_BusinessScope = $item["BusinessScope"];
$SEO_Address = $item["Address"];
$SEO_SeiresNames = $item["SeiresNames"];
}
}
$SEO_Title = $SEO_ProductName . ',' . $SEO_Abbreviation . ',' . ',品代网';
$SEO_Keywords = $SEO_ProductName . ',' .$SEO_Abbreviation . ',' . $SEO_BusinessScope . ',代理,代理申请,品代网';
$SEO_Description = $SEO_ProductName . ',' .$SEO_Abbreviation . ',' . $SEO_FactoryName . ',' . $SEO_Address . ',申请' . $SEO_Abbreviation . '代理请上品代网';
//输出模板
$filename = "product.html";
$file = @fopen($filename,"r");
if ($file) {
$contents = @fread($file, filesize($filename));
$contents = str_replace("{\$productId}", $id, $contents);
$contents = str_replace("{\$factoryId}", $factoryId, $contents);
$contents = str_replace("{\$userId}", $user_id, $contents);
$contents = str_replace("{\$Producthtml}", $Producthtml, $contents);
$contents = str_replace("{\$ProductInfohtml}", $ProductInfohtml, $contents);
$contents = str_replace("{\$factoryInfohtml}", $factoryInfohtml, $contents);
$contents = str_replace("{\$user_head_html}", $user_head_html, $contents);
$contents = str_replace("{\$ad_head_html}", $ad_head_html, $contents);
$contents = str_replace("{\$search_head_html}", $search_head_html, $contents);
$contents = str_replace("{\$userright_html}", $userright_html, $contents);
$contents = str_replace("{\$sidebar_html}", $sidebar_html, $contents);
$contents = str_replace("{\$foot_html}", $foot_html, $contents);
$contents = str_replace("{\$SEO_Title_html}", $SEO_Title, $contents);
$contents = str_replace("{\$SEO_Keywords_html}", $SEO_Keywords, $contents);
$contents = str_replace("{\$SEO_Description_html}", $SEO_Description, $contents);
echo $contents;
fclose($file);
}
}
}
?>
1
https://gitee.com/xuqipeter/pdw.git
git@gitee.com:xuqipeter/pdw.git
xuqipeter
pdw
品贷网
master

搜索帮助