//源码由旺旺:ecshop2012所有 未经允许禁止倒卖 一经发现停止任何服务

function get_news_cat_articles($cat_id, $page = 1, $size = 20, $condition = '1')

{

if ($cat_id == '-1') {

$cat_str = 'cat_id > 0';

}

else {

$cat_str = get_article_children($cat_id);

}

$sql = 'SELECT article_id, title, author, add_time, file_url, open_type,description' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' WHERE is_open = 1 AND ' . $cat_str . ' and ' . $condition . ' ORDER BY article_type DESC, article_id DESC';

$res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);

$arr = array();

if ($res) {

while ($row = $GLOBALS['db']->fetchRow($res)) {

$article_id = $row['article_id'];

$arr[$article_id]['id'] = $article_id;

$arr[$article_id]['title'] = $row['title'];

$arr[$article_id]['short_title'] = 0 < $GLOBALS['_CFG']['article_title_length'] ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];

$arr[$article_id]['author'] = empty($row['author']) || ($row['author'] == '_SHOPHELP') ? $GLOBALS['_CFG']['shop_name'] : $row['author'];

$arr[$article_id]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $article_id), $row['title']) : trim($row['file_url']);

$arr[$article_id]['add_time'] = date('Y.m.d', $row['add_time']);

$arr[$article_id]['description'] = trim($row['description']);

$arr[$article_id]['file_url'] = $row['file_url'];

}

}

return $arr;

}

function get_news_goods_list($cat_id, $num)

{

$sql = 'Select g.goods_id,g.cat_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price, g.promote_price, ' . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, g.seller_note, ' . 'g.is_new, g.is_new, g.is_hot, g.is_promote, g.add_time, g.last_update ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = 1 ';

$cats = get_children($cat_id);

$where = (!empty($cats) ? 'AND (' . $cats . ' OR ' . get_extension_goods($cats) . ') ' : '');

$sql .= $where . ' order by g.goods_id desc LIMIT ' . $num . ' ';

$res = $GLOBALS['db']->getAll($sql);

$goods = array();

foreach ($res as $idx => $row) {

$goods[$idx]['id'] = $row['goods_id'];

$goods[$idx]['name'] = $row['goods_name'];

$goods[$idx]['brief'] = $row['goods_brief'];

$goods[$idx]['brand_name'] = $row['brand_name'];

$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);

$goods[$idx]['short_name'] = 0 < $GLOBALS['_CFG']['goods_name_length'] ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];

$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);

$goods[$idx]['market_price'] = price_format($row['market_price']);

$goods[$idx]['shop_price'] = price_format($row['shop_price']);

$goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];

$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];

$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);

$goods[$idx]['seller_note'] = $row['seller_note'];

$goods[$idx]['add_time'] = date('Y.m', $row['add_time']);

}

return $goods;

}

function get_article_cat_info($cat_id)

{

$sql = 'SELECT cat_id, cat_name FROM ' . $GLOBALS['ecs']->table('article_cat') . ' WHERE cat_id = \'' . $cat_id . '\'';

$res = $GLOBALS['db']->getRow($sql);

return $res;

}

function get_new_articles($cat_id = 0, $limit = 12)

{

$condition = get_article_children($cat_id);

$sql = 'SELECT a.article_id, a.content, a.title, ac.cat_name, a.add_time, a.description, a.file_url, a.open_type, ac.cat_id, ac.cat_name ' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac' . ' WHERE a.is_open = 1 AND article_type=0 and a.cat_id = ac.cat_id AND ac.' . $condition . ' ORDER BY a.article_type DESC, a.add_time DESC LIMIT ' . $limit;

$res = $GLOBALS['db']->getAll($sql);

$arr = array();

foreach ($res as $idx => $row) {

$arr[$idx]['id'] = $row['article_id'];

$arr[$idx]['title'] = $row['title'];

$arr[$idx]['content'] = $row['content'];

$arr[$idx]['description'] = $row['description'];

$arr[$idx]['short_title'] = 0 < $GLOBALS['_CFG']['article_title_length'] ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];

$arr[$idx]['cat_name'] = $row['cat_name'];

$arr[$idx]['add_time'] = local_date('Y.m.d', $row['add_time']);

$arr[$idx]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']);

$arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']);

$arr[$idx]['file_url'] = $row['file_url'];

}

return $arr;

}

function get_hot_goods_list($cat_id, $num)

