码迷,mamicode.com
首页 > Web开发 > 详细

IE浏览器中 $.ajax返回uindefined 其他浏览器正常

时间:2015-11-16 15:56:32      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:ie浏览器   ajax   

goods.php


<?php

/**

 * 前台商品

 *

 */

defined(‘IN_B2B2C‘) or exit(‘Access Invalid!‘);

header("Content-type:text/html;charset=utf-8");//加上这个就好了

class goodsControl extends BaseGoodsControl {

    const url_key = "abek2145522254fgfg5224";

    public function __construct() {

        parent::__construct ();

        Language::read ( ‘store_goods_index‘ );

    }


    /**

     * 单个商品信息页

     */

    public function indexOp() {

        $goods_id = intval($_GET [‘goods_id‘]);

        // 如果有type类型

        if ( $_GET[‘type‘] )

        {

            Tpl::output( ‘type‘, $_GET[‘type‘] );

        }

        //如果是通过链接购买

        if($_GET[‘pmemberid‘]) {

            Tpl::output( ‘pmemberid‘, $_GET[‘pmemberid‘] );

        }

        //获取销量基数是否开启的功能  add by Chen

        $temp_setting = H("setting");

        $flags = intval($temp_setting[‘goods_base_salenum‘]);


        // 商品详细信息

        $model_goods = Model(‘goods‘);

        $dis_member_M = Model( ‘distribute_member‘ );

        $goods_detail = $model_goods->getGoodsDetail($goods_id, ‘*‘);

        $goods_info = $goods_detail[‘goods_info‘];

        if (empty($goods_info)) {

            showMessage(L(‘goods_index_no_goods‘), ‘‘, ‘html‘, ‘error‘);

        }

        // 查询分销信息

        $common_con[‘is_distribute‘] = 1;

        $common_con[‘goods_commonid‘] = $goods_info[‘goods_commonid‘];

        $common_res = $model_goods->getGoodsCommonList( $common_con );

        $dismembercon[‘is_valid‘] = 1;

        $dismembercon[‘member_id‘] = $_SESSION[‘member_id‘];

        $dis_memberres = $dis_member_M->getOneInfo( $dismembercon );

        $type = decrypt( $_GET[‘type‘], self::url_key );

        $type_arr = array( 11, 12 );

        if ( $dis_memberres && $common_res[0][‘is_distribute‘] == 1 && in_array( $type, $type_arr) )

        {

            $distribute_price = $model_goods->GetGoodsDistributeprice( $_SESSION[‘member_id‘], $goods_id );

            Tpl::output( ‘distribute_price‘, $distribute_price );

        }

//查询积分信息

$model_goods_common = Model(‘goods_common‘);

$common_con_integrate = array();

        $common_con_integrate[‘goods_commonid‘] = $goods_info[‘goods_commonid‘];

        $common_integrate_res = $model_goods_common->getGoodeCommonInfo( $common_con_integrate,‘is_integrate_goods‘ );

        if($common_integrate_res[‘is_integrate_goods‘] == ‘1‘){

        Tpl::output( ‘is_integrate_goods‘, $common_integrate_res[‘is_integrate_goods‘] );

        Tpl::output( ‘integrate_price‘, $goods_info[‘integrate_price‘] );

        Tpl::output( ‘goods_integrate‘, $goods_info[‘goods_integrate‘] );

        }

        

        $this->getStoreInfo($goods_info[‘store_id‘]);

Tpl::output(‘zoom_type‘, 2);//1 原始方式 2 放大镜方式

        Tpl::output(‘spec_list‘, $goods_detail[‘spec_list‘]);

        Tpl::output(‘spec_image‘, $goods_detail[‘spec_image‘]);

        Tpl::output(‘goods_image‘, $goods_detail[‘goods_image‘]);

        Tpl::output(‘image_more‘, $goods_detail[‘image_more‘]);

        Tpl::output(‘groupbuy_info‘, $goods_detail[‘groupbuy_info‘]);

        Tpl::output(‘xianshi_info‘, $goods_detail[‘xianshi_info‘]);

        Tpl::output(‘mansong_info‘, $goods_detail[‘mansong_info‘]);


        // 生成缓存的键值

        $hash_key = $goods_info[‘goods_id‘];

        // 先查找$hash_key缓存

        $cachekey_arr = array (

                ‘likenum‘,

                ‘sharenum‘

        );

        if ($_cache = rcache($hash_key, ‘product‘)) {

            foreach ($_cache as $k => $v) {

                $goods_info[$k] = $v;

            }

        } else {

            // 查询SNS中该商品的信息

            $snsgoodsinfo = Model(‘sns_goods‘)->getSNSGoodsInfo(array(‘snsgoods_goodsid‘ => $goods_info[‘goods_id‘]), ‘snsgoods_likenum,snsgoods_sharenum‘);

            $goods_info[‘likenum‘] = $snsgoodsinfo[‘snsgoods_likenum‘];

            $goods_info[‘sharenum‘] = $snsgoodsinfo[‘snsgoods_sharenum‘];

            

            $data = array();

            if (! empty ( $goods_info )) {

                foreach ( $goods_info as $k => $v ) {

                    if (in_array ( $k, $cachekey_arr )) {

                        $data [$k] = $v;

                    }

                }

            }

            // 缓存商品信息

            wcache ( $hash_key, $data, ‘product‘ );

        }

        

        // 检查是否为店主本人

        $store_self = false;

        if (!empty($_SESSION[‘store_id‘])) {

            if ($goods_info[‘store_id‘] == $_SESSION[‘store_id‘]) {

                $store_self = true;

            }

        }

        Tpl::output(‘store_self‘,$store_self );

        

        // 如果使用运费模板

        if ($goods_info[‘transport_id‘] > 0) {

            // 取得三种运送方式默认运费

            $model_transport = Model(‘transport‘);

            $transport = $model_transport->getExtendList(array(‘transport_id‘ => $goods_info[‘transport_id‘], ‘is_default‘ => 1));

            if (!empty($transport) && is_array($transport)) {

                foreach ($transport as $v) {

                    $goods_info[$v[‘type‘] . "_price"] = $v[‘sprice‘];

                }

            }

        }

        if($goods_info[‘is_gv‘] == 1)

        {

            $goods_info[‘upper_limit‘] = $goods_info[‘g_vlimit‘];

        }


        // Add  2015.2.10  08:28 PM  Yusure

        $remove_reg = "/.*?<img .*?(width=.*?) (height=.*?) .*?>/" ;

        // 匹配宽度,高度

        preg_match_all( $remove_reg , $goods_info[‘goods_body‘], $matches) ; 

        //print_r($matches);exit;

        $width = $matches[1] ;        

        $height = $matches[2] ;

        // 去除宽度

        foreach ( $width as $k => $width_v )

        {

            $goods_info[‘goods_body‘] = str_replace( $width_v, "", $goods_info[‘goods_body‘]);

        }

        // 去除高度

        foreach ( $height as $k => $height_v )

        {

            $goods_info[‘goods_body‘] = str_replace( $height_v, "", $goods_info[‘goods_body‘]);

        }


        Tpl::output(‘goods‘, $goods_info);

        // 关联版式

        $plateid_array = array();

        if (!empty($goods_info[‘plateid_top‘])) {

            $plateid_array[] = $goods_info[‘plateid_top‘];

        }

        if (!empty($goods_info[‘plateid_bottom‘])) {

            $plateid_array[] = $goods_info[‘plateid_bottom‘];

        }

        if (!empty($plateid_array)) {

            $plate_array = Model(‘store_plate‘)->getPlateList(array(‘plate_id‘ => array(‘in‘, $plateid_array), ‘store_id‘ => $goods_info[‘store_id‘]));

            $plate_array = array_under_reset($plate_array, ‘plate_position‘, 2);

            Tpl::output(‘plate_array‘, $plate_array);

        }

        Tpl::output(‘store_id‘, $goods_info [‘store_id‘]);

        

        // 输出一级地区

        $area_list = array(1 => ‘北京‘, 2 => ‘天津‘, 3 => ‘河北‘, 4 => ‘山西‘, 5 => ‘内蒙古‘, 6 => ‘辽宁‘, 7 => ‘吉林‘, 8 => ‘黑龙江‘, 9 => ‘上海‘,

                            10 => ‘江苏‘, 11 => ‘浙江‘, 12 => ‘安徽‘, 13 => ‘福建‘, 14 => ‘江西‘, 15 => ‘山东‘, 16 => ‘河南‘, 17 => ‘湖北‘, 18 => ‘湖南‘,

                            19 => ‘广东‘, 20 => ‘广西‘, 21 => ‘海南‘, 22 => ‘重庆‘, 23 => ‘四川‘, 24 => ‘贵州‘, 25 => ‘云南‘, 26 => ‘西藏‘, 27 => ‘陕西‘,

                            28 => ‘甘肃‘, 29 => ‘青海‘, 30 => ‘宁夏‘, 31 => ‘新疆‘, 32 => ‘台湾‘, 33 => ‘香港‘, 34 => ‘澳门‘, 35 => ‘海外‘ 

                        );

        if (strtoupper(CHARSET) == ‘GBK‘) {

            $area_list = Language::getGBK($area_list);

        }

        Tpl::output(‘area_list‘, $area_list);

        

        // 生成浏览过产品

        /*$cookievalue = $goods_id . ‘-‘ . $goods_info [‘store_id‘];

        if (cookie(‘viewed_goods‘)) {

            $string_viewed_goods = decrypt(cookie(‘viewed_goods‘), MD5_KEY);

            if (get_magic_quotes_gpc()) {

                $string_viewed_goods = stripslashes($string_viewed_goods); // 去除斜杠

            }

            $vg_ca = @unserialize($string_viewed_goods);

            $sign = true;

            if ( !empty($vg_ca) && is_array($vg_ca)) {

                foreach ($vg_ca as $vk => $vv) {

                    if ($vv == $cookievalue) {

                        $sign = false;

                    }

                }

            } else {

                $vg_ca = array();

            }

            

            if ($sign) {

                if (count($vg_ca) >= 6) {

                    $vg_ca[] = $cookievalue;

                    array_shift($vg_ca);

                } else {

                    $vg_ca[] = $cookievalue;

                }

            }

        } else {

            $vg_ca[] = $cookievalue;

        }

        $vg_ca = encrypt(serialize($vg_ca), MD5_KEY);

        setNcCookie(‘viewed_goods‘, $vg_ca);

        */

        //优先得到推荐商品

        $goods_commend_list = $model_goods->getGoodsOnlineList(array(‘store_id‘ => $goods_info[‘store_id‘], ‘goods_commend‘ => 1), ‘goods_id,goods_name,goods_jingle,goods_image,store_id,goods_price‘, 0, ‘rand()‘, 5, ‘goods_commonid‘);

        Tpl::output(‘goods_commend‘,$goods_commend_list);

        

        

        // 当前位置导航

        $nav_link_list = Model(‘goods_class‘)->getGoodsClassNav($goods_info[‘gc_id‘], 0);

        $nav_link_list[] = array(‘title‘ => $goods_info[‘goods_name‘]);

        Tpl::output(‘nav_link_list‘, $nav_link_list );


         //销售记录数量

        $sales_con[‘order_goods.goods_id‘]=$goods_id;

        if($flags!=1){

        // $sales_num=$this->saleNum($sales_con);

        $sales_num = $this->shamSaleNum($goods_id,false);

        }else{

        $sales_num = $this->shamSaleNum($goods_id,true);

        }

        Tpl::output("sales_num",$sales_num);

        //评价信息

        $goods_evaluate_info = Model(‘evaluate_goods‘)->getEvaluateGoodsInfoByGoodsID($goods_id,$flags);

        Tpl::output(‘goods_evaluate_info‘, $goods_evaluate_info);

        

        $seo_param = array ();

        $seo_param[‘name‘] = $goods_info[‘goods_name‘];

        $seo_param[‘key‘] = $goods_info[‘goods_keywords‘];

        $seo_param[‘description‘] = $goods_info[‘goods_description‘];

        Model(‘seo‘)->type(‘product‘)->param($seo_param)->show();

        Tpl::showpage(‘new_goods‘);

    }

public function getinfoOp() {

$goods_id = intval($_REQUEST[‘goods_id‘]);

        // 如果有type类型

        if ( $_REQUEST[‘type‘] )

        {

        $type = $_REQUEST[‘type‘];

            //Tpl::output( ‘type‘, $_GET[‘type‘] );

        }

        //如果是通过链接购买

        if($_REQUEST[‘pmemberid‘]) {

        $pmemberid = $_REQUEST[‘pmemberid‘];

            //Tpl::output( ‘pmemberid‘, $_GET[‘pmemberid‘] );

        }

        //获取销量基数是否开启的功能  

        $temp_setting = H("setting");

        $flags = intval($temp_setting[‘goods_base_salenum‘]);


        // 商品详细信息

        $model_goods = Model(‘goods‘);

        $dis_member_M = Model( ‘distribute_member‘ );

        $goods_detail = $model_goods->getGoodsDetail($goods_id, ‘*‘);

        $goods_info = $goods_detail[‘goods_info‘];

        

        if (empty($goods_info)) {

        output_error(‘商品已下架或不存在‘);

        }

        // 查询分销信息

        $common_con[‘is_distribute‘] = 1;

        $common_con[‘goods_commonid‘] = $goods_info[‘goods_commonid‘];

        $common_res = $model_goods->getGoodsCommonList( $common_con );

        $dismembercon[‘is_valid‘] = 1;

        $dismembercon[‘member_id‘] = $_SESSION[‘member_id‘];

        $dis_memberres = $dis_member_M->getOneInfo( $dismembercon );

        $type = decrypt( $_GET[‘type‘], self::url_key );

        $type_arr = array( 11, 12 );

        if ( $dis_memberres && $common_res[0][‘is_distribute‘] == 1 && in_array( $type, $type_arr) )

        {

            $distribute_price = $model_goods->GetGoodsDistributeprice( $_SESSION[‘member_id‘], $goods_id );

    

            //Tpl::output( ‘distribute_price‘, $distribute_price );

        }

//查询积分信息

$model_goods_common = Model(‘goods_common‘);

$common_con_integrate = array();

        $common_con_integrate[‘goods_commonid‘] = $goods_info[‘goods_commonid‘];

        $common_integrate_res = $model_goods_common->getGoodeCommonInfo( $common_con_integrate,‘is_integrate_goods‘ );

        if($common_integrate_res[‘is_integrate_goods‘] == ‘1‘){

        $is_integrate_goods = $common_integrate_res[‘is_integrate_goods‘];

        $integrate_price = $goods_info[‘integrate_price‘];

        $goods_integrate = $goods_info[‘goods_integrate‘];

        //Tpl::output( ‘is_integrate_goods‘, $common_integrate_res[‘is_integrate_goods‘] );

        //Tpl::output( ‘integrate_price‘, $goods_info[‘integrate_price‘] );

        //Tpl::output( ‘goods_integrate‘, $goods_info[‘goods_integrate‘] );

        }

        

        $this->getStoreInfo($goods_info[‘store_id‘]);


        // 生成缓存的键值

        $hash_key = $goods_info[‘goods_id‘];

        // 先查找$hash_key缓存

        $cachekey_arr = array (

                ‘likenum‘,

                ‘sharenum‘

        );

        if ($_cache = rcache($hash_key, ‘product‘)) {

            foreach ($_cache as $k => $v) {

                $goods_info[$k] = $v;

            }

        } else {

            // 查询SNS中该商品的信息

            $snsgoodsinfo = Model(‘sns_goods‘)->getSNSGoodsInfo(array(‘snsgoods_goodsid‘ => $goods_info[‘goods_id‘]), ‘snsgoods_likenum,snsgoods_sharenum‘);

            $goods_info[‘likenum‘] = $snsgoodsinfo[‘snsgoods_likenum‘];

            $goods_info[‘sharenum‘] = $snsgoodsinfo[‘snsgoods_sharenum‘];

            

            $data = array();

            if (! empty ( $goods_info )) {

                foreach ( $goods_info as $k => $v ) {

                    if (in_array ( $k, $cachekey_arr )) {

                        $data [$k] = $v;

                    }

                }

            }

            // 缓存商品信息

            wcache ( $hash_key, $data, ‘product‘ );

        }

        

        

        // 如果使用运费模板

        if ($goods_info[‘transport_id‘] > 0) {

            // 取得三种运送方式默认运费

            $model_transport = Model(‘transport‘);

            $transport = $model_transport->getExtendList(array(‘transport_id‘ => $goods_info[‘transport_id‘], ‘is_default‘ => 1));

            if (!empty($transport) && is_array($transport)) {

                foreach ($transport as $v) {

                    $goods_info[$v[‘type‘] . "_price"] = $v[‘sprice‘];

                }

            }

        }

        if($goods_info[‘is_gv‘] == 1)

        {

            $goods_info[‘upper_limit‘] = $goods_info[‘g_vlimit‘];

        }


        // Add  2015.2.10  08:28 PM  Yusure

        $remove_reg = "/.*?<img .*?(width=.*?) (height=.*?) .*?>/" ;

        // 匹配宽度,高度

        preg_match_all( $remove_reg , $goods_info[‘goods_body‘], $matches) ; 

        //print_r($matches);exit;

        $width = $matches[1] ;        

        $height = $matches[2] ;

        // 去除宽度

        foreach ( $width as $k => $width_v )

        {

            $goods_info[‘goods_body‘] = str_replace( $width_v, "", $goods_info[‘goods_body‘]);

        }

        // 去除高度

        foreach ( $height as $k => $height_v )

        {

            $goods_info[‘goods_body‘] = str_replace( $height_v, "", $goods_info[‘goods_body‘]);

        }

        //Tpl::output(‘goods‘, $goods_info);

        // 关联版式

        $plateid_array = array();

        if (!empty($goods_info[‘plateid_top‘])) {

            $plateid_array[] = $goods_info[‘plateid_top‘];

        }

        //Tpl::output(‘store_id‘, $goods_info [‘store_id‘]);

        

        // 输出一级地区

        $area_list = array(1 => ‘北京‘, 2 => ‘天津‘, 3 => ‘河北‘, 4 => ‘山西‘, 5 => ‘内蒙古‘, 6 => ‘辽宁‘, 7 => ‘吉林‘, 8 => ‘黑龙江‘, 9 => ‘上海‘,

                            10 => ‘江苏‘, 11 => ‘浙江‘, 12 => ‘安徽‘, 13 => ‘福建‘, 14 => ‘江西‘, 15 => ‘山东‘, 16 => ‘河南‘, 17 => ‘湖北‘, 18 => ‘湖南‘,

                            19 => ‘广东‘, 20 => ‘广西‘, 21 => ‘海南‘, 22 => ‘重庆‘, 23 => ‘四川‘, 24 => ‘贵州‘, 25 => ‘云南‘, 26 => ‘西藏‘, 27 => ‘陕西‘,

                            28 => ‘甘肃‘, 29 => ‘青海‘, 30 => ‘宁夏‘, 31 => ‘新疆‘, 32 => ‘台湾‘, 33 => ‘香港‘, 34 => ‘澳门‘, 35 => ‘海外‘ 

                        );

        if (strtoupper(CHARSET) == ‘GBK‘) {

            $area_list = Language::getGBK($area_list);

        }

         //销售记录数量

        $sales_con[‘order_goods.goods_id‘]=$goods_id;

        if($flags!=1){

        $sales_num = $this->shamSaleNum($goods_id,false);

        }else{

        $sales_num = $this->shamSaleNum($goods_id,true);

        }


        //评价信息

        $goods_evaluate_info = Model(‘evaluate_goods‘)->getEvaluateGoodsInfoByGoodsID($goods_id,$flags);

        $resouce[‘image1‘] = SHOP_TEMPLATES_URL.‘/images/er.jpg‘;

        $resouce[‘image2‘] = RESOURCE_SITE_URL.‘/js/qrcode/loading.gif‘;

        

        if($goods_info[‘promotion_price‘]){

        $jiesheng = $goods_info[‘goods_marketprice‘] - $goods_info[‘promotion_price‘];

        }else{

        $jiesheng = $goods_info[‘goods_marketprice‘] - $goods_info[‘goods_price‘];

        }

        if($goods_info[‘lower_limit‘]){

        $goods_info[‘lower_limit‘] = sprintf(‘最低%s件起‘,$goods_info[‘lower_limit‘]);

        }

        if($goods_info[‘upper_limit‘]){

        $goods_info[‘upper_limit‘] = sprintf(‘最多限购%s件‘,$goods_info[‘upper_limit‘]);

        }

        if($goods_info[‘g_vindate‘]){

        $goods_info[‘g_vindate‘] = date(‘Y-m-d‘,$goods_info[‘g_vindate‘]);

        }

        $data = array(‘sales_num‘=>$sales_num,‘area_list‘=>$area_list,‘goods‘=>$goods_info,‘goods_detail‘=>$goods_detail,‘is_integrate_goods‘=>$is_integrate_goods,‘distribute_price‘=>$distribute_price,‘goods_evaluate_info‘=>$goods_evaluate_info,‘resouce‘=>$resouce,‘jiesheng‘=>$jiesheng,‘pmemberid‘=>$pmemberid,‘SHOP_SITE_URL‘=>SHOP_SITE_URL);


        echo json_encode($data);exit;

        //output_data($data);

}

