Example #1
0
 public function one()
 {
     if (empty($this->user_session)) {
         $referer = url('cart:one');
         redirect(url('account:login', array('referer' => $referer)));
         exit;
     }
     // 查出购物车里的产品
     $cart_list = D('')->field('c.pigcms_id, c.store_id, c.product_id, c.pro_num, c.pro_price, c.sku_id, c.sku_data, p.name, p.image')->table(array('Product' => 'p', 'User_cart' => 'c'))->where("`p`.`product_id` = `c`.`product_id` AND c.uid = '" . $this->user_session['uid'] . "'")->select();
     if (empty($cart_list)) {
         //pigcms_tips('你的购物为空', '');
     }
     // 对产品按商铺进行分组
     $cart_store_list = array();
     $stort_id_list = array();
     $total = 0;
     $total_money = 0;
     foreach ($cart_list as $cart) {
         $cart['sku_data'] = unserialize($cart['sku_data']);
         $cart['image'] = getAttachmentUrl($cart['image']);
         $cart_store_list[$cart['store_id']][] = $cart;
         $stort_id_list[$cart['store_id']] = $cart['store_id'];
         $total += $cart['pro_num'];
         $total_money += $cart['pro_num'] * $cart['pro_price'];
     }
     $store_name_list = M('Store')->getStoreName($stort_id_list);
     $this->assign('cart_store_list', $cart_store_list);
     $this->assign('store_name_list', $store_name_list);
     $this->assign('total', $total);
     $this->assign('total_money', $total_money);
     $this->assign('step', 'one');
     $this->display();
 }
Example #2
0
 public function getProducts($order_id)
 {
     $products = $this->db->query("SELECT p.product_id,p.name,p.image,op.pro_num,op.pro_price,op.sku_id,op.sku_data,op.comment,op.is_packaged,op.in_package_status,op.is_fx,op.original_product_id,op.is_present FROM " . option('system.DB_PREFIX') . "order_product op, " . option('system.DB_PREFIX') . "product p WHERE op.product_id = p.product_id AND op.order_id = '" . $order_id . "'");
     foreach ($products as &$value) {
         $value['image'] = getAttachmentUrl($value['image']);
     }
     return $products;
 }
 public function getFxProducts($order_id)
 {
     $products = $this->db->query("SELECT p.product_id,p.name,fop.cost_price,p.image,fop.quantity,fop.price,fop.sku_id,fop.sku_data,fop.comment FROM " . option('system.DB_PREFIX') . "fx_order_product fop, " . option('system.DB_PREFIX') . "product p WHERE fop.product_id = p.product_id AND fop.fx_order_id = '" . $order_id . "'");
     foreach ($products as &$tmp) {
         $tmp['image'] = getAttachmentUrl($tmp['image']);
     }
     return $products;
 }
Example #4
0
 /**
  * @desc 获取商品图片
  * @param $product_id
  */
 public function getImages($product_id, $is_wap = false)
 {
     $images = $this->db->field('`image`')->where(array('product_id' => $product_id))->order('sort ASC')->select();
     foreach ($images as &$value) {
         $value['image'] = getAttachmentUrl($value['image']);
     }
     return $images;
 }
Example #5
0
 /**
  * 根据活动ID查寻出所有相关产品
  */
 public function getProductListByRid($rid)
 {
     $db_prefix = option('system.DB_PREFIX');
     $sql = "SELECT p.* FROM `" . $db_prefix . "reward_product` AS rp LEFT JOIN `" . $db_prefix . "product` AS p ON `rp`.`product_id` = `p`.`product_id` WHERE `rp`.`rid` = '" . $rid . "'";
     $product_list = $this->db->query($sql);
     foreach ($product_list as &$product) {
         $product['image'] = getAttachmentUrl($product['image']);
     }
     return $product_list;
 }
 /**
  * 根据赠品ID查寻出所有相关产品
  */
 public function getProductListByPid($pid)
 {
     $db_prefix = option('system.DB_PREFIX');
     $sql = "SELECT p.product_id, p.name, p.quantity, p.price, p.original_price, p.image, p.has_property FROM `" . $db_prefix . "present_product` AS pp LEFT JOIN `" . $db_prefix . "product` AS p ON `PP`.`product_id` = `p`.`product_id` WHERE `pp`.`pid` = '" . $pid . "' AND p.status = '1' AND p.quantity > 0";
     $product_list = $this->db->query($sql);
     foreach ($product_list as &$product) {
         $product['image'] = getAttachmentUrl($product['image']);
     }
     return $product_list;
 }
Example #7
0
 public function get_slider_by_key($cat_key, $limit = 6)
 {
     if (empty($cat_key)) {
         return false;
     }
     $adver_list = $this->db->table('Slider as s')->join('Slider_category sc On s.cat_id = sc.cat_id')->where('sc.cat_key=\'' . $cat_key . '\' and s.status=\'1\'')->limit($limit)->select();
     $adverlist = array();
     foreach ($adver_list as $key => $value) {
         $adver_list[$key]['pic'] = getAttachmentUrl($value['pic']);
     }
     return $adver_list;
 }
 /**
  * 根据条件获到评论列表
  * 当limit与offset都为0时,表示不行限制
  * 当is_attachment为真时,需要查寻评论的图片列表,以及评论会员基本信息
  */
 public function getSimpleList($limit = 0, $offset = 0, $order_by = '')
 {
     if (empty($order_by)) {
         $order_by = "ca.id desc";
     }
     $where = "c.status=1 and c.has_image=1 and c.delete_flg=0 and c.type='PRODUCT'";
     $group = 'c.relation_id';
     $comment_list = $this->db->table("Comment as c")->join('Comment_attachment as ca ON ca.cid=c.id', 'LEFT')->where($where)->group($group)->limit($offset . ',' . $limit)->field("c.*,ca.file,ca.width,ca.height,c.relation_id")->select();
     foreach ($comment_list as $k => $tmp) {
         $comment_list[$k]['file'] = getAttachmentUrl($tmp['file']);
         $comment_list[$k]['ilink'] = url_rewrite('goods:index', array('id' => $tmp['relation_id'])) . "#product_comment_image";
     }
     return $comment_list;
 }