{

$sql = 'Select g.goods_id,g.cat_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price, g.promote_price, ' . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, g.seller_note, ' . 'g.is_new, g.is_new, g.is_hot, g.is_promote, g.add_time, g.last_update ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_hot = 1 AND (' . $cat_id . ' OR ' . get_extension_goods($cat_id) . ')';

$cats = get_children($cat_id);

$where = (!empty($cats) ? 'AND (' . $cats . ' OR ' . get_extension_goods($cats) . ') ' : '');

$sql .= $where . ' order by g.goods_id desc LIMIT ' . $num . ' ';

$res = $GLOBALS['db']->getAll($sql);

$goods = array();

foreach ($res as $idx => $row) {

$goods[$idx]['id'] = $row['goods_id'];

$goods[$idx]['name'] = $row['goods_name'];

$goods[$idx]['brief'] = $row['goods_brief'];

$goods[$idx]['brand_name'] = $row['brand_name'];

$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);

$goods[$idx]['short_name'] = 0 < $GLOBALS['_CFG']['goods_name_length'] ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];

$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);

$goods[$idx]['market_price'] = price_format($row['market_price']);

$goods[$idx]['shop_price'] = price_format($row['shop_price']);

$goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];

$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];

$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);

$goods[$idx]['seller_note'] = $row['seller_note'];

$goods[$idx]['add_time'] = date('Y.m.d', $row['add_time']);

$goods[$idx]['last_update'] = date('Y.m', $row['last_update']);

}

return $goods;

}

function get_best_goods_list($cat_id, $num)

{

$sql = 'Select g.goods_id,g.cat_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price, g.promote_price, ' . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, g.seller_note, ' . 'g.is_new, g.is_new, g.is_hot, g.is_promote, g.add_time, g.last_update ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = 1 AND (' . $cat_id . ' OR ' . get_extension_goods($cat_id) . ')';

$cats = get_children($cat_id);

$where = (!empty($cats) ? 'AND (' . $cats . ' OR ' . get_extension_goods($cats) . ') ' : '');

$sql .= $where . ' order by g.goods_id desc LIMIT ' . $num . ' ';

$res = $GLOBALS['db']->getAll($sql);

$goods = array();

foreach ($res as $idx => $row) {

$goods[$idx]['id'] = $row['goods_id'];

$goods[$idx]['name'] = $row['goods_name'];

$goods[$idx]['brief'] = $row['goods_brief'];

$goods[$idx]['brand_name'] = $row['brand_name'];

$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);

$goods[$idx]['short_name'] = 0 < $GLOBALS['_CFG']['goods_name_length'] ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];

$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);

$goods[$idx]['market_price'] = price_format($row['market_price']);

$goods[$idx]['shop_price'] = price_format($row['shop_price']);

$goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];

$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];

$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);

$goods[$idx]['seller_note'] = $row['seller_note'];

$goods[$idx]['add_time'] = date('Y.m', $row['add_time']);

$goods[$idx]['last_update'] = date('Y.m', $row['last_update']);

}

return $goods;

}

define('IN_ECS', true);

require dirname(__FILE__) . '/includes/init.php';

require ROOT_PATH . '/includes/lib_area.php';

if ((DEBUG_MODE & 2) != 2) {

$smarty->caching = true;

}

$area_info = get_area_info($province_id);

$area_id = $area_info['region_id'];

$where = 'regionId = \'' . $province_id . '\'';

$date = array('parent_id');

$region_id = get_table_date('region_warehouse', $where, $date, 2);

if (isset($_COOKIE['region_id']) && !empty($_COOKIE['region_id'])) {

$region_id = $_COOKIE['region_id'];

}

$custom_cata_id = 1;

$custom_catb_id = 6;

$cat_id = 1;

$video_cat_id = 12;

$custom_cata_right_id = 17;

$custom_catb_right_id = 858;

$cache_id = sprintf('%X', crc32('news-' . $_CFG['lang']));