    private function get_btn_state($promotion_info) {

        $btn_state = array();

        $btn_state[‘btn_buynow‘] = TRUE;

        $btn_state[‘btn_addcart‘] = TRUE;


        if($promotion_info[‘group‘]) {

            $btn_state[‘btn_addcart‘] = FALSE;

        }


        if($promotion_info[‘xianshi‘]) {

            if($promotion_info[‘xianshi‘][‘start_time‘] < TIMESTAMP) {

                $btn_state[‘btn_addcart‘] = FALSE;

            }

        }

        return $btn_state;

    }

    public function saleNum($condition=array()) {

          $order_model = Model(‘order‘);

          $salesNum = $order_model->getOrderAndOrderGoodsSalesNum($condition);

          return $salesNum;

    }

/**

* 虚销量方法

* Enter description here ... 某一类产品的所有销量而非具体的产品的销量【与saleNum的不同】

* @param unknown_type $goods_id ---商品的商品ID

* @param unknown_type $flags --- 是否需要加销量基数

*/

    public function shamSaleNum($goods_id,$flags = false){

    $temp_con[‘goods_id‘] = $goods_id; 

    $model_goods = Model("goods");

    $g_info = $model_goods->getOneInfo($temp_con,"goods_commonid");

    $common_id = $g_info[‘goods_commonid‘];

    $temp_con2[‘goods_commonid‘] = $common_id;

    $g_list = $model_goods->table("goods")->where($temp_con2)->select();

    $temp_str = "";

    $temp_base = 0;

    foreach($g_list as $k=>$val){

    if($k==0){

    $temp_str = $val[‘goods_id‘];

    }else{

    $temp_str .= ",".$val[‘goods_id‘];

    }

    }

    $condition[‘order_goods.goods_id‘] = array("in",$temp_str);

    $order_model = Model(‘order‘);

        $salesNum = $order_model->getOrderAndOrderGoodsSalesNum($condition);

        if($flags){

        $gcM = Model("goods_common");

        $gc_info = $gcM->field("goods_base_salenum")->where("goods_commonid=‘".$common_id."‘")->find();

        $temp_base = intval($gc_info[‘goods_base_salenum‘]);

        $salesNum += $temp_base;

        } 

        return $salesNum;

    }