Example #9
0
 public function getList($where)
 {
     $user_list = $this->where($where)->select();
     $return_user_list = array();
     foreach ($user_list as $tmp) {
         if ($tmp['avatar']) {
             $tmp['avatar'] = getAttachmentUrl($tmp['avatar']);
         } else {
             $tmp['avatar'] = getAttachmentUrl('images/touxiang.png', false);
         }
         $return_user_list[$tmp['uid']] = $tmp;
     }
     return $return_user_list;
 }
 /**
  * 根据优惠券商品 查找对应产品信息列表
  * @param $where is string
  * @param $orderbyfield 排序字段
  * @param $orderbymethod 排序方式 ASC DESC
  * @param $offset
  * @param $limit
  * @return array
  */
 public function getSellingCouponProduct($where, $order_by_field, $order_by_method, $offset, $limit)
 {
     if (!empty($order_by_field) && !empty($order_by_method)) {
         $order = $order_by_field . ' ' . strtoupper($order_by_method);
     } else {
         //默认排序
         $order = 'p.sort DESC, p.product_id DESC';
     }
     $where = $where . " and p.status=1";
     $products = $this->db->table("Coupon_to_product as cp")->join('Product as p ON cp.product_id=p.product_id', 'LEFT')->where($where)->order($order)->limit($offset . ',' . $limit)->field("p.*,cp.coupon_id")->select();
     foreach ($products as &$tmp) {
         $tmp['image'] = getAttachmentUrl($tmp['image']);
         $tmp['link'] = url_rewrite('goods:index', array('id' => $tmp['product_id']));
     }
     return $products;
 }
Example #11
0
 public function getAllCategory($where = array())
 {
     $category_list = $this->db->where($where)->order('`parent_id` ASC,`order_by` DESC,`cat_id` ASC')->select();
     $new_category_list = array();
     foreach ($category_list as $value) {
         if ($value['cat_pic']) {
             $value['cat_pic'] = getAttachmentUrl($value['cat_pic']);
         }
         if (empty($value['parent_id'])) {
             $new_category_list[$value['cat_id']] = $value;
         } else {
             $new_category_list[$value['parent_id']]['cat_list'][] = $value;
         }
     }
     return $new_category_list;
 }
Example #12
0
 public function get_adver_by_key($cat_key, $limit = 3)
 {
     $database_adver_category = D('Adver_category');
     $condition_adver_category['cat_key'] = $cat_key;
     $now_adver_category = $database_adver_category->field('`cat_id`')->where($condition_adver_category)->find();
     if ($now_adver_category) {
         $condition_adver['cat_id'] = $now_adver_category['cat_id'];
         $condition_adver['status'] = '1';
         $adver_list = $this->field(true)->where($condition_adver)->order('`id` DESC')->limit($limit)->select();
         foreach ($adver_list as $key => $value) {
             $adver_list[$key]['pic'] = getAttachmentUrl($value['pic']);
         }
         return $adver_list;
     } else {
         return false;
     }
 }
Example #13
0
 public function getListByStoreId($store_id)
 {
     $condition = array('store_id' => $store_id, 'status' => 1);
     switch ($_POST['type']) {
         case 'list_image':
             $condition['type'] = 0;
             break;
         case 'list_upload_image':
             $condition['type'] = 0;
             $condition['from'] = 0;
             break;
         case 'list_import_image':
             $condition['type'] = 0;
             $condition['from'] = 1;
             break;
         case 'list_collect_image':
             $condition['type'] = 0;
             $condition['from'] = 2;
             break;
         case 'list_voice':
             $condition['type'] = 1;
             break;
         case 'list_upload_voice':
             $condition['type'] = 1;
             $condition['from'] = 0;
             break;
         case 'list_collect_voice':
             $condition['type'] = 1;
             $condition['from'] = 1;
             break;
     }
     if ($_POST['txt']) {
         $condition['name'] = array('like', '%' . $_POST['txt'] . '%');
     }
     $attachment_count = $this->db->where($condition)->count('pigcms_id');
     import('source.class.user_page');
     $p = new Page($attachment_count, 10);
     $attachment_list = $this->db->where($condition)->order('`pigcms_id` DESC')->limit($p->firstRow . ',' . $p->listRows)->select();
     foreach ($attachment_list as &$value) {
         $value['file'] = getAttachmentUrl($value['file']);
     }
     $return['attachment_list'] = $attachment_list;
     $return['page'] = $p->show();
     return $return;
 }
