Esempio n. 1
0
function get_consignee_list_ecshop68()
{
    $consignee = get_consignee($_SESSION['user_id']);
    $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_address') . " WHERE user_id = '" . $_SESSION['user_id'] . "' order by address_id ";
    $consignee_list_ecshop68 = $GLOBALS['db']->getAll($sql);
    foreach ($consignee_list_ecshop68 as $cons_key => $cons_val) {
        $consignee_list_ecshop68[$cons_key]['address_short_name'] = $cons_val['consignee'] . "<br>";
        $consignee_list_ecshop68[$cons_key]['address_short_name'] .= get_region_info($cons_val['province']) . "-";
        $consignee_list_ecshop68[$cons_key]['address_short_name'] .= get_region_info($cons_val['city']) . "-";
        $consignee_list_ecshop68[$cons_key]['address_short_name'] .= get_region_info($cons_val['district']) . "&nbsp;";
        $consignee_list_ecshop68[$cons_key]['address_short_name'] .= sub_str($cons_val['address'], 16);
        $consignee_list_ecshop68[$cons_key]['address_short_name'] .= $cons_val['zipcode'] ? "," . $cons_val['zipcode'] : "";
        $consignee_list_ecshop68[$cons_key]['address_short_name'] .= "<br>" . ($cons_val['tel'] != '--' ? $cons_val['tel'] : $cons_val['mobile']);
        if ($consignee['address_id'] == $cons_val['address_id']) {
            $consignee_list_ecshop68[$cons_key]['def_addr'] = 1;
            $have_def_addr = 1;
        }
    }
    if (count($consignee_list_ecshop68) && !$have_def_addr) {
        $consignee_list_ecshop68[0]['def_addr'] = 1;
    }
    return $consignee_list_ecshop68;
}
Esempio n. 2
0
/**
 * 获取店铺店铺街中的店铺
 */