    /**

* 商品评论

*/

public function commentsOp() {

        $goods_id = intval($_GET[‘goods_id‘]);

        $temp_setting = H("setting");

        $flags = intval($temp_setting[‘goods_base_salenum‘]);

        $is_category = false;

if($flags==1){

$is_category = true;

}

        $this->_get_comments($goods_id, $_GET[‘type‘],10,$is_category);

Tpl::showpage(‘goods.comments‘,‘null_layout‘);

}


    /**

     * 商品评价详细页

     */

    public function comments_listOp() {

        $goods_id = intval($_GET [‘goods_id‘]);


        // 商品详细信息

        $model_goods = Model(‘goods‘);

        $goods_info = $model_goods->getGoodsInfo(array(‘goods_id‘ => intval($_GET[‘goods_id‘])), ‘*‘);

        // 验证商品是否存在

        if (empty($goods_info)) {

            showMessage(L(‘goods_index_no_goods‘), ‘‘, ‘html‘, ‘error‘);

        }

        Tpl::output(‘goods‘, $goods_info);


        $this->getStoreInfo($goods_info[‘store_id‘]);


        // 当前位置导航

        $nav_link_list = Model(‘goods_class‘)->getGoodsClassNav($goods_info[‘gc_id‘], 0);

        $nav_link_list[] = array(‘title‘ => $goods_info[‘goods_name‘], ‘link‘ => urlShop(‘goods‘, ‘index‘, array(‘goods_id‘ => $goods_id)));

        $nav_link_list[] = array(‘title‘ => ‘商品评价‘);

        Tpl::output(‘nav_link_list‘, $nav_link_list );


        //评价信息

        $goods_evaluate_info = Model(‘evaluate_goods‘)->getEvaluateGoodsInfoByGoodsID($goods_id);

        Tpl::output(‘goods_evaluate_info‘, $goods_evaluate_info);

        

        $seo_param = array ();

        $seo_param[‘name‘] = $goods_info[‘goods_name‘];

        $seo_param[‘key‘] = $goods_info[‘goods_keywords‘];

        $seo_param[‘description‘] = $goods_info[‘goods_description‘];

        Model(‘seo‘)->type(‘product‘)->param($seo_param)->show();

        //只有在开启销量基数的情况下,才能为真即获取一类商品的评价【原来是根据goods_id来的】

$temp_setting = H("setting");

        $flags = intval($temp_setting[‘goods_base_salenum‘]);

        $is_category = false;

if($flags==1){

$is_category = true;

}

$this->_get_comments($goods_id,$_GET[‘type‘], 20,$is_category);


Tpl::showpage(‘goods.comments_list‘);

    }

/**

* 获取评论列表

* Enter description here ...

* @param unknown_type $goods_id  商品ID

* @param unknown_type $type  好评 差评  中评

* @param unknown_type $page  每页显示条数

* @param unknown_type $is_category 是否是显示某一类,false--某个产品,true--某一类产品【之前是某一个具体产品】

*/

