本文整理汇总了PHP中bm函数的典型用法代码示例。如果您正苦于以下问题:PHP bm函数的具体用法?PHP bm怎么用?PHP bm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bm函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_header_gcategories
function get_header_gcategories($amount, $position, $brand_is_recommend = 1)
{
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = array();
if (!$amount) {
$gcategories = $gcategory_mod->get_list(-1, true);
} else {
$gcategory = $gcategory_mod->get_list(0, true);
$gcategories = $gcategory;
foreach ($gcategory as $val) {
$result = $gcategory_mod->get_list($val['cate_id'], true);
$result = array_slice($result, 0, $amount);
$gcategories = array_merge($gcategories, $result);
}
}
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$gcategory_list = $tree->getArrayList(0);
$i = 0;
$brand_mod =& m('brand');
foreach ($gcategory_list as $k => $v) {
$gcategory_list[$k]['top'] = isset($position[$i]) ? $position[$i] : '0px';
$i++;
$gcategory_list[$k]['brands'] = $brand_mod->find(array('conditions' => "tag = '" . $v['value'] . "' AND recommended=" . $brand_is_recommend, 'order' => 'sort_order asc,brand_id desc'));
}
return array('gcategories' => $gcategory_list);
}
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:28,代码来源:main.widget.php
示例2: _get_data
function _get_data()
{
$this->options['amount'] = intval($this->options['amount']);
$cache_server =& cache_server();
$key = $this->_get_cache_id();
$data = $cache_server->get($key);
if ($data === false) {
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = array();
if (empty($this->options['amount'])) {
$gcategories = $gcategory_mod->get_list(-1, true);
} else {
$gcategory = $gcategory_mod->get_list(0, true);
$gcategories = $gcategory;
foreach ($gcategory as $val) {
$result = $gcategory_mod->get_list($val['cate_id'], true);
$result = array_slice($result, 0, $this->options['amount']);
$gcategories = array_merge($gcategories, $result);
}
}
import('tree.lib');
$tree = new Tree();
//LLL 商品分类挂件根据语言选择分类字段
$lang2 = get_lang2();
//like fr,sc etc...
$gcategories = chg_array2_string($gcategories, 'cate_name', $lang2);
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$data = $tree->getArrayList(0);
$cache_server->set($key, $data, $this->_ttl);
}
return $data;
}
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:32,代码来源:main.widget.php
示例3: _get_data
function _get_data()
{
$cache_server =& cache_server();
$key = $this->_get_cache_id();
$data = $cache_server->get($key);
if ($data === false) {
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = array();
$brand_mod =& m('brand');
if (empty($this->options['amount'])) {
$gcategories = $gcategory_mod->get_list(-1, true);
} else {
$gcategory = $gcategory_mod->get_list(0, true);
$gcategories = $gcategory;
foreach ($gcategory as $val) {
$result = $gcategory_mod->get_list($val['cate_id'], true);
$result = array_slice($result, 0, $this->options['amount']);
$gcategories = array_merge($gcategories, $result);
}
}
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$data = array('gcategories' => $tree->getArrayList(0), 'model_name' => $this->options['model_name'], 'brands' => $brand_mod->find(array('conditions' => "recommended = 1 AND if_show = 1", 'order' => 'sort_order', 'limit' => $this->_num)));
$cache_server->set($key, $data, $this->_ttl);
}
return $data;
}
开发者ID:dongfeihu,项目名称:estore,代码行数:28,代码来源:main.widget.php
示例4: DatacallModule
function DatacallModule()
{
parent::__construct();
$this->type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : 'goods';
$this->call_mod =& af('datacall');
$this->_gcategory_mod =& bm("gcategory");
}
开发者ID:GavinLai,项目名称:ecmall,代码行数:7,代码来源:admin.module.php
示例5: ajax_cate
function ajax_cate()
{
if (!isset($_GET['id']) || empty($_GET['id'])) {
echo ecm_json_encode(false);
return;
}
$this->_gcategory_mod =& bm('gcategory');
$cate = $this->_gcategory_mod->get_list($_GET['id']);
foreach ($cate as $key => $val) {
$child = $this->_gcategory_mod->get_list($val['cate_id']);
$lay = $this->_gcategory_mod->get_layer($val['cate_id']);
if ($lay >= MAX_LAYER) {
$cate[$key]['add_child'] = 0;
} else {
$cate[$key]['add_child'] = 1;
}
if (!$child || empty($child)) {
$cate[$key]['switchs'] = 0;
} else {
$cate[$key]['switchs'] = 1;
}
}
header("Content-Type:text/html;charset=" . CHARSET);
echo ecm_json_encode(array_values($cate));
return;
}
开发者ID:woolh,项目名称:Online,代码行数:26,代码来源:gcategory.app.php
示例6: ChannelApp
function ChannelApp()
{
parent::BackendApp();
$this->_channel_mod =& af('channels');
$this->_gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$this->_tpl_filepath = ROOT_PATH . '/themes/mall/' . $this->_get_template_name() . '/';
$this->_tpl_confpath = ROOT_PATH . '/data/page_config/';
$this->_tpl_url = SITE_URL . '/themes/mall/' . $this->_get_template_name() . '/styles/' . $this->_get_style_name();
}
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:9,代码来源:channel.app.php
示例7: _list_gcategory
function _list_gcategory()
{
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $gcategory_mod->get_list(-1, true);
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
return $tree->getArrayList(0);
}
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:9,代码来源:category.app.php
示例8: get_cat_goods_total
function get_cat_goods_total($cate_id)
{
$goods_mod =& m('goods');
$gcategory_mod =& bm('gcategory');
$cate_ids = implode(",", $gcategory_mod->get_descendant_ids($cate_id));
if ($cate_id > 0) {
$conditions = " AND cate_id IN (" . $cate_ids . ")";
} else {
$conditions = '';
}
$goods = $goods_mod->find(array('conditions' => 'if_show=1 and closed=0 ' . $conditions, 'fields' => 'goods_id'));
return count($goods);
}
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:13,代码来源:gcategory.model.php
示例9: _list_gcategory
function _list_gcategory()
{
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $gcategory_mod->get_list(-1, true);
import('tree.lib');
$tree = new Tree();
$lang2 = get_lang2();
//LLL 获取语言2个字母的代称,如fr, sc, en
$gcategories = chg_array2_string($gcategories, 'cate_name', $lang2);
//保留数组第二维字段字符串中指定语言的部分
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
return $tree->getArrayList(0);
}
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:13,代码来源:category.app.php
示例10: _list_gcategory
function _list_gcategory()
{
$cache_server =& cache_server();
$key = 'page_goods_category';
$data = $cache_server->get($key);
if ($data === false) {
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $gcategory_mod->get_list(-1, true);
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$data = $tree->getArrayList(0);
$cache_server->set($key, $data, 3600);
}
return $data;
}
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:16,代码来源:category.app.php
示例11: _get_data
function _get_data()
{
$gcategory_mod =& bm('gcategory');
$gcategories = array();
if (!empty($this->options['cate_id'])) {
$gcategorys = $gcategory_mod->get_children($this->options['cate_id']);
foreach ($gcategorys as $key => $cate) {
$gcategorys[$key]['children'] = array();
$gcategorys[$key]['children'] = $gcategory_mod->get_children($cate['cate_id']);
foreach ($gcategorys[$key]['children'] as $k => $v) {
$gcategorys[$key]['children'][$k]['children'] = $gcategory_mod->get_children($v['cate_id']);
}
}
}
$ads = array();
for ($i = 1; $i < 9; $i++) {
$ads[$i]['ad_image_url'] = $this->options['ad' . $i . '_image_url'];
$ads[$i]['ad_link_url'] = $this->options['ad' . $i . '_link_url'];
}
$data = array('model_color' => $this->options['model_color'], 're_store' => $this->options['re_store'], 'gcategories' => $gcategorys, 'ad0_image_url' => $this->options['ad0_image_url'], 'ads' => $ads, 'wid' => md5($this->options['model_color']));
return $data;
}
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:22,代码来源:main.widget.php
示例12: store_goods
function store_goods()
{
$goods_mod =& bm('goods', array('_store_id' => $this->_store_id));
/* 搜索条件 */
$conditions = "1 = 1";
if (trim($_GET['goods_name'])) {
$str = "LIKE '%" . trim($_GET['goods_name']) . "%'";
$conditions .= " AND (goods_name {$str})";
}
if (intval($_GET['sgcate_id']) > 0) {
$cate_mod =& bm('gcategory', array('_store_id' => $this->_store_id));
$cate_ids = $cate_mod->get_descendant(intval($_GET['sgcate_id']));
} else {
$cate_ids = 0;
}
/* 取得商品列表 */
$goods_list = $goods_mod->get_list(array('conditions' => $conditions . ' AND g.if_show=1 AND g.closed=0', 'order' => 'g.add_time DESC', 'limit' => 100), $cate_ids);
foreach ($goods_list as $key => $val) {
$goods_list[$key]['goods_name'] = htmlspecialchars($val['goods_name']);
}
$this->json_result($goods_list);
}
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:22,代码来源:gselector.app.php
示例13: _get_gcategory_options
function _get_gcategory_options($parent_id = 0)
{
$mod_gcategory =& bm('gcategory');
$gcategories = $mod_gcategory->get_list($parent_id, true);
foreach ($gcategories as $gcategory) {
$res[$gcategory['cate_id']] = $gcategory['cate_name'];
}
return $res;
}
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:9,代码来源:navigation.app.php
示例14: My_categoryApp
function My_categoryApp()
{
parent::__construct();
$this->_gcategory_mod =& bm('gcategory', array('_store_id' => $this->visitor->get('manage_store')));
}
开发者ID:woolh,项目名称:Online,代码行数:5,代码来源:my_category.app.php
示例15: _get_mgcategory_options
function _get_mgcategory_options($parent_id = 0)
{
$res = array();
$mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $mod->get_list($parent_id, true);
foreach ($gcategories as $gcategory) {
$res[$gcategory['cate_id']] = $gcategory['cate_name'];
}
return $res;
}
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:10,代码来源:my_goods.app.php
示例16: _get_store_gcategory
function _get_store_gcategory()
{
$gcategory_mod =& bm('gcategory', array('_store_id' => $this->_store_id));
$gcategories = $gcategory_mod->get_list(-1, true);
//LLL store gcategories里面的cate_name部分仅保留对应语言的字符 frontend.base, store中的商品分类
$gcategories = chg_array2_string($gcategories, 'cate_name', get_lang2());
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
return $tree->getArrayList(0);
}
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:11,代码来源:frontend.base.php
示例17: index
//.........这里部分代码省略.........
$conditions .= " AND cate_id" . db_create_in($cate_ids);
}
// 关键字
$keyword = trim($_GET['keyword']);
if (!empty($keyword)) {
//LLL 主搜索中 也搜索货号
//$conditions .= " AND goods_name OR sku LIKE '%{$keyword}%' ";
$conditions .= " AND goods_name OR sku LIKE '%{$keyword}%' ";
$filters['keyword'] = array('key' => 'keyword', 'name' => LANG::get('keyword'), 'value' => $keyword);
}
// 品牌
if (!empty($_GET['brand'])) {
$conditions .= " AND brand = '{$_GET['brand']}' ";
$filters['brand'] = array('key' => 'brand', 'name' => LANG::get('brand'), 'value' => $_GET['brand']);
}
// 地区
if (!empty($_GET['region_id'])) {
$conditions .= " AND region_id = '{$_GET['region_id']}' ";
$region_mod =& m('region');
$region = $region_mod->get_info($_GET['region_id']);
$filters['region_id'] = array('key' => 'region_id', 'name' => LANG::get('region'), 'value' => $region['region_name']);
}
// 价格区间
if (!empty($_GET['price'])) {
$arr = explode('-', $_GET['price']);
$min = floatval($arr[0]);
$max = floatval($arr[1]);
if ($min != 0 || $max != 0) {
if ($min != 0 && $max != 0) {
if ($min > $max) {
list($min, $max) = array($max, $min);
}
$conditions .= " AND price >= '{$min}' AND price <= '{$max}' ";
$filters['price'] = array('key' => 'price', 'name' => LANG::get('price'), 'value' => price_format($min) . ' - ' . price_format($max));
} else {
if ($min != 0) {
$conditions .= " AND price >= '{$min}' ";
$filters['price'] = array('key' => 'price', 'name' => LANG::get('price'), 'value' => LANG::get('ge') . ' ' . price_format($min));
} else {
$conditions .= " AND price <= '{$max}' ";
$filters['price'] = array('key' => 'price', 'name' => LANG::get('price'), 'value' => LANG::get('le') . ' ' . price_format($max));
}
}
} else {
unset($_GET['price']);
}
}
$page = $this->_get_page(12);
$goods_mod =& m('goods');
$store_mod =& m('store');
$sgrade_mod =& m('sgrade');
$sgrades = $sgrade_mod->find(array('fields' => 'grade_name'));
$goods_list = $goods_mod->get_list(array('conditions' => $conditions, 'count' => true, 'order' => empty($_GET['order']) || !in_array($_GET['order'], array('sales desc', 'price asc', 'price desc', 'credit_value_desc', 'views desc', 'add_time desc')) ? 'sales desc' : $_GET['order'], 'limit' => $page['limit']));
//LLL search 页面中商品列表中商品名多语言
$goods_list = chg_array2_string($goods_list, 'goods_name', get_lang2());
foreach ($goods_list as $key => $goods) {
//等级图片
$step = intval(Conf::get('upgrade_required'));
$step < 1 && ($step = 5);
$goods_list[$key]['credit_image'] = $this->_view->res_base . '/images/' . $store_mod->compute_credit($goods['credit_value'], $step);
empty($goods['default_image']) && ($goods_list[$key]['default_image'] = Conf::get('default_goods_image'));
$goods_list[$key]['grade_name'] = $sgrades[$goods['sgrade']]['grade_name'];
}
$this->assign('goods_list', $goods_list);
$page['item_count'] = $goods_mod->getCount();
$this->_format_page($page);
$this->assign('page_info', $page);
/* 商品展示方式 */
$display_mode = ecm_getcookie('goodsDisplayMode');
if (empty($display_mode) || !in_array($display_mode, array('list', 'squares'))) {
$display_mode = 'squares';
// 默认格子方式
}
$this->assign('display_mode', $display_mode);
/* 统计品牌 */
$brands = $goods_mod->count_brand();
$this->assign('brands', $brands);
$this->assign('brand_count', count($brands));
/* 统计价格 */
$this->assign('price_intervals', $goods_mod->count_price());
/* 统计地区 */
$regions = $goods_mod->count_region();
$this->assign('regions', $regions);
$this->assign('region_count', count($regions));
/* 筛选条件 */
$this->assign('filters', $filters);
/* 排序方式 */
$this->assign('orders', array('sales desc' => LANG::get('sales_desc'), 'credit_value desc' => LANG::get('credit_value_desc'), 'price asc' => LANG::get('price_asc'), 'price desc' => LANG::get('price_desc'), 'views desc' => LANG::get('views_desc'), 'add_time desc' => LANG::get('add_time_desc')));
/* 取得下级分类 */
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$categories = $gcategory_mod->get_list($cate_id, true);
//LLL categories里面的cate_name部分仅保留对应语言的字符 search page中左categories内容
$categories = chg_array2_string($categories, 'cate_name', get_lang2());
$this->assign('categories', $categories);
$this->assign('category_count', count($categories));
/* 当前位置 */
$this->_curlocal($this->_get_goods_curlocal($cate_id));
$this->assign('page_title', Conf::get('site_title'));
$this->display('search.goods.html');
}
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:101,代码来源:search.app.php
示例18: get_sgcategory_options
function get_sgcategory_options($store_id)
{
$mod =& bm('gcategory', array('_store_id' => $store_id));
$gcategories = $mod->get_list();
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
return $tree->getOptions();
}
开发者ID:GavinLai,项目名称:ecmall,代码行数:9,代码来源:store.model.php
示例19: GcategoryApp
function GcategoryApp()
{
parent::__construct();
$this->_gcategory_mod =& bm('gcategory', array('_store_id' => 0));
}
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:5,代码来源:gcategory.app.php
示例20: distribute
function distribute()
{
if (!IS_POST) {
$cate_id = empty($_GET['cate_id']) ? 0 : intval($_GET['cate_id']);
if (!$cate_id) {
$this->show_warning('Hacking Attempt');
return;
}
//当前分类的级层,如 女装/连衣裙
$this->_gcate_mod =& bm('gcategory');
$this->assign('distribute_cate', $this->_gcate_mod->get_ancestor($cate_id));
$prop_list = $this->_props_mod->find(array('conditions' => 'status=1', 'order' => 'sort_order,pid'));
foreach ($prop_list as $key => $prop) {
$prop_list[$key]['prop_value'] = $this->_prop_value_mod->find(array('conditions' => 'status=1 and pid=' . $prop['pid'], 'order' => 'sort_order,vid'));
}
// 如果已经分配过属性,则进行 checked="checked" 设置
$cate_pvs = $this->_cate_pvs_mod->get($cate_id);
if ($cate_pvs) {
$pvs = $cate_pvs['pvs'];
$pv = explode(';', $pvs);
$p = array();
// 存储分配有属性名 prop 的数组
$v = array();
// 存储分配有属性值 prop_value 的数组
foreach ($pv as $pitem) {
$item = explode(':', $pitem);
$p[] = $item[0];
$v[] = $item[1];
}
$p = array_unique($p);
// 去掉重复值
$v = array_unique($v);
// 去掉重复值
}
foreach ($prop_list as $key => $prop) {
if (isset($p) && in_array($prop['pid'], $p)) {
$prop_list[$key]['checked'] = 1;
} else {
$prop_list[$key]['checked'] = 0;
}
foreach ($prop['prop_value'] as $key_v => $pvalue) {
if (isset($v) && in_array($pvalue['vid'], $v)) {
$prop_list[$key]['prop_value'][$key_v]['checked'] = 1;
} else {
$prop_list[$key]['prop_value'][$key_v]['checked'] = 0;
}
}
}
//print_r($prop_list);exit;
$this->assign('prop_list', $prop_list);
/* 导入css */
$this->import_resource(array('style' => 'res:style/jqtreetable.css'));
$this->assign('cate_id', $cate_id);
$this->display('props.distribute.html');
} else {
$cate_id = intval($_POST['cate_id']);
$pids = $_POST['pid'];
$vids = $_POST['vid'];
//if(!isset($pids) || !isset($vids)) {
//$this->show_message('prop_empty',
//'back', 'index.php?app=props&act=distribute&cate_id='.$cate_id);
//return;
//}
$data = array('cate_id' => $cate_id, 'pvs' => '');
if (isset($pids) && isset($vids)) {
// 去除非选中的 pid
foreach ($vids as $item) {
$vid = explode(':', $item);
if (in_array($vid[0], $pids)) {
$pvs .= ';' . $item;
}
}
$data['pvs'] = substr($pvs, 1);
}
if ($this->_cate_pvs_mod->get($cate_id)) {
$this->_cate_pvs_mod->edit($cate_id, $data);
} else {
$this->_cate_pvs_mod->add($data);
}
$this->show_message('save_ok', 'back', 'index.php?app=props&act=distribute&cate_id=' . $cate_id);
}
}
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:82,代码来源:props.app.php
注:本文中的bm函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论