Exemplo n.º 1
0
function address_to_store()
{
    $_COOKIE['region_3'] = 0;
    //把第三级设置成空
    $_COOKIE['region_4'] = 0;
    //把第四级设置成空
    $address = cookie_to_str();
    //组织地址
    $stockArray = get_address_by_store($address);
    //查询地址对应哪些仓库
    $goodsIds = get_index_goods($stockArray);
    //获取仓库下的所有商品id
    return $goodsIds;
}
Exemplo n.º 2
0
function get_index_categories_type_good()
{
    $sql = 'SELECT cat_id,cat_name ,parent_id,is_show ' . 'FROM ' . $GLOBALS['ecs']->table('category') . "WHERE parent_id = 0 AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC";
    $res = $GLOBALS['db']->getAll($sql);
    foreach ($res as $row) {
        if ($row['is_show']) {
            $cat_arr[$row['cat_id']]['id'] = $row['cat_id'];
            $cat_arr[$row['cat_id']]['name'] = $row['cat_name'];
            $cat_arr[$row['cat_id']]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']);
            $cat_arr[$row['cat_id']]['hot'] = get_index_goods($row['cat_id'], "hot");
            $cat_arr[$row['cat_id']]['new'] = get_index_goods($row['cat_id'], "new");
            $cat_arr[$row['cat_id']]['best'] = get_index_goods($row['cat_id'], "best");
            $cat_arr[$row['cat_id']]['promote'] = get_index_goods($row['cat_id'], "promote");
            if (isset($row['cat_id']) != NULL) {
                $cat_arr[$row['cat_id']]['cat_id'] = get_child_tree($row['cat_id']);
            }
        }
    }
    if (isset($cat_arr)) {
        return $cat_arr;
    }
}