예제 #1
0
 /**
  * 首页显示
  * 
  */
 function _showIndex()
 {
     /*添加验证信息(登录时的csrf验证)*/
     include "seride.php";
     $Seride = new Seride();
     $this->output('seride_form', $Seride->seride_form());
     /*侧边商品分类显示*/
     $class_array = $this->obj_goods_class->getClassSort();
     $this->output('class_array', $class_array);
     /*最新商品*/
     $new_product = $this->obj_product->getProductSpecific(array('goods_state' => 1), $this->_viewinfo['websit']['index_new_num']);
     $this->output('new_product', $new_product);
     /*推荐商品*/
     $commend_product = $this->obj_product->getProductSpecific(array('goods_state' => 1, 'goods_commend' => 1), $this->_viewinfo['websit']['index_commend_num']);
     $this->output('commend_product', $commend_product);
     /*热卖商品*/
     $hot_product = $this->obj_product->getProductSpecific(array('goods_state' => 1, 'goods_hot' => 1), $this->_viewinfo['websit']['index_hot_num']);
     $this->output('hot_product', $hot_product);
     /*特价商品*/
     $spe_product = $this->obj_product->getProductSpecific(array('goods_state' => 1, 'goods_special' => 1), $this->_viewinfo['websit']['index_spe_num']);
     $this->output('spe_product', $spe_product);
     /*投票*/
     $vote_array[1] = $this->obj_vote->getVote();
     $vote_array[0] = array('title' => $vote_array[1][0]['vote_title'], 'vote_id' => $vote_array[1][0]['vote_id'], 'vote_type' => $vote_array[1][0]['vote_type']);
     $this->output('vote_array', $vote_array);
     /*商品品牌*/
     $brand_array = $this->obj_brand->getBrandList(array('show_type' => 'class_show', 'limit_num' => $this->_viewinfo['websit']['index_brand_num']));
     $this->output('brand_array', $brand_array);
     /*商品主题*/
     $subject_array = $this->obj_goods_subject->getSubjectAll(array('subject_state' => '1', 'limit_num' => $this->_viewinfo['websit']['index_subject_num']));
     $this->output("subject_array", $subject_array);
     /*公告*/
     $notice_array = $this->obj_show_article->getArticle(array('notice' => 1, 'class_id' => 1, 'article_num' => $this->_viewinfo['websit']['index_notice_num']));
     $this->output('notice_array', $notice_array);
     /*访问统计*/
     $ip_num = $this->obj_visit->getVisitList(array(), '*', "", "ip");
     $this->output("ip_num", count($ip_num) ? count($ip_num) : '0');
     /*ip总量*/
     /*广告*/
     $ad_array = $this->obj_tool_ad->getAdInfo(array('shop_id' => NC_SHOP_ID));
     $ad_array['ad_body'] = unserialize($ad_array['ad_body']);
     $pic_array = array();
     $i = 0;
     if (is_array($ad_array['ad_body']) and count($ad_array['ad_body']) > 0) {
         foreach ($ad_array['ad_body'] as $ad) {
             /*大图片路径*/
             $big_pic = explode("/", $ad);
             $b_pic = explode(".", $big_pic[3]);
             $pic_array[$i]['big'] = $big_pic[1] . "/" . $big_pic[2] . "/" . $b_pic[0];
             /*小图片路径*/
             $small_pic = explode(".", $ad);
             $pic_array[$i]['small'] = $small_pic[0] . "_small." . $small_pic[1];
             $pic_array[$i]['ad_info'] = $ad_array['ad_body']['ad_info'][$i];
             $i++;
         }
     }
     unset($pic_array[5]);
     /*url*/
     $ad_array['ad_url'] = unserialize($ad_array['ad_url']);
     for ($j = 0; $j < 5; $j++) {
         $pic_array[$j]['url'] = $ad_array['ad_url'][$j];
     }
     $this->output('pic_array', $pic_array);
     $this->output('ad_array', $ad_array);
     /*友情链接*/
     $link_image = $this->obj_link->getLinkList(array('link_logo' => 1), '', 'link_web_name,link_url,link_logo,link_logo_width,link_logo_height');
     $this->output('link_image', $link_image);
     $link_text = $this->obj_link->getLinkList(array('link_logo' => 2), '', 'link_web_name,link_url');
     $this->output('text_link_num', count($link_text));
     $this->output('link_text', $link_text);
     $this->showpage("index");
 }
