/** * 对支付返回结果的处理 * */ private function modifyParment() { if (intval($this->_input['nc_order_serial']) == 0) { return false; } /*订单信息*/ $order_info = $this->obj_shop_order->getOrderInfo(array('order_serial' => "'" . trim($_GET['nc_order_serial']) . "'")); if (!$order_info) { $this->showMessage($this->_lang['shopping_order_error'], $this->_configinfo['websit']['site_url'], 1, 1000); } /*调出支付系统的相关内容*/ $pay_type = $this->obj_module_pay->getPayInfo(array('pay_id' => intval($this->_input['shopnccode']))); if (file_exists("api/payarea/" . $pay_type['pay_area_directory'] . "/" . $pay_type['pay_code'] . ".php")) { include_once "api/payarea/" . $pay_type['pay_area_directory'] . "/" . $pay_type['pay_code'] . ".php"; $pay_class_name = $pay_type['pay_code'] . 'PayClass'; $out_pay_type = new $pay_class_name(); $result = $out_pay_type->getParmentDo($order_info, $pay_type); } if (!$result) { include_once "order.class.php"; $goods_order = new OrderClass(); include_once 'goods.class.php'; $obj_goods = new GoodsClass(); include "system.class.php"; $email_template = new SystemClass(); include 'shopGoods.class.php'; $obj_shop_goods = new ShopGoodsClass(); include "shopsOrder.class.php"; $goods_shop_order = new ShopsOrderClass(); /*订单已确认*/ $goods_order->orderState(array('action_type' => 'conf_ok', 'order_state' => 1), $order_info['order_id']); /*订单已支付*/ $goods_order->orderState(array('action_type' => 'pay_ok', 'online_pay' => 1), $order_info['order_id']); /*以下为虚拟卡自动发货处理*/ $order_array = $goods_order->showGoodsOrder(array('detail_order_id' => $order_info['order_id'])); if (is_array($order_array)) { /*判断虚拟卡库存是否不足*/ $if_storage = true; foreach ($order_array as $k => $v) { /*如果虚拟卡库存足够,取出符合条件的虚拟卡信息*/ if ($v['goods_type'] == 2 && $v['is_send'] == '0') { /*虚拟卡库存*/ if ($this->_configinfo['websit']['pay_receive_type'] == 1) { //子店商品库存 $virtual_card_array = $this->obj_product->getProductInfo(array('goods_id' => $v['goods_id']), 'goods_storage'); $virtual_goods_storage = $virtual_card_array['goods_storage']; $sale_goods_id = $v['sale_goods_id']; } else { //主店商品库存 $shop_goods_array = $this->obj_product->getProductInfo(array('goods_id' => $v['goods_id']), 'shop_goods_id'); $virtual_goods_storage = $obj_shop_goods->getShopVirtualCardStorage($shop_goods_array['shop_goods_id']); $sale_goods_id = $shop_goods_array['shop_goods_id']; } if ($v['goods_count'] > $virtual_goods_storage) { /*库存不足*/ $if_storage = false; } else { /*取出本次要出售的虚拟卡*/ $virtual_card_array = array(); $condition = array(); $condition['goods_id'] = $sale_goods_id; $condition['is_sell'] = '0'; $virtual_card_array = $this->obj_virtual_card->getShopVirtualCardList($condition, '', array(), array(), '*', $v['goods_count']); /*更新虚拟卡状态*/ $condition_str = ''; foreach ($virtual_card_array as $vv) { $condition_str .= $vv['card_id'] . ','; } $condition_str = ' card_id in (' . trim($condition_str, ',') . ')'; $input_value = array(); $input_value['is_sell'] = '1'; $input_value['order_serial'] = trim($_GET['nc_order_serial']); $this->obj_virtual_card->updateVirtualCardState($input_value, $condition_str); /*更新订单虚拟卡商品发货状态*/ if ($this->_configinfo['websit']['pay_receive_type'] == 1) { $goods_order->updateOrderDetailState(array('is_send' => '1'), $v['order_detail_id']); } else { $goods_shop_order->updateOrderDetailState(array('is_send' => '1'), $v['order_detail_id']); } /*更新库存*/ if ($this->_configinfo['websit']['pay_receive_type'] == 1) { $obj_goods->modifyGoods(array('goods_storage' => 'goods_storage-' . $v['goods_count']), $sale_goods_id, 'formula'); } else { $obj_shop_goods->modifyGoods(array('goods_storage' => 'goods_storage-' . $v['goods_count']), $sale_goods_id, 'formula'); } /*邮件发货*/ if ($this->_configinfo['websit']['send_virtual_card_mail'] == '1') { $order_info['goods_name'] = $v['goods_name']; /*定义发货列表内容*/ $order_list_body = '<li>'; foreach ($virtual_card_array as $vv) { $order_list_body .= $this->_lang['shoping_virtual_card_number'] . $vv['card_number']; $order_list_body .= $this->_lang['shoping_virtual_card_password'] . $vv['password']; $order_list_body .= $this->_lang['shoping_virtual_card_end_time'] . $vv['end_time']; $order_list_body .= '</li>'; } $pay_email_template = $email_template->getEmailTemplate(array('mail_template_name' => "'send_virtual_card_mail'")); $pay_goods_array = array('user_name' => $order_info['receiver_name'], 'shop_name' => $this->_configinfo['websit']['site_name'], 'order_sn' => $order_info['order_serial'], 'goods_name' => $order_info['goods_name'], 'order_body' => $order_list_body, 'send_date' => date('Y-m-d', time())); $email_body = Common::replaceMailContent($pay_goods_array, $pay_email_template['mail_template_body']); /*发送邮件*/ Common::shopnc_send_mail($order_info['receiver_email'], $order_info['receiver_name'], $email_body); } } } } //如果订单只有虚拟卡,并且库存足够,即都已发货,更新订单状态为已发货 if ($order_info['order_type'] == 2 && $if_storage) { if ($this->_configinfo['websit']['pay_receive_type'] == 1) { $goods_order->orderState(array('action_type' => 'send_ok', 'order_state' => 1), $order_info['order_id']); } else { $goods_shop_order->orderState(array('action_type' => 'send_ok', 'order_state' => 1), $order_info['order_id']); } } } /*订单显示页面*/ /*订单产品*/ $order_goods = $goods_order->showGoodsOrder(array('detail_order_id' => $order_info['order_id'])); $this->output('order_goods', $order_goods); /*订单信息*/ $order_array = $goods_order->getOrderList(array('order_id' => $order_info['order_id']), ''); /*虚拟卡信息*/ if ($this->_configinfo['websit']['pay_receive_type'] == 1) { $virtual_card_array = $this->obj_virtual_card->getVirtualCardList(array('order_serial' => $order_array[0]['order_serial']), '', array('goods_id')); } else { $virtual_card_array = $this->obj_virtual_card->getShopVirtualCardList(array('order_serial' => $order_array[0]['order_serial']), '', array('goods_id')); } $this->output('virtual_card_array', $virtual_card_array); $this->getlang("user_center_my_order_view"); $order_state[1] = $this->_lang['my_order_be_confirmed']; //已确定 $order_state[0] = "<font color='red'>" . $this->_lang['my_order_unconfirmed'] . "</font>"; //未确定 $order_state1[1] = $this->_lang['my_order_have_paid']; //已付款 $order_state1[0] = "<font color='red'>" . $this->_lang['my_order_not_paid'] . "</font>"; //未付款 $order_state2[1] = $this->_lang['my_order_yes_send']; //已发货 $order_state2[0] = "<font color='red'>" . $this->_lang['my_order_no_send'] . "</font>"; //未发货 $order_state3[1] = $this->_lang['my_order_already_filled']; //已归档 $order_state3[0] = "<font color='red'>" . $this->_lang['my_order_no_fill'] . "</font>"; //为归档 $order_array[0]['order_state_txt'] = $order_state[$order_array[0]['order_state']]; $order_array[0]['order_state1_txt'] = $order_state1[$order_array[0]['order_state1']]; $order_array[0]['order_state2_txt'] = $order_state2[$order_array[0]['order_state2']]; $order_array[0]['order_state3_txt'] = $order_state3[$order_array[0]['order_state3']]; $this->output('order_array', $order_array[0]); $this->output('shopnc_pay_ok', '1'); $this->showpage('my_order_view'); /*发送邮件*/ if ($this->_configinfo['websit']['pay_mail'] == '1') { $pay_email_template = $email_template->getEmailTemplate(array('mail_template_name' => "'pay_mail'")); $pay_goods_array = array('user_name' => $order_array[0]['receiver_name'], 'shop_name' => $this->_configinfo['websit']['site_name'], 'order_sn' => $order_array[0]['order_serial']); $email_body = Common::replaceMailContent($pay_goods_array, $pay_email_template['mail_template_body']); /*发送邮件*/ Common::shopnc_send_mail($order_array[0]['receiver_email'], $order_array[0]['receiver_name'], $email_body); } } }
/** * 产品显示页面 * */ 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"); }
/** * 搜索结果列表 * */ private function SearchList() { $input_param = array(); $input_param['keywords'] = trim($this->_input['keywords']); //关键字 $input_param['start_price'] = intval($this->_input['start_price']); //开始价格 $input_param['end_price'] = intval($this->_input['end_price']); //结束价格 $input_param['all_sun'] = trim($this->_input['all_sun']); //选择全部子类 $input_param['sel_goods_class'] = intval($this->_input['sel_goods_class']); //商品分类 $input_param['sel_goods_brand'] = intval($this->_input['sel_goods_brand']); //商品品牌 $sql = ''; if ($input_param['start_price'] != 0 and $input_param['end_price'] != 0) { $sql .= " and (goods.goods_pricedesc <=" . $input_param['end_price'] . " and goods.goods_pricedesc >=" . $input_param['start_price'] . ")"; } if ($input_param['sel_goods_brand'] != 0) { $sql .= " and goods.brand_id=" . $input_param['sel_goods_brand']; } require_once "commonpage.class.php"; $obj_page = new CommonPage(); $obj_page->pagebarnum(20); //每页显示商品数 include BasePath . "/share/" . NC_SHOP_DIR . "goods_class_show.php"; $array = array(); $i = 0; foreach ($node_cache as $k => $v) { if ($v[1] == 0) { $left_array[$i]['class_id'] = $v[0]; $left_array[$i]['class_name'] = $v[2]; $i++; } if ($input_param['all_sun'] == 'all_sun') { if ($v[0] == $input_param['sel_goods_class']) { $array['class_id'] = $v[0]; $array['class_top_id'] = $v[1]; $array['class_name'] = $v[2]; $array['class_keywords'] = $v[6]; $array['class_description'] = $v[7]; $array['key_id'] = $k; $input_param['sub_class1'] = $array; } } } $this->output('left_array', $left_array); //左侧商品分类 if ($this->_configinfo['websit']['pay_receive_type'] == 1) { //搜索子店发布的商品 $search_array = $this->obj_product->searchGoods($input_param, $obj_page, '*', '', $sql); } else { require_once 'goods.class.php'; $obj_goods = new GoodsClass(); //$input_param['nc_shop_id'] = NC_SHOP_ID; $input_param['shop_goods_name'] = trim($this->_input['keywords']); //关键字 $search_array = $obj_goods->getChooseGoodsList($input_param, $obj_page); } $search_page = $obj_page->show(6); $this->output('search_count', $obj_page->total_num); $this->output('product_class_page', $search_page); $this->output('product_array', $search_array); /*商品品牌*/ $brand_array = $this->obj_goods_brand->getBrandList(array('show_type' => 'class_show')); $this->output('brand_array', $brand_array); $this->showpage('search_list'); }