    private function _get_comments($goods_id, $type, $page,$is_category) {

        $condition = array();

        if($is_category){

        $gM = Model(‘goods‘);

    $g_common = $gM->getOneInfo("goods_id=‘".$goods_id."‘","goods_commonid");

    $commonid =  intval($g_common[‘goods_commonid‘]);

    $goods_arr = $gM->table("goods")->field("goods_id")->where("goods_commonid = ‘".$commonid."‘")->select();

$temp_str = "";

    foreach($goods_arr as $k => $v){

    if($k==0){

    $temp_str = $v[‘goods_id‘];

    }else{

    $temp_str .= ",".$v[‘goods_id‘] ;

    }

    }

     

    $condition[‘geval_goodsid‘] = array("in",$temp_str);

        }else{

        $condition[‘geval_goodsid‘] = $goods_id;

        }

        switch ($type) {

            case ‘1‘:

                $condition[‘geval_scores‘] = array(‘in‘, ‘5,4‘);

                Tpl::output(‘type‘, ‘1‘);

                break;

            case ‘2‘:

                $condition[‘geval_scores‘] = array(‘in‘, ‘3,2‘);

                Tpl::output(‘type‘, ‘2‘);

                break;

            case ‘3‘:

                $condition[‘geval_scores‘] = array(‘in‘, ‘1‘);

                Tpl::output(‘type‘, ‘3‘);

                break;

        }


        //查询商品评分信息

        $model_evaluate_goods = Model("evaluate_goods");

        $goodsevallist = $model_evaluate_goods->getEvaluateGoodsList($condition, $page);

        Tpl::output(‘goodsevallist‘,$goodsevallist);

        Tpl::output(‘show_page‘,$model_evaluate_goods->showpage(‘5‘));

    }

    

    /**

     * 销售记录

     */