if (!$smarty->is_cached('news.dwt', $cache_id)) {

assign_template('a', array($cat_id));

$position = assign_ur_here($cat_id);

$smarty->assign('page_title', $position['title']);

$smarty->assign('ur_here', $position['ur_here']);

$smarty->assign('categories', get_categories_tree(0));

$smarty->assign('article_categories', article_categories_tree($cat_id));

$smarty->assign('helps', get_shop_help());

if (defined('THEME_EXTENSION')) {

$categories_pro = get_category_tree_leve_one();

$smarty->assign('categories_pro', $categories_pro);

}

$meta = $db->getRow('SELECT cat_name, keywords, cat_desc FROM ' . $ecs->table('article_cat') . ' WHERE cat_id = \'' . $cat_id . '\'');

if (($meta === false) || empty($meta)) {

ecs_header("Location: ./\n");

exit();

}

$smarty->assign('cat_id', $cat_id);

$smarty->assign('custom_cata_id', $custom_cata_id);

$smarty->assign('custom_catb_id', $custom_catb_id);

$smarty->assign('cat_name', htmlspecialchars($meta['cat_name']));

$smarty->assign('keywords', htmlspecialchars($meta['keywords']));

$smarty->assign('description', htmlspecialchars($meta['cat_desc']));

$smarty->assign('themes_path', 'themes/' . $_CFG['template']);

for ($i = 1; $i <= $_CFG['auction_ad']; $i++) {

$article_channel_left_ad .= '\'article_channel_left_ad' . $i . ',';

$notic_down_ad .= '\'notic_down_ad' . $i . ',';

}

$smarty->assign('article_channel_left_ad', $article_channel_left_ad);

$smarty->assign('notic_down_ad', $notic_down_ad);

$smarty->assign('top_articles', get_news_cat_articles($cat_id, 1, 2, 'article_type=1'));

$smarty->assign('new_articles', get_news_cat_articles($cat_id, 1, 5, 'article_type=0'));

$smarty->assign('notice_articles', get_news_cat_articles(13, 1, 6));

$smarty->assign('new_articles', get_news_cat_articles(5, 1, 6));

$smarty->assign('serve_articles', get_news_cat_articles(8, 1, 6));

$smarty->assign('pay_articles', get_news_cat_articles(7, 1, 6));

$cat_child_list = article_cat_list($cat_id, 0, false);

if (is_array($cat_child_list)) {

foreach ($cat_child_list as $key => $vo) {

if ($vo['parent_id'] == $cat_id) {

$articles_list[$key] = get_new_articles($key, 5);

}

else {

unset($cat_child_list[$key]);

}

}

}

$smarty->assign('cat_child_list', $cat_child_list);

$smarty->assign('articles_list', $articles_list);

$cat_select = array('cat_name', 'keywords', 'cat_desc', 'style', 'grade', 'filter_attr', 'parent_id');

$cat = get_cat_info($custom_catb_id, $cat_select);

$smarty->assign('custom_catb_info', $cat);

$smarty->assign('cat_childb_list', get_child_tree($custom_catb_id));

$smarty->assign('hot_goods', get_hot_goods_list($custom_catb_id, 9));

$smarty->assign('best_goods', get_best_goods_list($custom_catb_id, 8));

$new_articles_2_info = get_article_cat_info(10);

$smarty->assign('new_articles_2_info', $new_articles_2_info);

$smarty->assign('new_articles_2', get_new_articles($custom_catb_right_id, 9));

$smarty->assign('video_cat_info', get_article_cat_info($video_cat_id));

$smarty->assign('cat_id_articles_video', get_new_articles($video_cat_id, 11));

for ($i = 1; $i <= $_CFG['auction_ad']; $i++) {

$news_banner_small_left .= '\'news_banner_small_left' . $i . ',';

}

for ($i = 1; $i <= $_CFG['auction_ad']; $i++) {

$news_banner_small_right .= '\'news_banner_small_right' . $i . ',';

}

$smarty->assign('news_banner_small_left', $news_banner_small_left);

$smarty->assign('news_banner_small_right', $news_banner_small_right);

assign_dynamic('news');

}

$smarty->display('news.dwt', $cache_id);

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

