本帖最后由 wanghaihan 于 2010-10-15 22:32 编辑
以下是我写的uchome商城插件安装教程:
1.上传upload文件之uchome根目录
2.修改admincp.php文件,找到$acs在最后面加上array('shopgoods','shoptype','shoporder','shopcomment','shopconfig'),别忘了在前一个数组前面加上分号“,”(要用英文的);找到!in_array($_GET['ac'], $acs[3])后面加上&& !in_array($_GET['ac'], $acs[4]);找到for($i=0; $i<3; $i++) {把3修改为5;
3.找到admin/tpl/header.htm,在$_TPL['menunames'] = array(里面加上
'shopgoods' => '商品管理',
'shoptype' => '商品分类',
'shoporder' => '订单管理',
'shopcomment' => '评价管理',
'shopconfig' => '参数配置',
4.找到admin/tpl/side.htm加上
<!--{if $menus[4]}-->
<div class="block style1">
<h2>商店管理</h2>
<ul class="folder">
<!--{loop $acs[4] $value}-->
<!--{if $menus[4][$value]}-->
<!--{if $ac==$value}--><li class="active"><!--{else}--><li><!--{/if}--><a href="admincp.php?ac=$value">{$_TPL[menunames][$value]}</a></li>
<!--{/if}-->
<!--{/loop}-->
</ul>
</div>
<!--{/if}-->
5.找到source/function_cacha.php文件中的eventclass_cache()在这个方法后台添加
//二次开发:更新商品分类缓存
function shoptype_cache(){
global $_SGLOBAL;
$_SGLOBAL['shoptype'] = array();
// 从数据库获取
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("shop_type") . " ORDER BY t_order");
while($value = $_SGLOBAL['db']->fetch_array($query)){
$_SGLOBAL['shoptype'][$value['t_id']] = $value;
}
$_SGLOBAL['shoptype']=treedata($_SGLOBAL['shoptype']);
foreach ($_SGLOBAL['shoptype'] as $k2=>$v2){
$v3[$v2['t_id']] =$v2;
}
$_SGLOBAL['shoptype']=$v3;
//print_r($_SGLOBAL['shoptype']);die('aaa');
cache_write('shoptype', "_SGLOBAL['shoptype']", $_SGLOBAL['shoptype']);
}
//二次开发:商品分类递归
function treedata($data, $fid = "0") {
global $arr8;
foreach ( $data as $v ) {
if ($v ['t_fid'] == $fid) {
$arr8[] = $v;
if (count ( $arr8 ) !== count ( $data )) {
treedata ( $data, $v ['t_id'] );
}
}
}
return $arr8;
}
//二次开发:商品分类递归之根据大分类ID找到对应下面所有的子ID
function getchildclassid($id,$data) {
global $arr9;
foreach ( $data as $v ) {
if ($v['t_fid']==$id) {
$arr9[] = $v['t_id'];
if (count ( $arr9 ) !== count ( $data )) {
getchildclassid ($v['t_id'],$data );
}
}
}
return $arr9;
}
//二次开发:商城参数配置
function shopconfig_cache(){
global $_SGLOBAL;
$_SGLOBAL['shopconfig'] = array();
// 从数据库获取
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("shop_config") . " ORDER BY c_id");
while($value = $_SGLOBAL['db']->fetch_array($query)){
$arr[$value['c_id']] = $value;
}
foreach ( $arr as $key => $val ) {
$_SGLOBAL['shopconfig'] [$val [c_key]] = $val [c_val];
}
//print_r($_SGLOBAL['shopconfig']);die('aaa');
cache_write('shopconfig', "_SGLOBAL['shopconfig']", $_SGLOBAL['shopconfig']);
}
6.找到template/default/header.htm,找到<li><img src="image/app/topic.gif"><a href="space.php?do=topic">热闹</a></li>在后面添加<li><img src="image/app/goods.gif"><a href="shop.php?do=goods">社区商店</a><em><a href="shop.php?do=goods&ac=order" class="gray">订单</a></em></li>
7.最后进入后台更新缓存即可 |