Example #14
0
 public function getListByIDList($physical_id_list)
 {
     if (empty($physical_id_list) || !is_array($physical_id_list)) {
         return array();
     }
     //$store_physical_list = $this->db->where(array('pigcms_id' => array('in', $physical_id_list)))->select();
     $store_physical_list = D('')->field("`s`.`buyer_selffetch_name`, `sp`.*")->table(array('Store' => 's', 'Store_physical' => 'sp'))->where("`s`.`store_id` = `sp`.`store_id` AND `sp`.`pigcms_id` in (" . join(',', $physical_id_list) . ")")->select();
     import('source.class.area');
     $area_class = new area();
     $return_data = array();
     foreach ($store_physical_list as $value) {
         $value['images_arr'] = explode(',', $value['images']);
         foreach ($value['images_arr'] as &$image_value) {
             $image_value = getAttachmentUrl($image_value);
         }
         $value['province_txt'] = $area_class->get_name($value['province']);
         $value['city_txt'] = $area_class->get_name($value['city']);
         $value['county_txt'] = $area_class->get_name($value['county']);
         $return_data[$value['pigcms_id']] = $value;
     }
     return $return_data;
 }
Example #15
0
 private function special_keyword($key, $data = array())
 {
     $return = array();
     if ($key == '附近团购' || $key == '附近订餐') {
         $dateline = time() - 3600 * 2;
         if ($_lat = D("User__lat")->field(true)->where("`open_id`='{$data['FromUserName']}' AND `dateline`>'{$dateline}'")->find()) {
             import('@.ORG.lat');
             $lat_class = new lat();
             $location2 = $lat_class->gpsToBaidu($_lat['lat'], $_lat['']);
             //转换腾讯坐标到百度坐标
             $x = $location2['lat'];
             $y = $location2['lng'];
             if ($key == '附近订餐') {
                 $meals = D("Merchant_store")->field("*, ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(({$x}*PI()/180-`lat`*PI()/180)/2),2)+COS({$x}*PI()/180)*COS(`lat`*PI()/180)*POW(SIN(({$y}*PI()/180-``*PI()/180)/2),2)))*1000) AS juli")->where('`have_meal`=1')->order("juli ASC")->limit("0, 10")->select();
                 $store_image_class = new store_image();
                 foreach ($meals as $meal) {
                     $images = $store_image_class->get_allImage_by_path($meal['pic_info']);
                     $meal['image'] = $images ? array_shift($images) : '';
                     $len = $meal['juli'] >= 1000 ? number_format($meal['juli'] / 1000, 1) . '千米' : $meal['juli'] . '米';
                     $return[] = array($meal['name'] . "[{$meal['adress']}]约{$len}", $meal['txt_info'], $meal['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Meal&a=menu&mer_id={$meal['mer_id']}&store_id={$meal['store_id']}");
                 }
             } else {
                 $meals = D("Merchant_store")->field("*, ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(({$x}*PI()/180-`lat`*PI()/180)/2),2)+COS({$x}*PI()/180)*COS(`lat`*PI()/180)*POW(SIN(({$y}*PI()/180-``*PI()/180)/2),2)))*1000) AS juli")->where('`have_group`=1')->order("juli ASC")->limit("0, 10")->select();
                 $store_image_class = new store_image();
                 foreach ($meals as $meal) {
                     $images = $store_image_class->get_allImage_by_path($meal['pic_info']);
                     $meal['image'] = $images ? array_shift($images) : '';
                     $len = $meal['juli'] >= 1000 ? number_format($meal['juli'] / 1000, 1) . '千米' : $meal['juli'] . '米';
                     $return[] = array($meal['name'] . "[{$meal['adress']}]约{$len}", $meal['txt_info'], $meal['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Group&a=shop&store_id={$meal['store_id']}");
                 }
             }
         }
         if ($return) {
             return array($return, 'news');
         } else {
             return array("主人【小猪猪】已经接收到你的指令请发送您的地理位置(对话框右下角点击+号,然后点击“位置”)给我哈", 'text');
         }
     }
     if ($key == '交友') {
         $return[] = array("交友约会", "结交一些朋友吃喝玩乐", $this->config['site_url'] . '/static/images/jiaoyou.jpg', $this->config['site_url'] . "/wap.php?c=Invitation&a=datelist");
         return array($return, 'news');
     }
     $platform = D("Platform")->field(true)->where(array('key' => $key))->find();
     if ($platform) {
         $return[] = array($platform['title'], $platform['info'], getAttachmentUrl($platform['pic']), $platform['url']);
     } else {
         $keys = D("Keywords")->field(true)->where(array('keyword' => $key))->order('id DESC')->limit('0,9')->select();
         $lotteryids = $mealids = $groupids = array();
         foreach ($keys as $k) {
             if ($k['third_type'] == 'group') {
                 $groupids[] = $k['third_id'];
             } elseif ($k['third_type'] == 'Merchant_store') {
                 $mealids[] = $k['third_id'];
             } elseif ($k['third_type'] == 'lottery') {
                 $lotteryids[] = $k['third_id'];
             }
         }
         if ($groupids) {
             $list = D("Group")->field(true)->where(array('group_id' => array('in', $groupids)))->select();
             $group_image_class = new group_image();
             foreach ($list as $li) {
                 $image = $group_image_class->get_image_by_path($li['pic'], 's');
                 $return[] = array($li['s_name'], $li['name'], $image, $this->config['site_url'] . "/wap.php?g=Wap&c=Group&a=detail&group_id={$li['group_id']}");
             }
         }
         if ($mealids) {
             $list = D("Merchant_store")->field(true)->where(array('store_id' => array('in', $mealids)))->select();
             $store_image_class = new store_image();
             foreach ($list as $now_store) {
                 $images = $store_image_class->get_allImage_by_path($now_store['pic_info']);
                 $now_store['image'] = $images ? array_shift($images) : '';
                 if ($now_store['have_meal']) {
                     $return[] = array($now_store['name'], $now_store['txt_info'], $now_store['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Meal&a=menu&mer_id={$now_store['mer_id']}&store_id={$now_store['store_id']}");
                 } else {
                     $return[] = array($now_store['name'], $now_store['txt_info'], $now_store['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Group&a=shop&store_id={$now_store['store_id']}");
                 }
             }
         }
         if ($lotteryids) {
             $lotterys = D("Lottery")->field(true)->where(array('id' => array('in', $lotteryids), 'statdate' => array('lt', time()), 'enddate' => array('gt', time())))->select();
             foreach ($lotterys as $lottery) {
                 switch ($lottery['type']) {
                     case 1:
                         $return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=Lottery&a=index&token={$lottery['token']}&id={$lottery['id']}");
                         break;
                     case 2:
                         $return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=Guajiang&a=index&token={$lottery['token']}&id={$lottery['id']}");
                         break;
                     case 3:
                         $return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=Coupon&a=index&token={$lottery['token']}&id={$lottery['id']}");
                         break;
                     case 4:
                         $return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=LuckyFruit&a=index&token={$lottery['token']}&id={$lottery['id']}");
                         break;
                     case 5:
                         $return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=GoldenEgg&a=index&token={$lottery['token']}&id={$lottery['id']}");
                         break;
                 }
             }
         }
     }
     if ($return) {
         return array($return, 'news');
     }
     return array('亲,暂时没有找到与“' . $key . '”相关的内容!请更换内容。', 'text');
 }
Example #16
0
 public function getImgList()
 {
     $database_attachment = D('Attachment');
     $condition_attachment['store_id'] = $this->store_session['store_id'];
     $condition_attachment['status'] = '1';
     $condition_attachment['type'] = '0';
     $count = $database_attachment->where($condition_attachment)->count('pigcms_id');
     import('user_page');
     $p = new Page($count, 27);
     $image_list = $database_attachment->field('`pigcms_id`,`name`,`file`,`size`,`width`,`height`')->where($condition_attachment)->order('`pigcms_id` DESC')->limit($p->firstRow . ',' . $p->listRows)->select();
     foreach ($image_list as &$value) {
         $value['file'] = getAttachmentUrl($value['file']);
     }
     $err_msg['image_list'] = $image_list;
     $err_msg['page_bar'] = $p->show();
     $err_msg['count'] = $count;
     json_return(0, $err_msg);
 }
Example #17
0
 /**
  * @desc 获取单个品牌信息
  * @param $where
  * @param string $fields
  */
 public function get($where, $fields = '*')
 {
     $brand = $this->db->field($fields)->where($where)->find();
     $brand['pic'] = getAttachmentUrl($brand['pic']);
     return $brand;
 }
Example #18
0
 public function supplierFxProducts($where, $offset = 0, $limit = 0)
 {
     if ($limit > 0) {
         $products = $this->db->where($where)->order('is_recommend DESC, product_id DESC')->order('product_id DESC')->limit($offset . ',' . $limit)->select();
     } else {
         $products = $this->db->where($where)->order('is_recommend DESC, product_id DESC')->order('product_id DESC')->select();
     }
     foreach ($products as &$product) {
         $product['image'] = getAttachmentUrl($product['image']);
     }
     return $products;
 }
Example #19
0
?>
/static/js/fastclick.js"></script>
		<script src="<?php 
echo $config['site_url'];
?>
/static/js/jquery.min.js"></script>
		<script src="<?php 
echo TPL_URL;
?>
index_style/js/base.js"></script>
	</head>
	<body style="padding-bottom:70px;">
		<div class="wx_wrap">
			<div class="my_head">
				<img src="<?php 
echo getAttachmentUrl('images/default_ucenter.jpg', false);
?>
" style="width:100%;max-height:220px;display:block;margin:auto;"/>
				<!-- S 账户信息 -->
				<a class="my_user">
					<h5>尊敬的 <?php 
echo $wap_user['nickname'];
?>
 ,<?php 
echo $time_tip;
?>
</h5>
				</a>
				<!-- E 账户信息 -->
			</div>
			<!-- S 入口菜单 -->
function display_upload($apli, $post_id, $Mmod)
{
    $att_size = '';
    $att_type = '';
    $att_name = '';
    $att_url = '';
    $att_link = '';
    $attachments = '';
    $att_icon = '';
    $num_cells = 5;
    $att = getAttachments($apli, $post_id, 0, $Mmod);
    if (is_array($att)) {
        $att_count = count($att);
        //      $attachments = "\n<table id=\"ooo\" class=\"fo-post-mes\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">\n<tr>";
        $attachments = '
      <div class="list-group">
         <div class="list-group-item">
            <img class="smil" src="themes/npds-boost/images/forum/subject/1F4CE.png" border="0" alt="icon_post" />
            <span class="text-muted">' . upload_translate("Pièces jointes") . '</span>
            <span class="label label-default label-pill pull-right">' . $att_count . '</span>
         </div>';
        $ncell = 0;
        for ($i = 0; $i < $att_count; $i++) {
            $att_id = $att[$i]["att_id"];
            $att_name = $att[$i]["att_name"];
            $att_path = $att[$i]["att_path"];
            $att_type = $att[$i]["att_type"];
            $att_size = (int) $att[$i]["att_size"];
            $compteur = $att[$i]["compteur"];
            $visible = $att[$i]["visible"];
            $att_inline = $att[$i]["inline"];
            if (!$visible) {
                $marqueurV = "@";
            } else {
                $marqueurV = "";
            }
            $att_link = getAttachmentUrl($apli, $post_id, $att_id, "{$att_path}/{$att_id}.{$apli}." . $marqueurV . "{$att_name}", $att_type, $att_size, $att_inline, $compteur, $visible, $Mmod);
            // check for full row
            if (++$ncell > $num_cells) {
                //            $attachments .= "</tr>\n<tr>";
                $ncell = 1;
            }
            if (getAttDisplayMode($att_type, $att_inline) != ATT_DSP_LINK) {
                if ($ncell > 1) {
                    while ($ncell++ <= $num_cells) {
                        //                  $attachments .= "<td>&nbsp;</td>";
                        $attachments .= "</tr>\n<tr>";
                    }
                }
                $ncell = $num_cells + 1;
                //            $td = "<td colspan=\"".$num_cells."\">";
            } else {
                //            $td = "<td>";
            }
            //         $attachments .= $td.$att_link."</td>";
            $attachments .= $att_link;
            $att_list[$att_id] = $att_name;
        }
        //      $attachments .= "</tr></table>";
        $attachments .= '</div>';
        return $attachments;
    }
}
Example #21
0
 public function index()
 {
     $product_model = M('Product');
     $this->product = $product_model->get(array('product_id' => $this->id, 'status' => 1));
     if (empty($this->product) || $this->product['status'] != 1) {
         pigcms_tips('未找到相应产品', 'none');
     }
     $this->product['wx_image'] = option('config.site_url') . '/source/qrcode.php?type=good&id=' . $this->product['product_id'];
     $is_preview = $_GET['is_preview'];
     if (!is_mobile() && $this->user_session && $this->product['uid'] == $this->user_session['uid']) {
         $this->assign('is_preview', $is_preview);
     }
     // 猜你喜欢,抽取方法为同类型的热销产品
     $condition_arr = array();
     //$condition_arr['category_id'] = $this->product['category_id'];
     $condition_arr['status'] = 1;
     $condition_arr['product_id'] = array('!=', $this->product['product_id']);
     $condition_arr['store_id'] = $this->product['store_id'];
     $similar_product_list = $product_model->getSelling($condition_arr, 'sort', 'desc', 0, 6);
     //->where($condition_arr)->order('sort desc')->limit('0, 6')->select();
     // 本店铺热卖产品,抽取方法本店铺同类型热买
     //$hot_product_list = $product_model->getSelling($condition_arr, 'sales', 'desc', 0, 6);
     // 检查商品库存情况
     $product_sku_list = array();
     $property_new_list = array();
     if ($this->product['has_property']) {
         //$product_sku_list = D('Product_sku')->field('`sku_id`, `properties`, `quantity`, `price`')->where(array('product_id' => $this->id, 'quantity'=>array('!=', '0')))->order('`sku_id` ASC')->select();
         $product_sku_list = D('Product_sku')->field('`sku_id`, `properties`, `quantity`, `price`')->where(array('product_id' => $this->id))->order('`sku_id` ASC')->select();
         $sku_price_arr = $sku_property_arr = array();
         foreach ($product_sku_list as $value) {
             $sku_price_arr[] = $value['price'];
             $sku_property_arr[$value['properties']] = true;
         }
         $property_list = D('')->field('`pp`.`pid`,`pp`.`name`')->table(array('Product_to_property' => 'ptp', 'Product_property' => 'pp'))->where("`ptp`.`product_id`='" . $this->id . "' AND `pp`.`pid`=`ptp`.`pid`")->order('`ptp`.`pigcms_id` ASC')->select();
         if (!empty($property_list)) {
             $property_value_list = D('')->field('`ppv`.`vid`,`ppv`.`value`,`ppv`.`pid`, `ppv`.`image`')->table(array('Product_to_property_value' => 'ptpv', 'Product_property_value' => 'ppv'))->where("`ptpv`.`product_id`='" . $this->id . "' AND `ppv`.`vid`=`ptpv`.`vid`")->order('`ptpv`.`pigcms_id` ASC')->select();
             if (!empty($property_value_list)) {
                 foreach ($property_value_list as $value) {
                     $propertyValueList[$value['pid']][] = array('vid' => $value['vid'], 'value' => $value['value'], 'image' => getAttachmentUrl($value['image']));
                 }
                 foreach ($property_list as $value) {
                     $property_new_list[] = array('pid' => $value['pid'], 'name' => $value['name'], 'image' => getAttachmentUrl($value['image']), 'values' => $propertyValueList[$value['pid']]);
                 }
                 if (count($property_new_list) == 1) {
                     foreach ($property_new_list[0]['values'] as $key => $value) {
                         $tmpKey = $property_new_list[0]['pid'] . ':' . $value['vid'];
                         if (empty($sku_property_arr[$tmpKey])) {
                             unset($property_new_list[0]['values'][$key]);
                         }
                     }
                 }
                 $returnArr['sku_list'] = $product_sku_list;
                 $returnArr['property_list'] = $property_new_list;
             }
         }
     }
     // 抽出店铺
     $store = M('Store')->getStore($this->product['store_id']);
     if (empty($store) || $store['status'] != 1) {
         pigcms_tips('未找到相应的店铺或已关闭', 'none');
     }
     $store_contact = array();
     if ($this->product['supplier_id']) {
         $store_contact = M('Store_contact')->get($this->product['supplier_id']);
     } else {
         $store_contact = M('Store_contact')->get($this->product['store_id']);
     }
     // 设置浏览记录,只记录产品的product_id,只记录最近5条记录
     $history_product_list = $_COOKIE['history_product_list'];
     if (empty($history_product_list)) {
         setcookie('history_product_list', $this->id, $_SERVER['REQUEST_TIME'] + 86400 * 365, '/');
     } else {
         $tmp_product_list = explode(',', $history_product_list);
         array_unshift($tmp_product_list, $this->id);
         $tmp_product_list = array_slice($tmp_product_list, 0, 6);
         $tmp_product_list = array_unique($tmp_product_list);
         $tmp_product_list = array_slice($tmp_product_list, 0, 5);
         $product_id_str = join(',', $tmp_product_list);
         setcookie('history_product_list', $product_id_str, $_SERVER['REQUEST_TIME'] + 86400 * 365, '/');
     }
     // 更改浏览次数
     M('Product')->analytics(array('product_id' => $this->id));
     // 主营分类
     $sale_category = M('Store')->getSaleCategory($this->product['store_id'], $this->product['uid']);
     // 检查是否已经收藏
     $user_collect = array('click' => 'userCollect', 'title' => '收藏');
     if (!empty($this->user_session)) {
         $collect = D('User_collect')->where(array('type' => 1, 'user_id' => $this->user_session['uid'], 'dataid' => $this->id))->find();
         if (!empty($collect)) {
             $user_collect = array('click' => 'cancelCollect', 'title' => '取消收藏');
         }
     }
     // 查看本产品是否参与活动
     $reward = '';
     if ($this->product['source_product_id'] == 0) {
         $reward = M('Reward')->getRewardByProduct($this->product);
     }
     // 查找产品的图片
     $product_image_list = M('Product_image')->getImages($this->id);
     // 查找评论TAG数量
     $where = array();
     $where['type'] = 'PRODUCT';
     $where['relation_id'] = $this->id;
     $comment_tag_count_list = M('Comment_tag')->getCountList($where);
     // 评论满意,一般,不满意数量,以及满意百分比
     $comment_type_count = M('Comment')->getCountList($where);
     $satisfaction_pre = '100%';
     if ($comment_type_count['total'] > 0) {
         $satisfaction_pre = round($comment_type_count['t3'] / $comment_type_count['total'] * 100) . '%';
     }
     $comment_type_count['satisfaction_pre'] = $satisfaction_pre;
     // 查找系统评论TAG
     $product_category_tag_list = array();
     $product_category = M('Product_category')->getCategory($this->product['category_id']);
     if (!empty($product_category['tag_str'])) {
         $where = array();
         $where['id'] = array('in', explode(',', $product_category['tag_str']));
         $product_category_tag_list = M('System_tag')->geNameList($where);
     }
     // 店铺信息下面的评论
     $where = array();
     $where = array();
     $where['type'] = 'PRODUCT';
     $where['relation_id'] = $this->id;
     $where['status'] = 1;
     $where['delete_flg'] = 0;
     $comment_list = M('Comment')->getSimiplyList($where);
     // 最新动态
     $sns_list = M('Financial_record')->sns();
     $this->assign('imUrl', getImUrl($_SESSION['user']['uid'], $store['store_id']));
     $this->assign('product', $this->product);
     $this->assign('product_image_list', $product_image_list);
     $this->assign('similar_product_list', $similar_product_list);
     $this->assign('comment_type_count', $comment_type_count);
     $this->assign('comment_tag_count_list', $comment_tag_count_list);
     $this->assign('product_category_tag_list', $product_category_tag_list);
     $this->assign('store', $store);
     $this->assign('store_contact', $store_contact);
     $this->assign('property_list', $property_new_list);
     $this->assign('product_sku_list', $product_sku_list);
     $this->assign('sale_category', $sale_category);
     $this->assign('user_collect', $user_collect);
     $this->assign('reward', $reward);
     $this->assign('sns_list', $sns_list);
     $this->assign('comment_list', $comment_list);
     $this->display();
 }
Example #22
0
 public function attention_store()
 {
     if (empty($this->user_session)) {
         $referer = url('account:collect_store');
         redirect(url('account:login', array('referer' => $referer)));
         exit;
     }
     // 基本参数设定
     $page = max(1, $_GET['page']);
     $limit = 10;
     $count = D('')->table(array('User_attention' => 'ua', 'Store' => 's'))->where("`ua`.`data_type` = '2' AND `ua`.`user_id` = '" . $this->user_session['uid'] . "' AND `ua`.`data_id` = `s`.`store_id`")->count("`ua`.`id`");
     $store_list = array();
     $pages = '';
     if ($count > 0) {
         $total_pages = ceil($count / $limit);
         $page = min($page, $total_pages);
         $offset = ($page - 1) * $limit;
         $product_model = M('Product');
         $store_list = D('')->table(array('User_attention' => 'ua', 'Store' => 's'))->where("`ua`.`data_type` = '2' AND `ua`.`user_id` = '" . $this->user_session['uid'] . "' AND `ua`.`data_id` = `s`.`store_id`")->order("`ua`.`id` DESC")->limit($offset . ',' . $limit)->select();
         foreach ($store_list as &$store) {
             if (empty($store['logo'])) {
                 $store['logo'] = getAttachmentUrl('images/default_shop_2.jpg', false);
             } else {
                 $store['logo'] = getAttachmentUrl($store['logo']);
             }
             //每个店铺获取 10个热销商品 10个新品
             // 店铺热销个产品
             $store['hot_list'] = $product_model->getSelling(array('store_id' => $store['store_id'], 'status' => 1), 'sales', 'desc', 0, 9);
             $store['hot_list_count'] = count($store['hot_list']);
             /*新品*/
             $store['news_list'] = $product_model->getSelling(array('store_id' => $store['store_id'], 'status' => 1), '', '', 0, 9);
             $store['news_list_count'] = count($store['news_list']);
             // 评论满意,一般,不满意数量,以及满意百分比
             $where = array();
             $where['type'] = 'STORE';
             $where['relation_id'] = $store['store_id'];
             $comment_type_count = M('Comment')->getCountList($where);
             $satisfaction_pre = '100%';
             if ($comment_type_count['total'] > 0) {
                 $satisfaction_pre = round($comment_type_count['t3'] / $comment_type_count['total'] * 100) . '%';
             }
             $store['satisfaction_pre'] = $satisfaction_pre;
             $store['imUrl'] = getImUrl($_SESSION['user']['uid'], $store['store_id']);
         }
         // 分页
         import('source.class.user_page');
         $user_page = new Page($count, $limit, $page);
         $pages = $user_page->show();
     }
     $this->assign('store_list', $store_list);
     $this->assign('pages', $pages);
     $this->display();
 }
 public function getOneTreeCategory($category_id)
 {
     $new_category_list = array();
     $category_id = sprintf("%02d", $category_id);
     $category_list = $this->db->where("find_in_set('" . $category_id . "',cat_path)")->order('`cat_fid` ASC,`cat_sort` DESC,`cat_id` ASC')->select();
     foreach ($category_list as $value) {
         if ($value['cat_pic']) {
             $value['cat_pic'] = getAttachmentUrl($value['cat_pic']);
         }
         if ($value['cat_pc_pic']) {
             $value['cat_pc_pic'] = getAttachmentUrl($value['cat_pc_pic']);
         }
         if (empty($value['cat_fid'])) {
             $new_category_list[$value['cat_id']] = $value;
             $arrs[$value['cat_id']] = $value;
         } else {
             $new_category_list[$value['cat_fid']]['cat_list'][] = $value;
         }
     }
     return $new_category_list;
 }
Example #24
0
 private function _goods_content()
 {
     $product = M('Product');
     $store = M('Store');
     $user_address = M('User_address');
     $product_count = $product->fxProductCount(array('store_id' => $this->store_session['store_id'], 'supplier_id' => array('>', 0), 'status' => array('<', 2)));
     import('source.class.user_page');
     $page = new Page($product_count, 15);
     $tmp_products = $product->fxProducts($this->store_session['store_id'], $page->firstRow, $page->listRows);
     $products = array();
     foreach ($tmp_products as $tmp_product) {
         $supplier = $store->getStore($tmp_product['supplier_id']);
         if (!empty($tmp_product['delivery_address_id'])) {
             import('source.class.area');
             $address = $user_address->getAddress($tmp_product['delivery_address_id']);
             $address_obj = new area();
             $province = $address_obj->get_name($address['province']);
             $city = $address_obj->get_name($address['city']);
             $area = $address_obj->get_name($address['area']);
             $delivery_address = $province . ' ' . $city . ' ' . $area . ' ' . $address['address'];
         } else {
             $delivery_address = '使用买家收货地址';
         }
         $source_product = $product->get(array('product_id' => $tmp_product['source_product_id']), 'cost_price');
         $products[] = array('store_id' => $tmp_product['store_id'], 'product_id' => $tmp_product['product_id'], 'name' => $tmp_product['name'], 'image' => getAttachmentUrl($tmp_product['image']), 'cost_price' => $source_product['cost_price'], 'supplier' => $supplier['name'], 'delivery_address' => $delivery_address, 'delivery_address_id' => $tmp_product['delivery_address_id'], 'is_fx_setting' => $tmp_product['is_fx_setting']);
     }
     $this->assign('products', $products);
     $this->assign('page', $page->show());
 }
Example #25
0
        $data['size'] = $uploadList[0]['size'];
        $data['add_time'] = $_SERVER['REQUEST_TIME'];
        $data['ip'] = get_client_ip(1);
        $data['agent'] = $_SERVER['HTTP_USER_AGENT'];
        if ($type == 0) {
            list($data['width'], $data['height']) = getimagesize('../upload/' . $rand_num . $uploadList[0]['savename']);
        }
        $pigcms_id = M('Attachment_user')->add($data);
        if (!$pigcms_id) {
            unlink($upload_dir . $uploadList[0]['name']);
            json_return(1002, '图片上传失败1');
            exit;
        } else {
            $attachment_upload_type = option('config.attachment_upload_type');
            // 上传到又拍云服务器
            if ($attachment_upload_type == '1') {
                import('source.class.upload.upyunUser');
                upyunUser::upload('../upload/' . $rand_num . $uploadList[0]['savename'], '/' . $rand_num . $uploadList[0]['savename']);
            }
            json_return(0, array('id' => $pigcms_id, 'file' => getAttachmentUrl($rand_num . $uploadList[0]['savename'])));
            exit;
        }
    } else {
        json_return(1002, '图片上传失败2');
        exit;
    }
} else {
    json_return(1002, '图片上传失败3');
    exit;
}
echo ob_get_clean();
Example #26
0
							<div class="order_dec">店铺:<a href="###"><span>钱来小铺</span></a></div>
						</dt> -->
						<?php 
$product_name_list = array();
foreach ($order['proList'] as $product) {
    $product_name_list[$product['product_id']] = $product['name'];
    $total_price += $product['pro_num'] * $product['pro_price'];
    ?>
							<dd class="clearfix">
								<div class="product_1 clearfix">
									<div class="order_product_img">
										<a href="<?php 
    echo url_rewrite('goods:index', array('id' => $product['product_id']));
    ?>
"><img src="<?php 
    echo getAttachmentUrl($product['image']);
    ?>
"></a>
									</div>
									<div class="order_product_txt">
										<div class="order_product_txt_name"><a href="<?php 
    echo url_rewrite('goods:index', array('id' => $product['product_id']));
    ?>
"><?php 
    echo htmlspecialchars($product['name']);
    ?>
</a></div>
										<?php 
    if (is_array($product['sku_data_arr'])) {
        ?>
											<div class="order_product_txt_dec clearfix">
Example #27
0
        $brand[$key]['url'] = 'home.php?id=' . $value['store_id'];
        if (empty($value['logo'])) {
            $brand[$key]['logo'] = getAttachmentUrl('images/default_shop_2.jpg', false);
        } else {
            $brand[$key]['logo'] = getAttachmentUrl($value['logo']);
        }
    }
    //首页推荐商品
    $product_list = M('Product')->getSelling('quantity>0 AND status=1 AND is_recommend = 1', '', '', 0, 4);
    //D('Product')->where('quantity>0 AND status=1 AND is_recommend = 1')->limit('4')->select();
    //首页推荐活动
    $active_list = D('Activity_recommend')->order("is_rec desc,ucount desc")->limit(4)->select();
    $activity = M('activity');
    foreach ($active_list as $k => $value) {
        $active_list[$k]["url"] = $activity->createUrl($value, $value['model'], '1');
        $active_list[$k]["image"] = getAttachmentUrl($value['image']);
    }
} else {
    if (empty($config['platform_mall_index_page'])) {
        pigcms_tips('请管理员在管理后台【系统设置】=》【站点配置】=》【平台商城配置】选取微页面', 'none');
    }
    //首页的微杂志
    $homePage = D('Wei_page')->where(array('page_id' => $config['platform_mall_index_page']))->find();
    if (empty($homePage)) {
        pigcms_tips('您访问的店铺没有首页', 'none');
    }
}
$imUrl = getImUrl($_SESSION['wap_user']['uid'], $store_id);
$is_have_activity = option('config.is_have_activity');
//分享配置 start
$share_conf = array('title' => option('config.site_name'), 'desc' => str_replace(array("\r", "\n"), array('', ''), option('config.seo_description')), 'link' => option('config.wap_site_url'), 'imgUrl' => option('config.site_logo'), 'type' => '', 'dataUrl' => '');
Example #28
0
 public function sellers($where, $offset = 0, $limit = 0)
 {
     $sql = "SELECT *,s.status,s.drp_profit as profit FROM " . option('system.DB_PREFIX') . "store s, " . option('system.DB_PREFIX') . 'store_supplier ss WHERE s.store_id = ss.seller_id';
     if (!empty($where)) {
         foreach ($where as $key => $value) {
             if (is_array($value)) {
                 if (array_key_exists('like', $value)) {
                     $sql .= " AND " . $key . " like '" . $value['like'] . "'";
                 } else {
                     if (array_key_exists('in', $value)) {
                         $sql .= " AND " . $key . " in (" . implode(',', $value['like']) . ")";
                     }
                 }
             } else {
                 $sql .= " AND " . $key . "=" . $value;
             }
         }
     }
     $sql .= ' ORDER BY s.status ASC,s.drp_approve ASC,s.store_id DESC';
     if ($limit) {
         $sql .= ' LIMIT ' . $offset . ',' . $limit;
     }
     $sellers = $this->db->query($sql);
     foreach ($sellers as &$tmp) {
         $tmp['logo'] = getAttachmentUrl($tmp['logo']);
     }
     return $sellers;
 }
Example #29
0
 public function storeContactList($store_id_arr)
 {
     if (empty($store_id_arr) || !is_array($store_id_arr)) {
         return array();
     }
     $store_contact_list = D('')->table(array('Store' => 's', 'Store_contact' => 'sc'))->where("`s`.`store_id` IN (" . join(',', $store_id_arr) . ") AND `s`.`store_id` = `sc`.`store_id`")->field(`sc.*, s.name`)->select();
     import('area');
     $areaClass = new area();
     $return_data = array();
     foreach ($store_contact_list as $value) {
         $value['province_txt'] = $areaClass->get_name($value['province']);
         $value['city_txt'] = $areaClass->get_name($value['city']);
         $value['county_txt'] = $areaClass->get_name($value['county']);
         $value['logo'] = getAttachmentUrl($value['logo']);
         $return_data[$value['store_id']] = $value;
     }
     return $return_data;
 }
Example #30
0
                }
            }
            $cartList[$key]['buy_quantity'] = $quantity;
        } else {
            $cartList[$key]['buy_quantity'] = 0;
        }
        $cartList[$key]['sku_num'] = 0;
        if ($value['sku_id'] && $value['quantity'] && $value['status'] == 1) {
            $nowSku = $database_product_sku->field('`quantity`')->where(array('sku_id' => $value['sku_id']))->find();
            $cartList[$key]['sku_num'] = $nowSku['quantity'];
        } else {
            if ($value['quantity']) {
                $cartList[$key]['sku_num'] = $value['quantity'];
            }
        }
        $cartList[$key]['image'] = getAttachmentUrl($value['image']);
    }
    //分享配置 start
    $share_conf = array('title' => $now_store['name'], 'desc' => str_replace(array("\r", "\n"), array('', ''), $now_store['intro']), 'link' => $now_store['url'], 'imgUrl' => $now_store['logo'], 'type' => '', 'dataUrl' => '');
    import('WechatShare');
    $share = new WechatShare();
    $shareData = $share->getSgin($share_conf);
    //分享配置 end
    include display('cart');
} else {
    if ($action == 'quantity') {
        if (empty($_POST['id'])) {
            json_return(1, '数据异常');
        }
        if (!empty($_POST['skuId'])) {
            $condition_product_sku['sku_id'] = $_POST['skuId'];