Table of Contents
ECSHOP二次开发杂记(一),ecshop二次开发杂记
Home Backend Development PHP Tutorial ECSHOP二次开发杂记(一),ecshop二次开发杂记_PHP教程

ECSHOP二次开发杂记(一),ecshop二次开发杂记_PHP教程

Jul 13, 2016 am 10:03 AM
ecshop

ECSHOP二次开发杂记(一),ecshop二次开发杂记

\includes\lib_commom.php =>公用函数库

\includes\lib_main.php =>前台公用函数库

\includes\lib_init.php =>初始化,供/index.php调用

\includes\lib_insert.php =>动态内容函数库 模板{insert name='ads' id=$ads_id num=$ads_num} 所调用的函数即是 function insert_ads

\includes\cls_template.php =>含有格式化函数 模板{$goods.name|escape:html}

\includes\inc_constant.php=>常量定义

 

【foreach的使用方法】

1:foreach使用规则,他有以下几个参数 from ,item name iteration index

2:如何使用foreach循环

  如果php要传递一个数组(如:$array)给ecshop的smarty模板.那么我们将通过from=$array 来接受,写法是{foreach from = $array item = item}

 

3:
     ecshop中smarty的下标如何表示,请看下面的例子:
     {foreach from = $array item = item name=name}
     {$smarty.foreach.name.iteration}
     {/foreach}

     这里的iteration就是从1开始的下标,
     如果要从0开始的下标,应该使用{$smarty.foreach.name.index}

 

4:如何判断是否是foreach循环的开始和结束,最后一个元素.

   {if $smarty.foreach.last}表示循环的最后一个元素.{if $smarty.freach.first}表示循环的开始.
 

  5:如何使用双重循环.

  举例如下:

{foreach from = $test item =item}

 {foreach from=$item.children item=child}
 {$child.name}
 {/foreach}
{/foreach}

 

6:from传参形式

模板:

smarty:$smarty->assign('navigator_list',        get_navigator($ctype, $catlist));

模板里引用的from值[middle]就是参数

 

【smarty->display函数的用法】

根据id显示不同页面:

http://127.0.0.13/article_cat.php?id=6

http://127.0.0.13/article_cat.php?id=7

 

if($cat_id==6){
    $smarty->display('article_cat_xgzn.dwt', $cache_id);
}elseif($cat_id==7){
    $smarty->display('article_cat_boke.dwt', $cache_id);
}else{
    $smarty->display('article_cat.dwt', $cache_id);
}

【小技巧】

转换UNIX时间戳: $goods[$idx]['sj_date']   = date($GLOBALS['_CFG']['date_format'], $row['sj_date']);

文本格式化:{$cat_goods.name|escape:html}

字符串截取:{$brand.brand_desc|truncate:11}、{$article.short_title|truncate:15:"...":true}

处理换行:{$title|nl2br}将php中的换行符变成HTML中的

过滤HTML标签:{$title|strip_tags}

goods.dwt大图:{$pictures.0.img_url}

 

 

【后台模板二次开发】

1.增加商品属性:

a.向数据表(*_goods)添加字段(sj_date)。

b.向模板(admin/templates/goods_info.htm)添加

c.向后台提交数据处理函数添加字段进行入库(admin/goods.php)。

d.前台显示函数进行处理(includes\lib_goods.php)。

2.设置后台模板[商品分类页模板]增加新品上架:

 a.向数据表(*_template)新增记录

b.向/admin/includes/lib_template.php添加新增的库 (3代表可编辑数量)

 

3.在模板中多维数组的遍历:

a.数组原型:print_r打印

ECSHOP二次开发杂记(一),ecshop二次开发杂记_PHP教程$smarty->assign('properties', $properties['pro']); // 商品属性 print_r($properties['pro']);=>Array ( [技术参数] => Array ( [1] => Array ( [name] => 连接 [value] => 3.5mm/6.3mm ) [2] => Array ( [name] => 佩戴方式 [value] => 头戴式 ) [3] => Array ( [name] => 特性 [value] => 主动降噪 ) ) ) View Code

b.模板foreach遍历

ECSHOP二次开发杂记(一),ecshop二次开发杂记_PHP教程 li> span>{$arr2.name}:span> img src="images/goods-r-pj{$arr2.value}.jpg" alt=""> li> View Code

 

留言板二次开发:

完成功能:

1.\includes\inc_constant.php  line:129  添加 define('M_SELL',                    7); // 出售

2.\languages\zh_cn\common.php line:634 添加 $_LANG['message_type'][M_SELL] = '出售';

3.\languages\zh_cn\admin\user_msg.php line:35 修改 $_LANG['type'] = array('留言','投诉','询问','售后','求购','商家留言','评论','出售');//注意下标

4.向数据表(*_<span class="syntax"><span class="inner_sql"><span class="syntax_quote syntax_quote_backtick">feedback</span></span></span>)添加字段

5./message.php line:72 $message数组中接收页面传递的数据

6./includes/lib_clips.php line:197 $sql中添加向数据库插入字段

7.后台查看显示 更改模板msg_info.htm