    public function salelogOp() {

        $goods_id = intval($_GET[‘goods_id‘]);

        $order_class = Model(‘order‘);

        $sales = $order_class->getOrderAndOrderGoodsSalesRecordList(array(‘order_goods.goods_id‘=>$goods_id), ‘order_goods.*, order.buyer_name, order.add_time‘, 10);

        Tpl::output(‘show_page‘,$order_class->showpage());

        Tpl::output(‘sales‘,$sales);

        

        Tpl::output(‘order_type‘, array(2=>‘团‘, 3=>‘折‘, ‘4‘=>‘套装‘));

        Tpl::showpage(‘goods.salelog‘,‘null_layout‘);

    }


/**

* 产品咨询

*/

public function cosultingOp() {

$goods_id = intval($_GET[‘goods_id‘]);

if($goods_id <= 0){

showMessage(Language::get(‘wrong_argument‘),‘‘,‘html‘,‘error‘);

}

// 分页信息

$page = new Page();

$page->setEachNum(10);

$page->setStyle(‘admin‘);

//得到商品咨询信息

$consult = Model(‘consult‘);

$consult_list = $consult->getConsultList(array(‘goods_id‘=>$goods_id),$page,‘simple‘);

Tpl::output(‘consult_list‘,$consult_list);

Tpl::output(‘show_page‘, $page->show());

//检查是否为店主本身

$store_self = false;

        if(!empty($_SESSION[‘store_id‘])) {

            if (intval($_GET[‘store_id‘]) == $_SESSION[‘store_id‘]) {

                $store_self = true;

            }

        }

        //查询会员信息

        $member_info = array();

        $member_model = Model(‘member‘);

        if(!empty($_SESSION[‘member_id‘])) $member_info = $member_model->infoMember(array(‘member_id‘=>"{$_SESSION[‘member_id‘]}"));

//检查是否可以评论

        $consult_able = true;

        if((!$GLOBALS[‘setting_config‘][‘guest_comment‘] && !$_SESSION[‘member_id‘] ) || $store_self == true || ($_SESSION[‘member_id‘]>0 && $member_info[‘is_allowtalk‘] == 0)){

        $consult_able = false;

        }

        Tpl::output(‘nchash‘,substr(md5(SHOP_SITE_URL.$_GET[‘act‘].$_GET[‘op‘]),0,8));

        Tpl::output(‘consult_able‘,$consult_able);

Tpl::showpage(‘goods.cosulting‘, ‘null_layout‘);

}


/**

* 商品咨询添加

*/

public function save_consultajaxOp(){

//检查是否可以评论

        if(!C(‘guest_comment‘) && !$_SESSION[‘member_id‘]){

        echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘goods_index_goods_noallow‘)));

        die;

        }

$goods_id = intval($_GET[‘goods_id‘]);

if($goods_id <= 0){

echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘wrong_argument‘)));

        die;

}

//咨询内容的非空验证

if(trim($_GET[‘goods_content‘])== ""){

echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘goods_index_input_consult‘)));

        die;

}

$_POST = $_GET;

//表单验证

$result = chksubmit(true,C(‘captcha_status_goodsqa‘),‘num‘);

if (!$result){

   echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘invalid_request‘)));

   die;

}elseif ($result === -11){

       echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘invalid_request‘)));

       die;

   }elseif ($result === -12){

  echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘wrong_checkcode‘)));

      die;

   }

        if (processClass::islock(‘commit‘)){

        echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘nc_common_op_repeat‘)));

        die;

        }else{

        processClass::addprocess(‘commit‘);

        }

        if($_SESSION[‘member_id‘]){

       //查询会员信息

       $member_model = Model(‘member‘);

       $member_info = $member_model->infoMember(array(‘member_id‘=>"{$_SESSION[‘member_id‘]}"));

if(empty($member_info) || $member_info[‘is_allowtalk‘] == 0){

        echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘goods_index_goods_noallow‘)));

        die;

       }

        }

//判断商品编号的存在性和合法性

$goods = Model(‘goods‘);

$goods_info = array();

$goods_info = $goods->getGoodsInfo(array(‘goods_id‘=> $goods_id));

if(empty($goods_info)){

echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘goods_index_goods_not_exists‘)));

        die;

}

        //判断是否是店主本人

        if($_SESSION[‘store_id‘] && $goods_info[‘store_id‘] == $_SESSION[‘store_id‘]) {

            echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘goods_index_consult_store_error‘)));

        die;

        }

//检查店铺状态

$store_model = Model(‘store‘);

$store_info = $store_model->getStoreInfoByID($goods_info[‘store_id‘]);

if($store_info[‘store_state‘] == ‘0‘ || intval($store_info[‘store_state‘]) == ‘2‘ || (intval($store_info[‘store_end_time‘]) != 0 && $store_info[‘store_end_time‘] <= time())){

echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘goods_index_goods_store_closed‘)));

        die;

}

//接收数据并保存

$input = array();

$input[‘goods_id‘] = $goods_id;

$input[‘cgoods_name‘] = $goods_info[‘goods_name‘];

$input[‘member_id‘] = intval($_SESSION[‘member_id‘]) > 0?$_SESSION[‘member_id‘]:0;

$input[‘cmember_name‘] = $_SESSION[‘member_name‘]?$_SESSION[‘member_name‘]:‘‘;

$input[‘store_id‘] = $store_info[‘store_id‘];

$input[‘email‘] = $_GET[‘email‘];

if (strtoupper(CHARSET) == ‘GBK‘) {

$input[‘consult_content‘] = Language::getGBK($_GET[‘goods_content‘]);

}else{

$input[‘consult_content‘] = $_GET[‘goods_content‘];

}

$input[‘isanonymous‘] = $_GET[‘hide_name‘]==‘hide‘?1:0;

$consult_model = Model(‘consult‘);