예제 #2
0
파일: product.php 프로젝트: jn7163/ShopNC
 /**
  * 产品显示页面
  * 
  */
 private function product()
 {
     require_once "shopGoods.class.php";
     $obj_shop_goods = new ShopGoodsClass();
     /*当前产品信息*/
     $condition['goods_id'] = intval($this->_input['id']);
     if ($condition['goods_id'] == 0) {
         header("Location:index.php");
         exit;
     }
     $condition['no_state'] = 1;
     $product_array = $this->obj_product->getProductInfo($condition);
     /*产品颜色,产品规格*/
     $c_array = @explode('|', $product_array['goods_color']);
     $s_array = @explode('|', $product_array['goods_size']);
     $color_select = $product_array['goods_color'] != '' ? Common::Select('goods_color', array_combine($c_array, $c_array)) : '';
     $size_select = $product_array['goods_size'] != '' ? Common::Select('goods_size', array_combine($s_array, $s_array)) : '';
     $this->output('color_select', $color_select);
     //颜色输出
     $this->output('size_select', $size_select);
     //规格输出
     /*产品多图*/
     require_once 'goods.class.php';
     $goods = new GoodsClass();
     if ($product_array['shop_goods_id'] != '') {
         $product_array['more_image'] = $goods->getGoodsImage($product_array['shop_goods_id']);
     } else {
         $product_array['more_image'] = $goods->getGoodsImage($product_array['goods_id']);
     }
     $this->output('more_image_num', count($product_array['more_image']) + 1);
     $this->output('product_array', $product_array);
     /*浏览量*/
     $goods_click = intval($product_array['goods_click']) + 1;
     $this->obj_goods->modifyGoods($goods_click, $condition['goods_id'], "goods_click");
     /*推荐产品*/
     $commend_array = $this->obj_product->getProductSpecific(array('goods_commend' => 1, 'goods_state' => 1));
     $this->output('commend_array', $commend_array);
     /*产品属性*/
     $goods_attr_body = @unserialize($product_array['goods_attr_body']);
     //商品内的属性
     include 'goodsClass.class.php';
     //载入产品分类文件
     $goods_class = new GoodsClassClass();
     $goods_type_id = $goods_class->getGoodsClassInfo(array('class_id' => $product_array['class_id']), 'goods_type_id,class_other_attr');
     if ($goods_type_id[0] != '') {
         include 'goodsType.class.php';
         $goods_type = new GoodsTypeClass();
         $type_array = $goods_type->getTypeInfo(array('goods_type_id' => $goods_type_id[0]));
         /*判断商品类型状态,如果关闭则不执行*/
         if ($type_array['goods_type_state'] == 1) {
             $attr_array = $goods_type->goodsAttrArray(array('txt_goods_type_id' => $type_array['goods_type_id']));
             $goods_attr = array();
             $i = 0;
             foreach ($attr_array as $val) {
                 if (!empty($goods_attr_body['class_attr'][$val['attribute_id']])) {
                     $goods_attr[$i]['title'] = $val['attribute_name'];
                     $goods_attr[$i]['vaule'] = $goods_attr_body['class_attr'][$val['attribute_id']];
                     $i++;
                 }
             }
             $this->output('goods_attr', $goods_attr);
         }
     }
     /*产品所在分类独有属性*/
     if (is_array($goods_type_id['class_other_attr']) and count($goods_type_id['class_other_attr']) > 0) {
         $goods_other_attr = array();
         foreach ($goods_type_id['class_other_attr'] as $key => $value) {
             if (!empty($goods_attr_body['class_other_attr'][$key])) {
                 $goods_other_attr[] = array('attr_name' => $value, 'attr_value' => $goods_attr_body['class_other_attr'][$key]);
             }
         }
     }
     $this->output('goods_other_attr', $goods_other_attr);
     /*相关商品*/
     if ($product_array['goods_link_goods'] != '') {
         if (intval($product_array['shop_goods_id']) == 0) {
             $goods_link_goods = $this->obj_goods->ajaxGoodsSearch(array('goods_id_str' => $product_array['goods_link_goods'], 'other_action' => 'modify_link'), '*');
         }
         $this->output('goods_link_goods', $goods_link_goods);
     }
     /*相关文章*/
     if ($product_array['goods_link_article'] != '') {
         include 'article.class.php';
         $article = new ArticleClass();
         $goods_link_article = $article->ajaxArticleSearch(array('article_id_str' => $product_array['goods_link_article'], 'other_action' => 'modify_link'));
         $this->output('goods_link_article', $goods_link_article);
     }
     /*产品导航条*/
     include BasePath . "/share/" . NC_SHOP_DIR . "goods_class_show.php";
     $array = array();
     foreach ($node_cache as $k => $v) {
         if ($v[0] == intval($product_array['class_id'])) {
             $array['class_id'] = $v[0];
             $array['class_top_id'] = $v[1];
             $array['key_id'] = $k;
             break;
         }
     }
     $class_menu = $this->obj_product_class->prductClassMenu($array);
     $this->output('class_menu', $class_menu);
     /*评论列表*/
     require_once "commonpage.class.php";
     $obj_page = new CommonPage();
     $obj_page->pagebarnum(10);
     $conditon_array = array('goods_id' => $condition['goods_id']);
     $comment_array = $this->obj_comment->getGoodsCommentList($conditon_array, $obj_page);
     $show_page = $obj_page->show(3);
     $this->output('comment_array', $comment_array);
     $this->output('show_page', $show_page);
     /*侧边商品分类显示*/
     $class_array = $goods_class->getClassSort();
     $this->output('class_array', $class_array);
     /*商品品牌*/
     $brand_array = $this->obj_brand->getBrandList(array('show_type' => 'class_show'));
     $this->output('brand_array', $brand_array);
     /*当前类热卖商品*/
     $hot_array = $this->obj_product_class->productClassList($array, '', 'goods.goods_name,goods.goods_id,goods.shop_goods_id', '', ' order by goods.goods_click desc', 8);
     $this->output('hot_array', $hot_array);
     /*浏览过的商品*/
     if ($this->getCookies('c_product_viewed') != '') {
         $view_goods_array = $this->obj_product_class->productClassList(array('c_product_viewed' => $this->getCookies('c_product_viewed')), '', 'goods.goods_name,goods.goods_id,goods.goods_small_image,shop_goods_id');
         $this->output('view_goods_array', $view_goods_array);
     }
     /*添加该商品到cookie,浏览商品*/
     $this->setReviewed(intval($this->_input['id']));
     $this->showpage("product");
 }