ECSHOP二次开发杂记(一),ecshop二次开发杂记_PHP教程div class="hg150317"> ul> li>span>商品名称:span>{$msg.msg_title|escape:"html"}li> li>span>商品型号:span>{$msg.goods_type|escape:"html"}li> li>span>出售价格:span>{$msg.goods_price}li> li>span>姓名:span>{$msg.user_name}li> li>span>邮箱:span>{$msg.user_email}li> li>span>证件类型:span>{if $msg.papers_type==0}身份证{elseif $msg.papers_type==1}护照{elseif $msg.papers_type==2}驾驶证{else}台胞证{/if}li> li>span>证件号:span>{$msg.paper_number}li> li>span>电话:span>{$msg.tel}li> li>span>地址:span>{$msg.address}li> li>span>备注:span>{$msg.msg_content|escape:"html"|nl2br}li> ul> div> View Code

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/969245.htmlTechArticleECSHOP二次开发杂记(一),ecshop二次开发杂记 \includes\lib_commom.php =公用函数库 \includes\lib_main.php =前台公用函数库 \includes\lib_init.php =初始化,供...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the architecture of ecshop? What is the architecture of ecshop? Feb 23, 2023 am 09:32 AM

ecshop is a "B2C" architecture; ecshop is a B2C independent online store system, suitable for enterprises and individuals to quickly build personalized online stores; the system is a cross-platform open source program developed based on PHP language and MYSQL database architecture.

What are the methods for sorting ecshop articles? What are the methods for sorting ecshop articles? Jun 16, 2023 am 11:30 AM

How to sort ecshop articles: 1. Sort by publication time, you can control the order of articles in the list by modifying the publication time of the article; 2. Sort by clicks, you can achieve this sorting by installing the "Article Click Ranking" plug-in Function, this plug-in can count the number of clicks on articles; 3. Sort by the number of comments, you can implement this sorting function by installing the "Article Comment Ranking" plug-in, which can count the number of comments on articles; 4. Sort by relevance, This sorting function can be achieved by installing the "Search Ranking" plug-in.

What are the characteristics of ecshop? What are the characteristics of ecshop? Feb 13, 2023 am 09:43 AM

Features: 1. Open source system with flexibility, customizability and high scalability; 2. Support independent secondary development; 3. Rich templates and plug-ins; 4. Strong industry adaptability; 5. Avoid being constrained by software vendors; 6. Stronger reliability and stability; 7. Mobile H5 framework upgrade, based on VUE comprehensive replacement, more flexible and open; 8. Multi-level rebate function, supporting QR codes, posters and other promotion methods, unlimited fission development of distributors ; 8. The visual interaction of the management terminal is completely renewed, the UI is simple and beautiful, and the operating experience is upgraded; 9. Supports PHP7.2, and the performance is doubled.

What program is ecshop? What program is ecshop? Feb 16, 2023 am 10:38 AM

ECShop is a B2C independent online store system. It is a cross-platform open source program developed based on PHP language and MYSQL database architecture. It is suitable for enterprises and individuals to quickly build personalized online stores. The characteristics of the ecshop mall system: 1. Support independent secondary development; 2. Rich templates and plug-ins; 3. Strong industry adaptability; 4. Avoid being constrained by software vendors; 5. Stronger reliability and stability.

What is the model of ecshop? What is the model of ecshop? Feb 22, 2023 am 09:37 AM

ecshop is a B2C model. ECShop is a B2C independent online store system, suitable for enterprises and individuals to quickly build personalized online stores. B2C refers to a model of e-commerce, and it is also a retail model that sells products and services directly to consumers; the payment method of B2C e-commerce is a combination of cash on delivery and online payment, and most companies choose logistics outsourcing for delivery. to save operating costs.

Ecshop product management advanced: learn how to add fields Ecshop product management advanced: learn how to add fields Mar 12, 2024 pm 02:06 PM

Ecshop Product Management Advanced: Learn how to add fields, you need specific code examples. When using Ecshop for product management, you often encounter situations where you need to add some custom fields to meet specific needs. By adding fields, more precise product management and better user experience can be achieved. This article will introduce how to add fields in Ecshop and provide specific code examples. First, we need to clarify the need to add fields. For example, we need to add a "production date" field to the product details page to

How to remove copyright at the bottom of ecshop How to remove copyright at the bottom of ecshop Aug 08, 2023 pm 02:42 PM

Method to remove the copyright at the bottom of ecshop: 1. Modify the template file, the specific location is: themes/your_theme directory, find the footer.html file in this directory, open it with a text editor, find the code segment containing the copyright information, delete it or Comment out. Just save the file and close it; 2. To use the plug-in, log in to the backend, click plug-in management, search for copyright and other related keywords at the bottom, select a suitable plug-in to install and enable it; 3. To purchase a theme, purchase it on the official website of ECShop etc.

How to cancel delivery method in ecshop How to cancel delivery method in ecshop Mar 03, 2023 am 09:56 AM

How to cancel the shipping method in ecshop: 1. Find and open the "flow.dwt" file, and then delete "<!--{if $total.real_goods_count neq 0}-->...<!-- {/if} - ->" code; 2. Change "checkOrderForm(frm)" in "js/shopping_flow.js" to "if (document.getElementById(...)".

See all articles