function get_all_supplier()
{
    global $tpl;
    $is_search = 0;
    //是否是搜索过来的
    $filter['id'] = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']);
    $filter['keywords'] = isset($_REQUEST['keywords']) ? trim(addslashes(htmlspecialchars($_REQUEST['keywords']))) : '';
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'sort_order' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'ASC' : trim($_REQUEST['sort_order']);
    /* 分页大小 */
    $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
    if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
        $filter['page_size'] = intval($_REQUEST['page_size']);
    } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
        $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
    } else {
        $filter['page_size'] = 13;
    }
    $filter['start'] = ($filter['page'] - 1) * $filter['page_size'];
    $where = " where status=1 and is_show=1 ";
    if ($filter['id']) {
        $where .= ' and supplier_type=' . $filter['id'];
    }
    if ($filter['keywords'] && $filter['keywords'] != '请输入关键词') {
        $is_search = 1;
        $tpl = 'search_store.dwt';
        $GLOBALS['smarty']->assign('search_keywords', stripslashes(htmlspecialchars_decode($_REQUEST['keywords'])));
        $where .= " and supplier_id in(SELECT DISTINCT supplier_id\n\t\t\t\tFROM " . $GLOBALS['ecs']->table('supplier_shop_config') . " AS ssc\n\t\t\t\tWHERE (\n\t\t\t\tcode = 'shop_name'\n\t\t\t\tAND value LIKE '%" . $filter['keywords'] . "%'\n\t\t\t\t)\n\t\t\t\tOR (\n\t\t\t\tcode = 'shop_keywords'\n\t\t\t\tAND value LIKE '%" . $filter['keywords'] . "%'\n\t\t\t\t))";
    }
    $GLOBALS['smarty']->assign('issearch', $is_search);
    /* 记录总数 */
    $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('supplier_street') . " {$where}";
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
    $sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table('supplier_street') . " {$where}" . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ",{$filter['page_size']}";
    $arr = $GLOBALS['db']->getAll($sql);
    foreach ($arr as $key => $val) {
        $arr[$key]['address'] = "";
        //地址
        $shopinfo = $GLOBALS['db']->getAll("select code,value from " . $GLOBALS['ecs']->table('supplier_shop_config') . " where supplier_id=" . $val['supplier_id'] . " and code in('shop_closed','shop_name','shop_keywords','shop_province','shop_city','shop_address','qq','ww')");
        foreach ($shopinfo as $k => $v) {
            if ($is_search) {
                $v['value'] = str_replace($filter['keywords'], "<font color=red>" . $filter['keywords'] . "</font>", $v['value']);
            }
            $arr[$key][$v['code']] = $v['value'];
        }
        //所在地
        if (!empty($arr[$key]['shop_address'])) {
            $arr[$key]['address'] = ',' . $arr[$key]['shop_address'];
        }
        if (!empty($arr[$key]['shop_city'])) {
            $arr[$key]['address'] = ',' . get_region_info($arr[$key]['shop_city']) . $arr[$key]['address'];
        }
        if (!empty($arr[$key]['shop_province'])) {
            $arr[$key]['address'] = get_region_info($arr[$key]['shop_province']) . $arr[$key]['address'];
        }
        $arr[$key]['address'] = trim($arr[$key]['address'], ',');
        //店铺中有多少商品
        $goodsInfo = get_street_goods_info($val['supplier_id']);
        $arr[$key]['goods_number'] = $goodsInfo['num'];
        $arr[$key]['goods_info'] = $goodsInfo['info'];
    }
    return array('shops' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Esempio n. 3
0
function get_consignee_list_ecshop68()
{
    $consignee = get_consignee($_SESSION['user_id']);
    $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_address') . " WHERE user_id = '" . $_SESSION['user_id'] . "' order by address_id ";
    $consignee_list_ecshop68 = $GLOBALS['db']->getAll($sql);
    foreach ($consignee_list_ecshop68 as $cons_key => $cons_val) {
        $consignee_list_ecshop68[$cons_key]['province'] = get_region_info($cons_val['province']);
        $consignee_list_ecshop68[$cons_key]['city'] = get_region_info($cons_val['city']);
        $consignee_list_ecshop68[$cons_key]['district'] = get_region_info($cons_val['district']);
        $consignee_list_ecshop68[$cons_key]['address'] = $cons_val['address'];
        $consignee_list_ecshop68[$cons_key]['mobile'] = $cons_val['mobile'];
        $consignee_list_ecshop68[$cons_key]['tel'] = $cons_val['tel'];
        if ($consignee['address_id'] == $cons_val['address_id']) {
            $consignee_list_ecshop68[$cons_key]['def_addr'] = 1;
            $have_def_addr = 1;
        }
    }
    if (count($consignee_list_ecshop68) && !$have_def_addr) {
        $consignee_list_ecshop68[0]['def_addr'] = 1;
    }
    return $consignee_list_ecshop68;
}
Esempio n. 4
0
  * 如果没有登录则跳转到登录和注册页面
  */
 if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0) {
     /* 用户没有登录且没有选定匿名购物,转向到登录页面 */
     $result['error'] = 2;
     $result['result'] = $_LANG['no_goods_in_cart'];
     die($json->encode($result));
     // ecs_header("Location: flow.php?step=login\n");
     //exit;
 }
 $consignee = get_consignee($_SESSION['user_id']);
 //$smarty->assign('consignee', $consignee);
 if (!empty($consignee) && $_SESSION['user_id'] > 0) {
     $consignee['address_short_name'] .= get_region_info($consignee['province']) . "-";
     $consignee['address_short_name'] .= get_region_info($consignee['city']) . "-";
     $consignee['address_short_name'] .= get_region_info($consignee['district']) . "&nbsp;";
     $consignee['address_short_name'] .= sub_str($consignee['address'], 16);
     $consignee['address_short_name'] .= $consignee['zipcode'] ? "," . $consignee['zipcode'] : "";
 }
 /* 代码增加_start  By  www.68ecshop.com */
 $smarty->assign('consignee_list', $consignee);
 $smarty->assign('shop_province_list', get_regions(1, $_CFG['shop_country']));
 /* 代码增加_end  By  www.68ecshop.com */
 /* 对商品信息赋值 */
 $cart_goods = cart_goods($flow_type);
 // 取得商品列表,计算合计
 /*
  * 分供货商显示商品
  */
 $cart_ids = $cart_goods_new = array();
 if (count($cart_goods) > 0) {