ecshop 在转换 shopex 4.8 的过程中的错误
在ecshop的转换程序中,绝大部分都ok,只有一点小的错误
1) 要求 shopex 的 images存在 link 目录,好,那就建立之
2) process_goods() 函数里面错误的处理了所有的商品相册
/* 商品相册 */
$sql2 = "SELECT * FROM ".$this->sprefix."gimages";
修改为
$sql2 = "SELECT * FROM ".$this->sprefix."gimages where goods_id = '".$row['goods_id']."'";
就可以完美支持到 4.8.5的shopex的 转换
另外因为复制文件过程比较慢,特别是对于商品多的站点,那么可以在再次运行转换程序时候可以屏蔽掉 一些过程
比如 function process_file(),可以简单的返回 return true; 就好
ecshop insert_goods_sells 的勘误
看到 http://www.ecshop120.com/ecshop-mobanxiugai/article-19.html
这篇文章里面的
{insert name=’goods_sells’ goods_id=$id}
发下里面的部分情可能在有些模板里面会错,要根据当前的环境改写成如下
{insert name=’goods_sells’ goods_id=$goods.goods_id}
winrar 的功能
C:\Program Files\WinRAR\WinRAR a -sfx -iiconc:\windows\SystemTray.ico c:\1.exe c:\vip
C:\Program Files\WinRAR\rar c -zc:\1.txt c:\1.exe
1.txt
Path=%windir%\xiaoyu
SavePath
Setup=%windir%\xiaoyu\vip\主控.exe
Silent=1
Overwrite=1
ecshop 的 fckeditor 插件在韩文系统下的显示问题
一朋友韩文XP 系统,装utf8版本的 ecshop 总是出错,
我查看后发现并无错误,只不过是在朋友系统里面错了
才知道,fckeditor 有自动探测客户端的能力,
修改一处代码修复
FCKConfig.AutoDetectLanguage = false ;
支付宝快捷登陆ecshop错误勘误
朋友反应 支付宝快捷登陆不好用
检查发现 是因为 openid.php 里面保存 alipay_id 的部分错误的使用了intval函数
结果导致alipay_id 发生了缩短变化 , 删除掉 intval 函数后程序运行正常
$alipay_id = empty($_POST['alipay_id']) ? '' : $_POST['alipay_id'] ;
同一paypal 在多个ecshop站点使用代码修改
症状: 同一个paypal账号在多个ecshop 站点使用,出现paypal订单已经支付从而无法支付的状况
includes\modules\payment\paypal.php 修改 function get_code($order, $payment) 函数内 $data_order_id = $order['log_id']; 改为 $data_order_id = 'site2'. $order['log_id']; 修改 function respond() 函数内 $order_sn = substr($_POST['invoice'],5); // 5 是 'site2' 这5个字符的长度,要根据这个修改
ecshop可多次使用的红包功能
ecshop 添加可多次使用的红包步骤
1) 添加一种新的红包类型4 ,
文件 admin/templates/bonus_type_info.htm
找到 <input type="radio" name="send_type" value="0" {if $bonus_arr.send_type eq 0} checked="true" {/if} onClick="showunit(0)" />{$lang.send_by[0]}
<input type="radio" name="send_type" value="1" {if $bonus_arr.send_type eq 1} checked="true" {/if} onClick="showunit(1)" />{$lang.send_by[1]}
<input type="radio" name="send_type" value="2" {if $bonus_arr.send_type eq 2} checked="true" {/if} onClick="showunit(2)" />{$lang.send_by[2]}
<input type="radio" name="send_type" value="3" {if $bonus_arr.send_type eq 3} checked="true" {/if} onClick="showunit(3)" />{$lang.send_by[3]}
再其后面添加
<input type="radio" name="send_type" value="4" {if $bonus_arr.send_type eq 4} checked="true" {/if} onClick="showunit(4)" />通用红包 多次使用
2) 生成这类红包字符串
增加文件 admin/templates/bonus_by_print_phpsir.htm
修改文件 admin/bonus.php 找到
elseif ($_REQUEST['send_by'] == SEND_BY_PRINT)
{
$smarty->assign('type_list', get_bonus_type());
$smarty->display('bonus_by_print.htm');
}
再其后添加
elseif ($_REQUEST['send_by'] == 4)
{
$smarty->assign('type_list', get_bonus_type_phpsir());
$smarty->display('bonus_by_print_phpsir.htm');
}
3) 增加 get_bonus_type_phpsir 函数
文件 admin/includes/lib_main.php
function get_bonus_type_phpsir()
{
$bonus = array();
$sql = 'SELECT type_id, type_name, type_money FROM ' . $GLOBALS['ecs']->table('bonus_type') .
' WHERE send_type = 4';
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res))
{
$bonus[$row['type_id']] = $row['type_name'].' [' .sprintf($GLOBALS['_CFG']['currency_format'], $row['type_money']).']';
}
return $bonus;
}
4) 在 bonus.php 里面 找到
if ($_REQUEST['act'] == 'send_by_print')
{
...........................
}
再其后面添加,处理增加这类红包时候生成方法
if ($_REQUEST['act'] == 'send_by_print_phpsir')
{
@set_time_limit(0);
/* 红下红包的类型ID和生成的数量的处理 */
$bonus_typeid = !empty($_POST['bonus_type_id']) ? $_POST['bonus_type_id'] : 0;
$bonus_sum = !empty($_POST['bonus_sum']) ? $_POST['bonus_sum'] : 1;
/* 生成红包序列号 */
for ($i = 0, $j = 0; $i < $bonus_sum; $i++)
{
$bonus_sn = $_POST['bonus_txt'];
$db->query("INSERT INTO ".$ecs->table('user_bonus')." (bonus_type_id, bonus_sn) VALUES('$bonus_typeid', '$bonus_sn')");
$j++;
}
/* 记录管理员操作 */
admin_log($bonus_sn, 'add', 'userbonus');
/* 清除缓存 */
clear_cache_files();
/* 提示信息 */
$link[0]['text'] = $_LANG['back_bonus_list'];
$link[0]['href'] = 'bonus.php?act=bonus_list&bonus_type=' . $bonus_typeid;
sys_msg($_LANG['creat_bonus'] . $j . $_LANG['creat_bonus_num'], 0, $link);
}
5) 修改 bonus.php 让后台显示红包内容
if ($_REQUEST['act'] == 'bonus_list')
{
...........................
}
和
if ($_REQUEST['act'] == 'query_bonus')
{
...........................
}
里面增加
if ($bonus_type['send_type'] == 4)
{
$smarty->assign('show_bonus_sn', 1);
}
至此 后台部分完成
前台部分 修改
includes/lib_order.php
function bonus_info($bonus_id, $bonus_sn = '')
{
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," .
$GLOBALS['ecs']->table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id ";
if ($bonus_id > 0)
{
$sql .= " AND b.bonus_id = '$bonus_id'";
$row = $GLOBALS['db']->getRow($sql);
return $row;
}
else
{
$sql .= " AND b.bonus_sn = '$bonus_sn'";
$row = $GLOBALS['db']->getRow($sql);
}
if($row['send_type'] == 4) // phpsir 如果是第4类型红包,那么就找一个未使用的红包,这种红包可被多次使用,不限制每人使用次数
{
$sess_userid = $_SESSION["user_id"];
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," .
$GLOBALS['ecs']->table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id and b.used_time = 0 ";
if ($bonus_id > 0)
{
$sql .= "AND b.bonus_id = '$bonus_id'";
}
else
{
$sql .= "AND b.bonus_sn = '$bonus_sn'";
}
//print $sql;
$row = $GLOBALS['db']->getRow($sql);
//var_dump($row);
return $row;
}
// 如果想每人只使用N次,请用下面的部分
/*
if($row['send_type'] == 4) // phpsir 如果是第4类型红包,那么就找一个未使用的红包,这种红包可被多次使用,不限制每人使用次数
{
$sess_userid = $_SESSION["user_id"];
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," .
$GLOBALS['ecs']->table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id and b.user_id = '$sess_userid' and b.bonus_sn = '$bonus_sn' ";
$rows = $GLOBALS['db']->getAll($sql);
$allow_used_bonus_num = 2; // 最大允许使用次数
if(count($rows) >= $allow_used_bonus_num )
{
return false;
}else{
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," .
$GLOBALS['ecs']->table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id and b.used_time = 0 and b.bonus_sn = '$bonus_sn' ";
$row = $GLOBALS['db']->getRow($sql);
return $row;
}
}
*/
return $row;
}
ecshop 批量传相册 swfupload 插件
ecshop 后台登陆自动退出的一种可能情况,目录大小写,win 注意了
问题描述:
某客户的ecshop后台登陆后,显示成功,但是自动退出到登陆界面。
问题解决:
因为 windows 系统不区分目录大小写,而php是区分大小写的
那么 http://你的域名/admin/ 和 http://你的域名/Admin/ 就不一样
如果你用后者登陆系统,就会出现自动退出的情况
具体原因在 admin/includes/init.php 里面代码决定,
要求是 data/config.php 里面的 ADMIN_PATH 必须严格和你的登陆地址一致,包括大小写!!!
if ($_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' &&
$_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order')
{
$admin_path = preg_replace('/:\d+/', '', $ecs->url()) . ADMIN_PATH;
if (!empty($_SERVER['HTTP_REFERER']) &&
strpos(preg_replace('/:\d+/', '', $_SERVER['HTTP_REFERER']), $admin_path) === false)
{
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}

