本文整理汇总了PHP中assign_cat_goods函数的典型用法代码示例。如果您正苦于以下问题:PHP assign_cat_goods函数的具体用法?PHP assign_cat_goods怎么用?PHP assign_cat_goods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assign_cat_goods函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
require dirname(__FILE__) . '/includes/init.php';
$c_id = !empty($_GET['c_id']) ? intval($_GET['c_id']) : 0;
if ($c_id <= 0) {
exit;
}
$cat_array = get_categories_tree($c_id);
$smarty->assign('c_id', $c_id);
$cat_name = $db->getOne('SELECT cat_name FROM ' . $ecs->table('category') . ' WHERE cat_id=' . $c_id);
$smarty->assign('cat_name', encode_output($cat_name));
if (!empty($cat_array[$c_id]['children'])) {
foreach ($cat_array[$c_id]['children'] as $key => $child_data) {
$cat_array[$c_id]['children'][$key]['name'] = encode_output($child_data['name']);
}
$smarty->assign('cat_children', $cat_array[$c_id]['children']);
}
$cat_goods = assign_cat_goods($c_id, 0, 'wap');
$num = count($cat_goods['goods']);
if ($num > 0) {
$page_num = '10';
$page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
$pages = ceil($num / $page_num);
if ($page <= 0) {
$page = 1;
}
if ($pages == 0) {
$pages = 1;
}
if ($page > $pages) {
$page = $pages;
}
$i = 1;
示例2: assign_dynamic
/**
* 获得指定页面的动态内容
*
* @access public
* @param string $tmp 模板名称
* @return void
*/
function assign_dynamic($tmp)
{
$sql = 'SELECT id, number, type FROM ' . $GLOBALS['ecs']->table('touch_template') . " WHERE filename = '{$tmp}' AND type > 0 AND remarks ='' AND theme='" . $GLOBALS['_CFG']['template'] . "'";
$res = $GLOBALS['db']->getAll($sql);
foreach ($res as $row) {
switch ($row['type']) {
case 1:
/* 分类下的商品 */
$GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number']));
break;
case 2:
/* 品牌的商品 */
$brand_goods = assign_brand_goods($row['id'], $row['number']);
$GLOBALS['smarty']->assign('brand_goods_' . $row['id'], $brand_goods['goods']);
$GLOBALS['smarty']->assign('goods_brand_' . $row['id'], $brand_goods['brand']);
break;
case 3:
/* 文章列表 */
$cat_articles = assign_articles($row['id'], $row['number']);
$GLOBALS['smarty']->assign('articles_cat_' . $row['id'], $cat_articles['cat']);
$GLOBALS['smarty']->assign('articles_' . $row['id'], $cat_articles['arr']);
break;
}
}
}
示例3: get_promotion_info
$smarty->assign('data_dir', DATA_DIR);
$smarty->assign('brand_list', $brand_list);
$smarty->assign('promotion_info', get_promotion_info());
/* 调查 */
$vote = get_vote();
if (!empty($vote)) {
$smarty->assign('vote_id', $vote['id']);
$smarty->assign('vote', $vote['content']);
}
$smarty->assign('best_goods', get_category_recommend_goods('best', $children, $brand, $price_min, $price_max, $ext));
$smarty->assign('promotion_goods', get_promote_goods($cat_id, 3));
$smarty->assign('hot_goods', get_category_recommend_goods('hot', $children, $brand, $price_min, $price_max, $ext, 6));
$sql = "SELECT cat_id,cat_name FROM " . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '{$cat_id}' AND is_show_cate = 1 ORDER BY sort_order";
$res = $GLOBALS['db']->getAll($sql);
foreach ($res as $v) {
$str[$v['cat_id']]['goods'] = assign_cat_goods($v['cat_id'], $num = 10, 'cate');
$mysql = "SELECT cat_id,cat_name FROM " . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '" . $v['cat_id'] . "' AND is_show_cate = 1";
$result = $GLOBALS['db']->getAll($mysql);
$cat_arr = array();
if ($result) {
foreach ($result as $key => $val) {
$cat_arr[$key]['url'] = build_uri('category', array('cid' => $val['cat_id']), $val['cat_name']);
$cat_arr[$key]['cat_name'] = $val['cat_name'];
}
$str[$v['cat_id']]['category'] = $cat_arr;
//子分类
} else {
$str[$v['cat_id']]['category'] = '';
}
$str[$v['cat_id']]['top'] = get_top10($v['cat_id'], 5);
//分类排行
示例4: get_categories_tree
$cat_array = get_categories_tree($c_id);
$smarty->assign('c_id', $c_id);
$cat_name = $db->getOne('SELECT cat_name FROM ' . $ecs->table('category') . ' WHERE cat_id=' . $c_id);
$smarty->assign('cat_name', encode_output($cat_name));
if (!empty($cat_array[$c_id]['cat_id'])) {
foreach ($cat_array[$c_id]['cat_id'] as $key => $child_data) {
$cat_array[$c_id]['cat_id'][$key]['name'] = encode_output($child_data['name']);
}
$smarty->assign('cat_children', $cat_array[$c_id]['cat_id']);
}
if (empty($_GET['order_price'])) {
$order_rule = 'ORDER BY g.shop_price ASC, g.sort_order';
} else {
$order_rule = 'ORDER BY g.shop_price DESC, g.sort_order';
}
$cat_goods = assign_cat_goods($c_id, 0, 'wap', $order_rule);
$num = count($cat_goods['goods']);
if ($num > 0) {
$page_num = '10';
$page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
$pages = ceil($num / $page_num);
if ($page <= 0) {
$page = 1;
}
if ($pages == 0) {
$pages = 1;
}
if ($page > $pages) {
$page = $pages;
}
$i = 1;
示例5: JSON
// zhangyh_100322
include_once 'includes/cls_json.php';
$json = new JSON();
$result = array('error' => 0, 'content' => '', 'type' => $rec_type, 'cat_id' => $cat_id, 'topcat_id' => $topcat_id);
// zhangyh_100322
$children = get_children($cat_id);
//$smarty->assign($rec_array[$rec_type] . '_goods', get_category_recommend_goods($rec_array[$rec_type], $children)); // 推荐商品zhangyh_100322
$smarty->assign('cat_rec_sign', 1);
/**
* zhangyh_100322 start
* 下面这块有修改,加了一个判断
*/
if ($rec_type == 4) {
$sql = "select number from " . $ecs->table("template") . " where filename='index' and library='/library/cat_goods.lbi' and id={$topcat_id} and theme='{$_CFG['template']}' limit 1";
$number = $db->getOne($sql);
$smarty->assign($rec_array[$rec_type] . '_goods', assign_cat_goods($cat_id, $number, '123', 'goods'));
// 小类下的产品
$result['content'] = $smarty->fetch('library/cat_goods.lbi');
} else {
$smarty->assign($rec_array[$rec_type] . '_goods', get_category_recommend_goods($rec_array[$rec_type], $children));
// 推荐商品
$result['content'] = $smarty->fetch('library/recommend_' . $rec_array[$rec_type] . '.lbi');
}
/* zhangyh_100322 end */
die($json->encode($result));
}
/*------------------------------------------------------ */
//-- 判断是否存在缓存,如果存在则调用缓存,反之读取相应内容
/*------------------------------------------------------ */
/* 缓存编号 */
assign_template();
示例6: assign_dynamic
/**
* 获得指定页面的动态内容
*
* @access public
* @param string $tmp 模板名称
* @return void
*/
function assign_dynamic($tmp)
{
$sql = 'SELECT region,id, number, type FROM ' . $GLOBALS['ecs']->table('template') . " WHERE filename = '{$tmp}' AND type > 0 AND remarks ='' AND theme='" . $GLOBALS['_CFG']['template'] . "'";
$res = $GLOBALS['db']->getAll($sql);
//dump($res);
foreach ($res as $row) {
switch ($row['type']) {
case 1:
/* 加入拿商品条件 */
if ($tmp == 'index') {
$nature = '';
if (strpos($row['region'], '新品') !== false) {
$nature = 'new';
} elseif (strpos($row['region'], '精品') !== false) {
$nature = 'best';
}
}
//echo $nature.'<br/>';
//dump(assign_cat_goods($row['id'], $row['number'],'web','','1',$tmp,$nature));
/* 分类下的商品 */
$GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number'], 'web', '', '1', $tmp, $nature));
//echo'<pre>';
//print_r(assign_cat_goods($row['id'], $row['number']));
break;
case 2:
/* 品牌的商品 */
$brand_goods = assign_brand_goods($row['id'], $row['number']);
$GLOBALS['smarty']->assign('brand_goods_' . $row['id'], $brand_goods['goods']);
$GLOBALS['smarty']->assign('goods_brand_' . $row['id'], $brand_goods['brand']);
break;
case 3:
/* 文章列表 */
$cat_articles = assign_articles($row['id'], $row['number']);
$GLOBALS['smarty']->assign('articles_cat_' . $row['id'], $cat_articles['cat']);
$GLOBALS['smarty']->assign('articles_' . $row['id'], $cat_articles['arr']);
break;
}
}
//die;
}