if($consult_model->addConsult($input)){

echo json_encode(array(‘done‘=>‘true‘));

        die; 

}else{

echo json_encode(array(‘done‘=>‘false‘,‘msg‘=>Language::get(‘goods_index_consult_fail‘)));

        die; 

}

}

    

    /**

     * 异步显示优惠套装

     */

    public function get_bundlingOp() {

        $goods_id = intval($_GET[‘goods_id‘]);

        $store_id = intval($_GET[‘store_id‘]);

        if ($goods_id <= 0 || $store_id <= 0) {

            exit();

        }

        $model_bundling = Model(‘p_bundling‘);

        

        // 更新优惠套装状态

        $model_bundling->editBundlingTimeout(array(‘store_id‘ => $store_id));

        

        // 查询店铺套餐活动是否开启

        $quota_list = $model_bundling->getBundlingQuotaOpenList(array(‘store_id‘ => $store_id), 0, 1);

        if (!empty($quota_list)) {

            // 根据商品id查询bl_id

            $b_g_list = $model_bundling->getBundlingGoodsList(array(‘goods_id‘ => $goods_id, ‘bl_appoint‘ => 1), ‘bl_id‘);

            if (!empty($b_g_list) && is_array($b_g_list)) {

                $b_id_array = array();

                foreach ($b_g_list as $val) {

                    $b_id_array[] = $val[‘bl_id‘];

                }

                

                // 查询套餐列表

                $bundling_list = $model_bundling->getBundlingOpenList(array(‘bl_id‘ => array(‘in‘, $b_id_array)));

                // 整理

                if (!empty($bundling_list) && is_array($bundling_list)) {

                    $bundling_array = array();

                    foreach ($bundling_list as $val) {

                        $bundling_array[$val[‘bl_id‘]][‘id‘] = $val[‘bl_id‘];

                        $bundling_array[$val[‘bl_id‘]][‘name‘] = $val[‘bl_name‘];

                        $bundling_array[$val[‘bl_id‘]][‘cost_price‘] = 0;

                        $bundling_array[$val[‘bl_id‘]][‘price‘] = $val[‘bl_discount_price‘];

                        $bundling_array[$val[‘bl_id‘]][‘freight‘] = $val[‘bl_freight‘];

                    }

                    $blid_array = array_keys($bundling_array);

                    

                    $b_goods_list = $model_bundling->getBundlingGoodsList(array(‘bl_id‘ => array(‘in‘, $blid_array)));

                    if (!empty($b_goods_list)) {

                        $goodsid_array = array();

                        foreach ($b_goods_list as $val) {

                            $goodsid_array[] = $val[‘goods_id‘];

                        }

                        $goods_list = Model(‘goods‘)->getGoodsAsGoodsShowList(array(‘goods_id‘ => array(‘in‘, $goodsid_array)), ‘goods_id,goods_name,goods_price,goods_image‘);

                        $goods_list = array_under_reset($goods_list, ‘goods_id‘);

                    }

                    // 整理

                    if (! empty ( $b_goods_list ) && is_array ( $b_goods_list )) {

                        $b_goods_array = array ();

                        foreach ( $b_goods_list as $val ) {

                            if (isset($goods_list[$val[‘goods_id‘]])) {

                                $k = (intval($val[‘goods_id‘]) == $goods_id) ? 0 : $val[‘goods_id‘];    // 排序当前商品放到最前面

                                $b_goods_array[$val[‘bl_id‘]][$k][‘id‘] = $val[‘goods_id‘];

                                $b_goods_array[$val[‘bl_id‘]][$k][‘image‘] = thumb($goods_list[$val[‘goods_id‘]], 240);

                                $b_goods_array[$val[‘bl_id‘]][$k][‘name‘] = $goods_list[$val[‘goods_id‘]][‘goods_name‘];

                                $b_goods_array[$val[‘bl_id‘]][$k][‘shop_price‘] = ncPriceFormat($goods_list[$val[‘goods_id‘]][‘goods_price‘]);

                                $b_goods_array[$val[‘bl_id‘]][$k][‘price‘] = ncPriceFormat($val[‘bl_goods_price‘]);

                                $bundling_array[$val[‘bl_id‘]][‘cost_price‘] += ncPriceFormat($goods_list[$val[‘goods_id‘]][‘goods_price‘]);

                            }

                        }

                    }

                    Tpl::output(‘bundling_array‘, $bundling_array);

                    Tpl::output(‘b_goods_array‘, $b_goods_array);

                }

            }

        }

        Tpl::showpage(‘goods_bundling‘, ‘null_layout‘);

    }


/**

* 商品详细页运费显示

*

* @return unknown

*/

function calcOp(){

if (!is_numeric($_GET[‘id‘]) || !is_numeric($_GET[‘tid‘])) return false;


$model_transport = Model(‘transport‘);

$extend = $model_transport->getExtendList(array(‘transport_id‘=>array(intval($_GET[‘tid‘]))));

if (!empty($extend) && is_array($extend)){

$calc = array();

$calc_default = array();

foreach ($extend as $v) {

if (strpos($v[‘top_area_id‘],",".intval($_GET[‘id‘]).",") !== false){

$calc = $v[‘sprice‘];

}

if ($v[‘is_default‘]==1){

$calc_default = $v[‘sprice‘];

}

}

//如果运费模板中没有指定该地区,取默认运费

if (empty($calc) && !empty($calc_default)){

$calc = $calc_default;

}

}

echo json_encode($calc);

}


/**

* 异步添加足迹

*

* @return unknown

*/

function addbrowseOp(){

        $goods_id = intval($_GET[‘gid‘]);

        

        // 商品详细信息

        $model_goods = Model(‘goods‘);

        $goods_detail = $model_goods->getGoodsDetail($goods_id, ‘*‘);

        $goods_info = $goods_detail[‘goods_info‘];

        // 检查是否为店主本人

        $store_self = false;

        if (!empty($_SESSION[‘store_id‘])) {

            if ($goods_info[‘store_id‘] == $_SESSION[‘store_id‘]) {

                $store_self = true;

            }

        }

if ($store_self == false){

$model_goodsbrowse = Model(‘goodsbrowse‘);

$goods_browse = $model_goodsbrowse->getGoodsBrowseInfo(array(‘goods_id‘ => $goods_info[‘goods_id‘], ‘member_id‘ => $_SESSION[‘member_id‘]));

if (!empty($goods_browse)) {

$goods_id = $goods_info[‘goods_id‘];

$member_id = $_SESSION[‘member_id‘];

$update = array ();

$update[‘browsetime‘]   = TIMESTAMP;

$update[‘gc_id‘]        = $goods_info[‘gc_id‘];

$update[‘gc_id_1‘]      = $goods_info[‘gc_id_1‘];//一级分类id

$update[‘gc_id_2‘]      = $goods_info[‘gc_id_2‘];//二级分类id

$update[‘gc_id_3‘]      = $goods_info[‘gc_id_3‘];//三级分类id

$model_goodsbrowse->updateGoodsbrowse($update, array(‘goods_id‘ => $goods_id,‘member_id‘ => $_SESSION[‘member_id‘]));

} else {

$insert = array();

$insert[‘goods_id‘]     = $goods_info[‘goods_id‘];

$insert[‘member_id‘]    = $_SESSION[‘member_id‘];

$insert[‘browsetime‘]   = TIMESTAMP;

$insert[‘gc_id‘]        = $goods_info[‘gc_id‘];

$insert[‘gc_id_1‘]      = $goods_info[‘gc_id_1‘];//一级分类id

$insert[‘gc_id_2‘]      = $goods_info[‘gc_id_2‘];//二级分类id

$insert[‘gc_id_3‘]      = $goods_info[‘gc_id_3‘];//三级分类id

$model_goodsbrowse->addGoodsbrowse($insert);

$this->addGoodsbrowse($goods_info);

}

}

}

/**

* 生成浏览过产品cookie

*

* @return unknown

*/

function addGoodsbrowse($goods_info){

// 生成浏览过产品

        $cookievalue = $goods_info[‘goods_id‘] . ‘-‘ . $goods_info [‘store_id‘];

        if (cookie(‘viewed_goods‘)) {

            $string_viewed_goods = decrypt(cookie(‘viewed_goods‘), MD5_KEY);

            if (get_magic_quotes_gpc()) {

                $string_viewed_goods = stripslashes($string_viewed_goods); // 去除斜杠

            }

            $vg_ca = @unserialize($string_viewed_goods);

            $sign = true;

            if ( !empty($vg_ca) && is_array($vg_ca)) {

                foreach ($vg_ca as $vk => $vv) {

                    if ($vv == $cookievalue) {

                        $sign = false;

                    }

                }

            } else {

                $vg_ca = array();

            }

            

            if ($sign) {

                if (count($vg_ca) >= 6) {

                    $vg_ca[] = $cookievalue;

                    array_shift($vg_ca);

                } else {

                    $vg_ca[] = $cookievalue;

                }

            }

        } else {

            $vg_ca[] = $cookievalue;

        }

        $vg_ca = encrypt(serialize($vg_ca), MD5_KEY);

        setNcCookie(‘viewed_goods‘, $vg_ca);

}

}



