ECMALL OR PHP调试笔记
  • 分类:经验分享
  • 发表:2015-05-09
  • 围观(4,482)
  • 评论(0)

1、用户店铺新增字段

在ecm_store中新增相应字段,在Themes/mall/*/my_styor.index.html中增加相应表单元件。

在/app/my_store.app.php约第145行下新加'map'      => $_POST['map'],格式内容即可。

复选框的可以使用$committed =implode("|",$_POST['committed']);格式,下面数据库添加的语句改为'committed'      => $committed,

复选框时,前台(Themes/mall/*/my_styor.index.html)显示语句为:{if strstr($store.committed,'1')} checked{/if}

2、商家店铺幻灯增加

在Themes/mall/*/my_store.slides.htm中新增相应表单元件。

在/app/my_store.app.php找到for($i=1;$i<=3;$i++) 改为for($i=1;$i<=4;$i++) ,改下数值即可。

3、在页面中调用店铺分类

在/app/目录下相应的PHP文件中添加函数:

/* 取得店铺分类 */
function _list_scategory()
{
$scategory_mod =& m('scategory');
$scategories = $scategory_mod->get_list(-1,true);

import('tree.lib');
$tree = new Tree();
$tree->setTree($scategories, 'cate_id', 'parent_id', 'cate_name');
return $tree->getArrayList(0);
}

在该文件的index()函数中添加

$scategorys = $this->_list_scategory();
$this->assign('scategorys', $scategorys);

在该应用的模板中加入

<!--{foreach from=$scategorys item=scategory name=fe_scate}-->
<dl {if $smarty.foreach.fe_scate.first} style="border:none" {/if}>
<dt><a href="/stores/{$scategory.id}">{$scategory.value|escape}</a></dt>
<!--{foreach from=$scategory.children item=child}-->
<dd><a href="/stores/{$child.id}">{$child.value|escape}</a></dd>
<!--{/foreach}-->
</dl>
<!--{/foreach}-->

模板格式是这样,内容可以更改哦。

4、循环中使用序号

{$smarty.foreach.fe_slides.iteration},红色对应循环中的name名称。

5、循环get_list中添加可以字段

默认的get_list字段显示内容不完整,需要增加字段需要在/includes/models/goods.models.php中添加相应的字段。

上例为商品信息类,其它的如店铺类或团购类在其它文件。

Top