php大商创商城,news.php · Mihok/ecshop大商创商城 - Gitee.com相关推荐

  1. 大商创x支持mysql版本_大商创x全面升级2.0,匠心打造b2b2c多用户商城系统

    2018年大商创发布了全新的产品--大商创X,因为众多用户对大商创产品的期待,所以大商创X一经面世就引起大家的极大关注,这与其系统优势有着密不可分的联系. 如今距离第一代产品发布近2年时间,大商创X也 ...

  2. 线上商城小程序的8大必备功能,让你的电商无往不利!

    随着移动互联网的快速发展,线上商城小程序已经成为了许多企业必不可少的销售渠道之一.那么,在众多的线上商城中,如何让自己的小程序脱颖而出呢?本文将分享8个必备功能,并通过一个案例来具体解析如何利用这些功 ...

  3. 商淘多b2b2c商城系统怎么在个人电脑上安装_b2b2c商城系统免费模板怎么用?

    b2b2c商城系统在电商行业中算是一个大型的项目系统了,开发这样的系统也需要花费较多的成本,对于一些小型商家来说没有足够的资金与实力进行定制开发,只能在网上寻找免费的系统模板.那么b2b2c商城系统免 ...

  4. 小程序和vue语法对比_商城小程序对比传统电商的优势如何?

    自移动互联网兴起后,许多企业都将自己的业务重心转移到移动端.目前,小程序发展异常火爆,大家都争先恐后,通过长沙小程序开发,来布局自己的商城小程序.不过由于小程序发展较短,许多企业对此不甚了解.那么接下 ...

  5. HTML5期末大作业:商城网站设计——仿天猫商城(9页) HTML+CSS大作业_ 网页制作作业_疫情防控网页设计...

    HTML5期末大作业:商城网站设计--仿天猫商城(9页) HTML+CSS大作业: 网页制作作业_疫情防控网页设计- 常见网页设计作业题材有 个人. 美食. 公司. 学校. 旅游. 电商. 宠物. 电 ...

  6. HTML5期末大作业:仿唯品会购物网站设计——仿唯品会购物商城(5页) HTML+CSS+JavaScript 学生DW网页设计作业成品 商城网站设计

    HTML5期末大作业:仿唯品会购物网站设计--仿唯品会购物商城(5页) HTML+CSS+JavaScript 学生DW网页设计作业成品 商城网站设计 常见网页设计作业题材有 个人. 美食. 公司. ...

  7. 电商平台促销管理功能解析,数商云S2B2C商城系统开启日化行业数字零售新模式

    传统线下购物场景中,我们通常能见到许多促销活动,比如说买赠活动.清仓打折活动和代金券活动等,商家通过这些活动实现库存的清理与销售额的提升.随着互联网电商的发展,网上零售规模持续增长,消费场景加速向线上 ...

  8. HTML5期末大作业:时尚服装购物网站设计——时尚服装购物商城(16页) 关于时尚购物HTML网页设计-----服装

    HTML5期末大作业:时尚服装购物网站设计--时尚服装购物商城(16页) 关于时尚购物HTML网页设计-----服装 常见网页设计作业题材有 个人. 美食. 公司. 学校. 旅游. 电商. 宠物. 电 ...

  9. 数商云:“沸腾的”数字经济大时代,平台战略提速工业数字化转型

    5G.大数据.工业互联网.云计算.人工智能等新一代信息技术与行业经济深度融合,加快了工业经济数字化.网络化.智能化进程,从根本上改变了经济发展方式.重塑了全球产业链分工. 数字经济正以"变局 ...

最新文章

  1. ssd网络结构_SSD论文与代码详解
  2. 061_打印斐波那契数列(100以内)
  3. pom.xml中添加阿里云Maven中央仓库配置
  4. 程序猿怎样的生活方式才能兼顾工作、家庭和自我提升
  5. 普通用户竟这样执行xp_cmdshell存储过程!
  6. Android NDK开发之旅25 NDK 模仿QQ变声特效
  7. 安装qt5后编译运行后有关Qt at-spi的警告
  8. ASCII码不可见字符过滤处理
  9. lammps运行Linux,Lammps安装教程
  10. html小写罗马字符怎么写,如何在 LATEX 中插入大小写的罗马字符
  11. 微信小程序使用彩色图标(阿里巴巴矢量图标库)(炒鸡详细)
  12. Microsoft Network Monitor的select network栏空白
  13. Linux系统中VI或VIM输入时小键盘无法使用
  14. 可视化开发平台的内容介绍
  15. 密码与安全新技术专题
  16. IEEE754标准表示浮点数(详解)
  17. 两个同一牌子无线路由器连接设置步骤!实用!
  18. android 错误中英互译,安卓手机Recovery模式刷机情况下的中英文对照翻译
  19. STM32 MPU6050与匿名上位机通讯(V2.6版)
  20. 如何高枕无忧地使用PostgreSQL?

热门文章

  1. 行业垂直类网站的电子商务
  2. php安全新闻早八点-Microdoor-第四季
  3. MobileNet网络学习笔记
  4. 网络变压器作用:广泛应用在有线局域网中的网络变压器的作用是什么?
  5. 云闪付怎么对接三方php,第三方支付-银联云闪付开发教程
  6. FPGA-炼狱传奇-三态门之战
  7. Linux未来猜想:被遗忘还是终结Windows?
  8. 计算机硬件创意海报,游戏设计一机搞定 机械师创物者设计本评测
  9. SAP开发框架系列之 自定义单据
  10. 【U8】禁止UU(UTU)随登陆账套启动(U8V11.0及其以上版本)