前台:


<script type="text/javascript">

$(document).ready(function(){

$.ajax({

type: "POST",

url: "index.php?act=goods&op=getinfo&t=<?php echo time();?>",

dataType: "json",

//async:false,  

cache:false, 

data: {goods_id: <?php echo $output[‘goods‘][‘goods_id‘];?>,pmemberid: <?php echo $output[‘pmemberid‘]?$output[‘pmemberid‘]:0;?>},

success: function(myObject){

console.log(myObject);

//var myObject = JSON.parse(mydatas);

//console.log(myObject);

var str=‘‘;

//str +="<div class=\"ncs-goods-summary\">";

str+=‘<div class="name">‘;

str+="<h1>"+myObject[‘goods‘][‘goods_name‘]+"</h1><span>"+myObject[‘goods‘][‘goods_jingle‘]+"</span> </div>";

str+=‘<div class="ncs-meta ncs-metab"><div class="erwei"></div><div class="erwei1"></div>‘;

str+=‘<div class="erweiquan"><img old="‘+myObject[‘resouce‘][‘image1‘]+‘" src="‘+myObject[‘resouce‘][‘image2‘]+‘" /></div><div class="price_coco"><dl><dt class="market-price">市&nbsp;场&nbsp;价:</dt>‘;

str+="<dd class=\"cost-price\"><span>&yen;"+myObject[‘goods‘][‘goods_marketprice‘]+"</span></dd></dl>";

if(myObject[‘distribute_price‘]){

str+="<dl><dt class=\"market-price\">分&nbsp;销&nbsp;价:</dt><dd><strong> &yen;"+myObject[‘distribute_price‘]+"</strong></dd></dl>";

}

     

      if(myObject[‘is_integrate_goods‘]){

      str+="<dl><dt class=\"market-price\" style=‘word-break:keep-all;white-space:nowrap;‘>兑 换 价:</dt><dd><strong>&yen;"+myObject[‘goods‘][‘integrate_price‘]+" </strong></dd><dd><strong> <div class=‘integrate‘ ><span style=\"margin:25px\"> "+myObject[‘goods‘][‘goods_integrate‘]+"</span></div></strong></dd></dl>";

}

if(!myObject[‘goods‘][‘has_fx‘]){

str+=‘<dl><dt class="mall-price">商&nbsp;城&nbsp;价:</dt><dd class="price">‘;

if(myObject[‘goods‘][‘promotion_type‘] == ‘groupbuy‘ && !myObject[‘distribute_price‘]){

str+="<span class=\"tag\">团购</span><strong id=\"groups\">&yen;"+myObject[‘goods‘][‘promotion_price‘]+"</strong>";

}else if(myObject[‘goods‘][‘promotion_type‘] == ‘xianshi‘){

if(myObject[‘goods_detail‘][‘xianshi_info‘][‘xianshi_title‘]!= ‘‘){

str+="<span class=\"tag\">"+myObject[‘goods_detail‘][‘xianshi_info‘][‘xianshi_title‘]+"</span>";

}

str+="<strong>&yen;"+myObject[‘goods‘][‘promotion_price‘]+"</strong>";

}else{

str+="<strong>&yen;</strong> <strong class=\"big_coco\">"+myObject[‘goods‘][‘goods_price‘]+"</strong>";

}

str+=" (节省¥"+myObject[‘jiesheng‘]+")</dd></dl>";

}

if(myObject[‘goods‘][‘has_fx‘]){

str+="<dl><dt><font color=\"red\">分 销 价:</font></dt><dd class=\"price\"><strong id=\"fx\"> &yen;"+myObject[‘goods‘][‘fx_price‘]+"</strong></dd></dl>";

}

str+="</div>";

str+="<div class=\"price_right\"><ul><li class=\"price_line\">销售记录<br/><strong class=\"red_font\"> "+myObject[‘sales_num‘]+"</strong></li>";

str+="<li>累计评价<br/><strong class=\"red_font\"><a class=\"red_font\" href=\"#ncGoodsRate\" >"+myObject[‘goods_evaluate_info‘][‘all‘]+"</a></strong></li></ul></div></div>";

str+="<div class=\"ncs-metaf\">";

if(myObject[‘goods‘][‘promotion_type‘] == ‘xianshi‘){

str+="<dl class=\"ncs-sell\"><dt>促销信息:</dt><dd class=\"promotion-info\">直降:&yen;"+myObject[‘goods‘][‘down_price‘]+"<em>";

if(myObject[‘goods‘][‘lower_limit‘]){

str+=""+myObject[‘goods‘][‘lower_limit‘]+"";

}

str+="</em><span>"+myObject[‘goods_detail‘][‘xianshi_info‘][‘xianshi_explain‘]+"</span> </dd></dl>";

}

if(myObject[‘goods‘][‘promotion_type‘] == ‘groupbuy‘){

str+="<dl class=\"ncs-sell\"><dt>促销信息:</dt><dd class=\"promotion-info\"><em>";

if(myObject[‘goods‘][‘upper_limit‘]){

str+=""+myObject[‘goods‘][‘upper_limit‘]+"";

}

str+="</em><span>"+myObject[‘goods‘][‘remark‘]+"</span> </dd></dl>";

}

str+="</div>";

if(!myObject[‘distribute_price‘]){

str+="<div class=\"ncs-metaf\">";

if(myObject[‘goods‘][‘is_gv‘]!= 1){

str+="<dl class=\"ncs-freight\"><dt class=\"freight-dt\">";

if(myObject[‘goods‘][‘goods_transfee_charge‘]==1){

str+="运&#12288;&#12288;费:";

}else{

if(myObject[‘goods‘][‘transport_id‘]){

str+="至<a href=\"javascript:void(0)\" id=\"ncrecive\">全国</a>:<div class=\"ncs-freight-box\" id=\"transport_pannel\">";

if(myObject[‘area_list‘]){

$.each(myObject[‘area_list‘],function(s,t){

str+="<a href=\"javascript:void(0)\" nctype="+s+">"+t+"</a>";

});

}

str+="</div>";

}else{

str+="至&#12288;全国:";

}

}

str+="</dt>";

str+="<dd id=\"transport_price\" class=\"price01\">";

if(myObject[‘group‘]){

str+="<span>团购商品免邮费</span>";

}else{

if(myObject[‘goods‘][‘goods_freight‘] == 0){

str+="             卖家承担运费";

}else{

str+="<span>运费:<em id=\"nc_kd\">"+myObject[‘goods‘][‘goods_freight‘]+"</em>元</span>";

}

}

str+="</dd>";

str+="<dd>有货</dd><dd class=\"red_font\">(预计最早3日到达)</dd><dd style=\"color:red;display:none\" id=\"loading_price\">loading.....</dd></dl>";

}

str+="</div>";

}

if(myObject[‘goods‘][‘goods_state‘]== 1 && myObject[‘goods‘][‘goods_verify‘]== 1){

str+="<div class=\"ncs-key\">";

if(myObject[‘goods‘][‘is_gv‘]== 1){

str+="<dl><dt>提货方式:</dt><dd><ul><li class=\"sp-txt\"><a href=\"javascript:void(0)\" class=\"hovered\">电子兑换券<i></i></a></li></ul></dd></dl>";

str+="<dl><dt>有&nbsp;效&nbsp;期:</dt><dd>即日起 到 "+myObject[‘goods‘][‘g_vindate‘]+"</dd></dl>";

}

if(myObject[‘goods‘][‘spec_name‘]){

$.each(myObject[‘goods‘][‘spec_name‘],function(key,val){

       str+=" <dl nctype=\"nc-spec\"><dt>"+val+":</dt><dd>";

       if(myObject[‘goods‘][‘spec_value‘][key] ){

        str+="<ul nctyle=\"ul_sign\">";

        $.each(myObject[‘goods‘][‘spec_value‘][key],function(k,v){

        if(key==1){

        if(myObject[‘goods‘][‘goods_spec‘][k]){

        str+="<li class=\"sp-img\"><a href=\"javascript:void(0);\" class=\"hovered\" data-param=\"{valid:"+k+"}\" title=\""+v+"\">";

        }else{

        str+="<li class=\"sp-img\"><a href=\"javascript:void(0);\"  data-param=\"{valid:"+k+"}\" title=\""+v+"\">";

        }

        str+="<img src=\""+myObject[‘goods_detail‘][‘spec_image‘][k]+"\"/><i></i></a></li>";

       

        }else{

        if(myObject[‘goods‘][‘goods_spec‘][k]){

        str+="<li class=\"sp-txt\"><a href=\"javascript:void(0)\" class=\"hovered\" data-param=\"{valid:"+k+"}\">"+v+"<i></i></a></li>";

        }else{

        str+="<li class=\"sp-txt\"><a href=\"javascript:void(0)\"  data-param=\"{valid:"+k+"}\">"+v+"<i></i></a></li>";

        }

       

        }

        });

        str+="</ul>";

       }

       str+="</dd></dl>";

       

       

   });

}

str+="<dl><dt>购买数量:</dt><dd class=\"ncs-figure-input\"><input type=\"text\" name=\"\" id=\"quantity\" value=\"1\" size=\"3\" maxlength=\"6\" class=\"text w30\"><a href=\"javascript:void(0)\" class=\"increase\">+</a><a href=\"javascript:void(0)\" class=\"decrease\">-</a> <em>";

if(myObject[‘goods‘][‘is_gv‘]== 1){

str+="每人限购<strong>"+myObject[‘goods‘][‘g_vlimit‘]+"</strong>";

}

str+="件&nbsp;&nbsp;&nbsp;(当前库存<strong nctype=\"goods_stock\">"+myObject[‘goods‘][‘goods_storage‘]+"</strong>件) </em> </dd></dl>";

str+="<div class=\"ncs-btn\"><a href=\" ";

if(myObject[‘goods‘][‘goods_fromurl‘]){

str+=""+myObject[‘goods‘][‘goods_fromurl‘] +"";

}else{

str+="javascript:void(0);";

}

str+="\"";

if(myObject[‘goods‘][‘goods_fromurl‘]){

str+="target=\"_blank\"";

}else{

str+="nctype=\"buynow_submit\"";

}

if(myObject[‘goods‘][‘goods_storage‘] <= 0){

str+="class=\"buynow  no-buynow\"";

}else{

str+="class=\"buynow\"";

}

str+=" title=‘立即购买‘>立即购买</a>";

if(myObject[‘goods‘][‘promotion_type‘] != ‘groupbuy‘ &&  !myObject[‘goods‘][‘goods_fromurl‘]){

if(!myObject[‘distribute_price‘]){

if(!myObject[‘pmemberid‘]){

//str+="<a  href=\"javascript:void(0);\" nctype=\"addcart_submit\"  class=\"addcart ";

if(myObject[‘goods‘][‘goods_storage‘]<=0){

str+="   <a href=\"javascript:void(0);\" nctype=\"addcart_submit\"  class=\"addcart no-addcart \" title=\"添加购物车\">  添加购物车</a>";

}else{

str+="   <a href=\"javascript:void(0);\" nctype=\"addcart_submit\"  class=\"addcart\" title=\"添加购物车\">  添加购物车</a>";

}

//str+=" title=\"添加购物车\"> 添加购物车</a>";

}

}

}

       

str+=" <div class=\"ncs-cart-popup\"> <dl><dt>成功添加到购物车<a title=\"关闭\" onClick=\"$(‘.ncs-cart-popup‘).css({‘display‘:‘none‘});\">X</a></dt>";

str+="<dd>购物车共有<strong id=\"bold_num\"></strong>种商品 总金额为:<em id=\"bold_mly\" class=\"saleP\"></em></dd><dd class=\"btns\">";

str+="<a href=\"javascript:void(0);\" class=\"ncs-btn-mini ncs-btn-green\" onClick=\"location.href=‘"+SHOP_SITE_URL+"/index.php?act=cart‘\">查看购物车</a><a href=\"javascript:void(0);\" class=\"ncs-btn-mini\" value=\"\" onClick=\"$(‘.ncs-cart-popup‘).css({‘display‘:‘none‘});\">继续购物</a></dd></dl></div>";

str+="</div>";

str+=" <div class=\"ncs_share\"><a href=\"javascript:void(0);\" nc_type=\"sharegoods\" data-param=‘{\"gid\":\""+myObject[‘goods‘][‘goods_id‘]+"\"}‘><i class=\"icon-share\"></i>分享 <em nc_type=\"sharecount_"+myObject[‘goods‘][‘goods_id‘]+"\">";

if(myObject[‘goods‘][‘sharenum‘]>0){

str+=""+parseInt(myObject[‘goods‘][‘sharenum‘])+"";

}else{

str+="0";

}

str+="</em></a>";

str+="<a href=\"javascript:collect_goods(‘"+myObject[‘goods‘][‘goods_id‘]+"‘,‘count‘,‘goods_collect‘);\"><i class=\"icon-star-empty\"></i>收藏商品<em nctype=\"goods_collect\">"+myObject[‘goods‘][‘goods_collect‘]+"</em></a></div>";

str+="</div>";

     

}else{

str+="<div class=\"ncs-saleout\"><dl><dt><i class=\"icon-info-sign\"></i>商品已下架</dt><dd>1.&nbsp;请联系卖家咨询</dd><dd>2.&nbsp;逛逛&nbsp;<a href=\"<?php echo urlShop(‘show_store‘, ‘index‘, array(‘store_id‘=>$output[‘goods‘][‘store_id‘]), $output[‘store_info‘][‘store_domain‘]);?>\" class=\"ncs-btn-mini\">商家店铺</a>&nbsp;选择其他商品 </dd></dl></div>";

}

//str+="</div>";

$(".ncs-goods-summary").html(str);

afterLoad(); 

afterLoad2();

//alert(str);

},

error: function(){

}

});

});



</script>


IE浏览器中 $.ajax返回uindefined 其他浏览器正常

标签:ie浏览器   ajax   

原文地址:http://5361806.blog.51cto.com/5351806/1713089

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!