ecshop,解决方案
篇一:ecshop开发-多货币解决方案
多货币解决方案
要在后台清除缓存才行
1.在数据库里的表ecs_shop_config插入
INSERT INTO `ecs_shop_config` (
`id` ,
`parent_id` ,
`code` ,
`type` ,
`store_range` ,
`store_dir` ,
`value` ,
`sort_order`
)
VALUES (
NULL , '1', 'rate', 'text', '', '', '1,,,,', '1' ),
NULL , '1', 'ybprice_format', 'text', '', '', '&%s', '1'
),(
NULL , '1', 'aprice_format', 'text', '', '', 'EUR%s', '1'
),(
NULL , '1', 'cprice_format', 'text', '', '', '¥%s', '1'
),(
NULL , '1', 'aoprice_format', 'text', '', '', 'AU%s', '1'
);
2.在/languages/zh_cn/admin/shop_下添加
$_LANG['cfg_name']['rate'] = '货币汇率';
$_LANG['cfg_name']['ybprice_format'] = '英镑格式';
$_LANG['cfg_name']['aprice_format'] = '欧元格式
$_LANG['cfg_name']['cprice_format'] = '人民币格式';
$_LANG['cfg_name']['aoprice_format'] = '澳元格式';
如图
并且添加下面的帮助信息
$_LANG['cfg_desc']['rate'] = '输入规则按照和美元的汇率进行出入
Us,EURP,BriishPound,China,Austriliar';
$_LANG['cfg_desc']['ybprice_format'] = '显示英镑格式,%s将被替换替换为相应的价格。'; $_LANG['cfg_desc']['aprice_format'] = '显示欧元格式,%s将被替换替换为相应的价格。'; $_LANG['cfg_desc']['cprice_format'] = '显示人民币格式,%s将被替换替换为相应的价格。'; $_LANG['cfg_desc']['aoprice_format'] = '显示澳元格式,%s将被替换替换为相应的价格。
';
3.在themes/当前使用的模板文件夹/library/page_的合适位置添加
美元人民币欧元英镑澳元
4.在/includes/最后面添加
//路径处理
$url_this = "http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?id=".@$_GET['i d']; $smarty->assign("url_head",$url_this);
$currency = @$_GET['currency'];
if($currency!=""){
$_SESSION['currency'] = $currency;
}
if($_SESSION['currency'] == '')
{
$_SESSION['currency'] = 'USD';
}
5.在/includes/lib_找到这个函数
price_format
并且按下面的进行修改
/**
* 格式化商品价格
*
* @access public
* @paramfloat$price 商品价格
* @return string
*/
function price_format($price, $change_price = true)
{
$currency = $_SESSION['currency'];
$rate = explode(',',$GLOBALS['_CFG']['rate']);
if($currency == 'USD')
{
$price = $price*$rate[0];
}
if($currency == 'CNY') {
$price = $price*$rate[3]; }
if($currency == 'EUR') {
$price = $price*$rate[1]; }
if($currency == 'GBP') {
$price = $price*$rate[2]; }
if($currency == 'AUD') {
$price = $price*$rate[4]; }
if ($change_price && defined('ECS_ADMIN') === false)
{
switch ($GLOBALS['_CFG']['price_format'])
{
case 0:
$price = number_format($price, 2, '.', '');
break;
case 1: // 保留不为 0 的尾数
$price = preg_replace('/(.*)(\\.)([0-9]*?)0+$/', number_format($price, 2, '.', ''));
if (substr($price, -1) == '.') '\1\2\3', {
$price = substr($price, 0, -1);
}
break;
case 2: // 不四舍五入,保留1位
$price = substr(number_format($price, 2, '.', ''), 0, -1); break;
case 3: // 直接取整
$price = intval($price);
break;
case 4: // 四舍五入,保留 1 位
$price = number_format($price, 1, '.', '');
break;
case 5: // 先四舍五入,不保留小数
$price = round($price);
break;
}
}
else
{
$price = number_format($price, 2, '.', '');
}
switch ($currency)
{
case 'USD':
return sprintf($GLOBALS['_CFG']['currency_format'], $price); break;
case 'CNY':
return sprintf($GLOBALS['_CFG']['cprice_format'], $price); break;
case 'EUR':
return sprintf($GLOBALS['_CFG']['aprice_format'], $price); break;
case 'GBP':
return sprintf($GLOBALS['_CFG']['ybprice_format'], $price); break;
case 'AUD':
return sprintf($GLOBALS['_CFG']['aoprice_format'], $price); break;
}
}
篇二:ECSHOP设计方案
ECSHOP 管理中心设计方案
1. 设计概要
1. 为了提高代码的重用性,每一个功能模块都在一个文件中完成。使用act参数来传递
用途
2. 管理员登录
登录
1. 登录界面增加CAPTCHA图片
2. 允许保存登录信息
起始页
留言:
商品统计信息:系统信息:
备注:
3. 获取gd版本的部分可以抽象为一个函数。返回值建议为0,1,2。分别表示不支持,
GD1,GD2。
4. 当没有留言的时候不输出留言的列表框。点击留言的标题查看留言的详细内容。
留言
当管理员有未阅读的留言式提示使用javascript提醒。未读留言确定条件:receiverid=userid and readed=0 and deleted =0。
管理中心的每一个页面都包含如下的代码:
在?act=js中检查是否存在未读留言,如果有则写出一个浮动的层。反之不做处理。
功能概述
实现管理中心用户间相互发送留言 1. 能显示用户未阅读的留言 2. 列出用户所有收到的留言 3. 列出用户所发留言
数据表设计
表message
发送留言
1. 留言表单需要填写内容
1) 接收用户,列表框选择管理员(可选择多个管理员)
2) 留言标题
3) 留言内容 2. 前台验证内容 3. 接收用户不能为空
4) 留言标题不能为空 5) 标题不能超过50
备注:
6) 在message表中插入一条记录。发送日期为当前时间,
readdate,read,deleted字段采用默认值0。 7) 接收方为多用户时,需对应插入多条记录。
留言列表
显示用户收到的所有未删除的留言。列表内容: 1. 2.
3. 4. 5. 6.
标题
留言发送者发送日期
阅读日期(日期为0时显示为未读)操作,包括查看删除
增加未读留言/全部留言过滤表单
备注:
1) 从message数据表查出receiverid =用户id 且receiverid!=
senderid且deleted=0的记录按发送时间降序排列。
2) 查看某条记录时,如果readed = 0 ,则将该记录readed 设置为1且
readdate更新为当前时间
3) 查看时跳转到另一个页面,显示发件人,留言标题,留言内容,阅读日期,及删除,
回复,下一条留言等按钮
4) 删除记录时将记录的deleted设置为1, 不做物理删除。
留言追踪
显示当前管理员发出的所有留言的状态。列表内容: 1.
2. 3. 4. 5. 6.
编号留言标题留言接收者发送日期
留言阅读日期(日期为0时显示对方未读)是否被删
除
备注:
1) 查询条件为senderid =用户id 且renceiverid != senderid
3. 分类及商品管理
商品分类管理商品分类列表
添加商品分类
1. 商品分类添加的内容有:
1) 分类名称:不能为空,同级不能重复 2) 上级分类:不能选底级分类 3) 是否显示:默认显示 4) 是否底级:默认非底级 5) 分类描述:可以为空 6) 分类关键字:可以为空 7) 该分类的商品的数量单位。 2. 前台验证内容:
1) 分类名称是否存在
2) 上级分类不能为底级分类 3. 后台验证内容:
1) 是否存在相同名称的商品分类
修改商品分类
与添加商品分类的界面完全一致。
删除商品分类
删除商品分类之前使用Javascript的alert方式先取得管理员的确认。商品分类下存在下级分类或商品时不允许删除商品分类。
批量转移
将分类下的商品全部转移到指定的商品分类下。指定的分类必须为底层分类。
篇三:关于ecshop安装问题常用解决办法
最近有不少的童鞋反应raksmart服务器安装ecshop 有不少的问题。我看了一下基本上都是php版本的问题。如果你的虚拟主机可以选择的话尽量把php版本切换到如果没法改变主机的php版本,我总结了一下几种错误的解决方法:
1.创建管理员账号失败:
修改了install/includes/lib_的411或者412行:
include(ROOT_PATH . 'install/languages/' . $system_lang . '.php');
替换成
include(ROOT_PATH . 'install/languages/zh_');
\includes\lib_ on line 31
找到install/includes/lib_中的第31行 return
cls_image::gd_version();
然后在找到include/cls_中的678行,发现gd_version()方法未声明静态static,所以会出错。这时候只要:
将function gd_version()改成static function gd_version()即可。
/cls_ on line 406
将 $tag_sel = array_shift(explode(‘‘, $tag)); 这句话拆开为两句。
$tag_arr = explode(‘‘, $tag);
$tag_sel = array_shift($tag_arr);
\lib_ on line 1329
$ext = end(explode('.', $tmp));
修改为:
$ext = explode('.',$tmp);
$ext = end($ext);
\cls_ on line 418
tag_sel = array_shift(explode(' ', $tag));
修改为:
$tag_arr = explode(' ', $tag); $tag_sel = array_shift($tag_arr);
6.后台点击开店向导警告的解决方案。
admin/include/modules/payment 下的几个文件构造函数错误,删掉即可。
希望对童鞋们安装ecshop有帮助。
ecshop留言板添加一项必填项-联系人 一、首先要为你的数据库的ecs_comment增加一个字段以存储联系人姓名: 可以直接在后台-->数据库管理--->SQL查询里里直接执行以下sql语句: alter table ecs_comment add contact varchar(60) not null default ''; 此处注意,这条sql语句中的表前缀ecs_要和你网站的前缀一致,不然会报错,如果你不知道你ecshop网站的数据表前缀. 二: 步骤1. 更改文件message_board.dwt