当前位置:首页 > 代码 > 正文

ecshop代码(ecshop开发手册)

admin 发布:2022-12-19 23:08 148


本篇文章给大家谈谈ecshop代码,以及ecshop开发手册对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

ecshop代码意思

调用商品的精品,如果是精品,把商品循环调用出来,精品是在后台的商品列表里面可以设置。

如何在ecshop中使用JS代码

ecshop中的模板可以写js

如果是在dwt里面。你可以直接写js

如果是在lbi里面。你最好是在js的开始标签和结束标签增加{literal}{/literal}

比如在模板中。如何让js和php的模板标签想结合。这个是就如以下代码

script

var

gmt_end_time

=

{$promote_end_time|default:0};

{foreach

from=$lang.goods_js

item=item

key=key}

var

{$key}

=

"{$item}";

{/foreach}

/script

具体参考本文教程

ecshop 生成商品代码中如何加入新调用的内容

如何给商品增加一个新字段,来录入一些新的内容。

下面我们结合ecshop后台“商品编辑”、“商品录入”来谈谈如何给ecshop商品增加一个新字段,假设我们将这个新字段命名为

other_col

1、首先要修改数据表结构,给表 ecs_goods 增加新字段:other_col,

进入后台 》数据库管理 》SQL查询,输入下面SQL语句,提交。注意如果你的数据表前缀不是ecs_ 请自行修改之

alter table ecs_goods add column other_col varchar(64);

2、在ecshop后台的admin\templates\goods_info.htm中增加以下代码.

tr

td class="label"自定义字段/td

tdinput type="text" name="other_col"

value="{$goods.other_col}" size="20"/

/td

/tr

3、在admin/goods.php的elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act']

== 'update')里面增加以下程序

$sql = "INSERT INTO " . $ecs-table('goods') . " (goods_name,

goods_name_style, goods_sn, " .

"cat_id, brand_id, shop_price, market_price,

is_promote, promote_price, " .

"promote_start_date, promote_end_date, goods_img,

goods_thumb, original_img, keywords, goods_brief, " .

"seller_note, goods_weight, goods_number, warn_number,

integral, give_integral, is_best, is_new, is_hot, " .

"is_on_sale, is_alone_sale, is_shipping, goods_desc,

add_time, last_update, goods_type, rank_integral, suppliers_id,other_col)"

.

"VALUES ('$_POST[goods_name]', '$goods_name_style',

'$goods_sn', '$catgory_id', " .

"'$brand_id', '$shop_price', '$market_price',

'$is_promote','$promote_price', ".

"'$promote_start_date', '$promote_end_date',

'$goods_img', '$goods_thumb', '$original_img', ".

"'$_POST[keywords]', '$_POST[goods_brief]',

'$_POST[seller_note]', '$goods_weight', '$goods_number',".

" '$warn_number', '$_POST[integral]', '$give_integral',

'$is_best', '$is_new', '$is_hot', '$is_on_sale', '$is_alone_sale', $is_shipping,

".

" '$_POST[goods_desc]', '" . gmtime() . "', '".

gmtime() ."', '$goods_type', '$rank_integral',

'$suppliers_id','$_POST[other_col]')";

。。。。。。。。

。。。。。。。。

" other_col = '$_POST[other_col]', " .

这样我们就完成了在ECSHOP后台录入和修改新字段的功能了。

下面再来说一下前台调用的方法:

调用也很简单,在PHP中找到相应的循环方法,从数据库中查询一下,再赋值。

直接在模板文件或者 lbi文件里 这么调用即可 {$goods.other_col}

ecshop首页全部都是代码了,怎么解决,着急啊,求大神帮忙

打开includes下cls_template.php这个文件

找到这段代码:

function

fetch_str($source)

{

if

(!defined('ECS_ADMIN'))

{

$source

=

$this-smarty_prefilter_preCompile($source);

}

if(preg_match_all('~(?(?:w+|=)?|?|languages*=s*["']?php["']?)~is',

$source,

$sp_match))

{

$sp_match[1]

=

array_unique($sp_match[1]);

for

($curr_sp

=

0,

$for_max2

=

count($sp_match[1]);

$curr_sp

$for_max2;

$curr_sp++)

{

$source

=

str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$source);

}

for

($curr_sp

=

0,

$for_max2

=

count($sp_match[1]);

$curr_sp

$for_max2;

$curr_sp++)

{

$source=

str_replace('%%%SMARTYSP'.$curr_sp.'%%%',

'?php

echo

''.str_replace("'",

"'",

$sp_match[1][$curr_sp]).'';

?'."n",

$source);

}

}

return

preg_replace("/{([^}{n]*)}/e",

"$this-select('1');",

$source);

}

替换为以下代码:

function

fetch_str($source)

{

if

(!defined('ECS_ADMIN'))

{

$source

=

$this-smarty_prefilter_preCompile($source);

}

/*

if(preg_match_all('~(?(?:w+|=)?|?|languages*=s*["']?php["']?)~is',

$source,

$sp_match))

{

$sp_match[1]

=

array_unique($sp_match[1]);

for

($curr_sp

=

0,

$for_max2

=

count($sp_match[1]);

$curr_sp

$for_max2;

$curr_sp++)

{

$source

=

str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$source);

}

for

($curr_sp

=

0,

$for_max2

=

count($sp_match[1]);

$curr_sp

$for_max2;

$curr_sp++)

{

$source=

str_replace('%%%SMARTYSP'.$curr_sp.'%%%',

'?php

echo

''.str_replace("'",

"'",

$sp_match[1][$curr_sp]).'';

?'."n",

$source);

}

}*/

return

preg_replace("/{([^}{n]*)}/e",

"$this-select('1');",

$source);

}

替换完成后台在后台右上角点击清楚缓存刷新页面即可

ecshop代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于ecshop开发手册、ecshop代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/29333.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载