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; }
function _list_scategory() { $scategory_mod =& m('scategory'); $scategories = $scategory_mod->get_list(-1, true); import('tree.lib'); $tree = new Tree(); $lang2 = get_lang2(); //LLL 获取语言2个字母的代称,如fr, sc, en $scategories = chg_array2_string($scategories, 'cate_name', $lang2); //保留数组第二维字段字符串中指定语言的部分 $tree->setTree($scategories, 'cate_id', 'parent_id', 'cate_name'); return $tree->getArrayList(0); }
function _get_data() { $cache_server =& cache_server(); $key = $this->_get_cache_id(); $data = $cache_server->get($key); if ($data === false) { $recom_mod =& m('recommend'); $data = $recom_mod->get_recommended_goods($this->options['img_recom_id'], $this->_num, true, $this->options['img_cate_id']); //LLL best goods精品推荐中商品名称多语言 $data = chg_array2_string($data, 'goods_name', get_lang2()); $cache_server->set($key, $data, $this->_ttl); } return $data; }
function _get_data() { $cache_server =& cache_server(); $key = $this->_get_cache_id(); $data = $cache_server->get($key); if ($data === false) { $goods_mod =& m('goods'); $data = $goods_mod->find(array('conditions' => "if_show = 1 AND closed = 0", 'order' => 'sales', 'fields' => 'g.goods_id, g.goods_name', 'join' => 'has_goodsstatistics', 'limit' => 10)); //LLL sale list top 10 销售排行多语言 $data = chg_array2_string($data, 'goods_name', get_lang2()); $cache_server->set($key, $data, $this->_ttl); } return $data; }
function _get_data() { $cache_server =& cache_server(); $key = $this->_get_cache_id(); $data = $cache_server->get($key); if ($data === false) { $recom_mod =& m('recommend'); $img_goods_list = $recom_mod->get_recommended_goods($this->options['img_recom_id'], 4, true, $this->options['img_cate_id']); $txt_goods_list = $recom_mod->get_recommended_goods($this->options['txt_recom_id'], 8, true, $this->options['txt_cate_id']); //LLL 商品模块 goods module 1 多语言 $img_goods_list = chg_array2_string($img_goods_list, 'goods_name', get_lang2()); $txt_goods_list = chg_array2_string($txt_goods_list, 'goods_name', get_lang2()); $cache_server->set($key, array('img_goods_list' => $img_goods_list, 'txt_goods_list' => $txt_goods_list), $this->_ttl); } return array('module_name' => $this->options['module_name'], 'bgcolor' => $this->options['bgcolor'], 'keyword_list' => explode(' ', $this->options['keyword_list']), 'ad_image_url' => $this->options['ad_image_url'], 'ad_link_url' => $this->options['ad_link_url'], 'img_goods_list' => $data['img_goods_list'], 'txt_goods_list' => $data['txt_goods_list']); }
function _get_data() { $cache_server =& cache_server(); $key = $this->_get_cache_id(); $data = $cache_server->get($key); if ($data === false) { $recom_mod =& m('recommend'); $img_goods_list = $recom_mod->get_recommended_goods($this->options['img_recom_id'], 3, true, $this->options['img_cate_id']); $txt_goods_list = $recom_mod->get_recommended_goods($this->options['txt_recom_id'], 4, true, $this->options['txt_cate_id']); //LLL 特价商品sale price 多语言 $img_goods_list = chg_array2_string($img_goods_list, 'goods_name', get_lang2()); $txt_goods_list = chg_array2_string($txt_goods_list, 'goods_name', get_lang2()); $cache_server->set($key, array('img_goods_list' => $img_goods_list, 'txt_goods_list' => $txt_goods_list), $this->_ttl); } return array('img_goods_list' => $data['img_goods_list'], 'txt_goods_list' => $data['txt_goods_list']); }
function _get_data() { if (empty($this->options['num']) || intval($this->options['num']) <= 0) { $this->options['num'] = 5; } $cache_server =& cache_server(); $key = $this->_get_cache_id(); $data = $cache_server->get($key); if ($data === false) { $order_goods_mod =& m('ordergoods'); $data = $order_goods_mod->find(array('conditions' => "status = '" . ORDER_FINISHED . "'", 'order' => 'finished_time desc', 'fields' => 'goods_id, goods_name, price, goods_image', 'join' => 'belongs_to_order', 'limit' => $this->options['num'])); //LLL latest sold最新成交多语言 $data = chg_array2_string($data, 'goods_name', get_lang2()); foreach ($data as $key => $goods) { empty($goods['goods_image']) && ($data[$key]['goods_image'] = Conf::get('default_goods_image')); } $cache_server->set($key, $data, $this->_ttl); } return $data; }
function _get_store_curlocal($cate_id) { $parents = array(); if ($cate_id) { $scategory_mod =& m('scategory'); $scategory_mod->get_parents($parents, $cate_id); } //LLL $parents里面的cate_name部分仅保留对应语言的字符store page中导航栏 $parents = chg_array2_string($parents, 'cate_name', get_lang2()); $curlocal = array(array('text' => LANG::get('all_categories'), 'url' => 'index.php?app=search&act=store')); foreach ($parents as $category) { $curlocal[] = array('text' => $category['cate_name'], 'url' => 'index.php?app=search&act=store&cate_id=' . $category['cate_id']); } unset($curlocal[count($curlocal) - 1]['url']); return $curlocal; }
function _get_sgcategory_options() { $mod =& bm('gcategory', array('_store_id' => $this->_store_id)); $gcategories = $mod->get_list(); //LLL 本店所有商品分类多语言 $gcategories = chg_array2_string($gcategories, 'cate_name', '', true); import('tree.lib'); $tree = new Tree(); $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name'); return $tree->getOptions(); }
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); }
function _get_scategory_options() { $mod =& m('scategory'); $scategories = $mod->get_list(); //LLL apply_app分类多语言 $scategories = chg_array2_string($scategories, 'cate_name', get_lang2(), true); import('tree.lib'); $tree = new Tree(); $tree->setTree($scategories, 'cate_id', 'parent_id', 'cate_name'); return $tree->getOptions(); }
/** * 取得当前位置 * * @param int $cate_id 分类id */ function _get_curlocal($cate_id) { $parents = array(); if ($cate_id) { $gcategory_mod =& m('gcategory'); $gcategory_mod->get_parents($parents, $cate_id); } $curlocal = array(array('text' => LANG::get('all_categories'), 'url' => 'index.php?app=category')); //LLL $parents里面的cate_name部分仅保留对应语言的字符 goods page中导航栏 $parents = chg_array2_string($parents, 'cate_name', get_lang2()); foreach ($parents as $category) { $curlocal[] = array('text' => $category['cate_name'], 'url' => 'index.php?app=search&cate_id=' . $category['cate_id']); } $curlocal[] = array('text' => LANG::get('goods_detail')); return $curlocal; }
function _get_options($except = NULL) { $gcategories = $this->_gcategory_mod->get_list(); //LLL 将上级分类多种语言连接起来 $gcategories = chg_array2_string($gcategories, 'cate_name', '', true); $tree =& $this->_tree($gcategories); return $tree->getOptions(MAX_LAYER - 1, 0, $except); }