• 欢迎访问苗景云的博客

Warning: Invalid argument supplied for foreach()
问题Warning: Invalid argument supplied for foreach() in 完善解决方案
将报错的语句做如下修改(例):

QUOTE:
foreach($extcredits as $id => $credit)
{
         if($credit['ratio'])
         {
                 $exchcredits[$id] = $credit;
         }
}

发布:苗景云 | 查看全文 | 浏览(1548) | 分类:IT技术&设计 | 评论(1) | 2019年02月26日

ECshop后台的商品类型每个属性值都是独立的,因此如果我们用 ECSHOP商品属性调用到任意页面方法 时,会出现只能调用某个分类的商品属性。这个时候我们就要对代码进行修改,根据产品所属的分类ID进行判断。

发布:苗景云 | 查看全文 | 浏览(1483) | 分类:IT技术&设计 | 评论(1) | 2018年03月08日

看到标题有的人觉得这个很复杂,其实这个没那么复杂,直接用下面的方法,就可以在ECSHOP的任意页面调用商品属性。

发布:苗景云 | 查看全文 | 浏览(1233) | 分类:IT技术&设计 | 评论(0) | 2018年03月01日

1、首先修改 category.php 文件

$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .

修改为

$sql = 'SELECT g.goods_id, g.goods_name, b.brand_name , g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .

发布:苗景云 | 查看全文 | 浏览(1242) | 分类:IT技术&设计 | 评论(0) | 2018年02月28日

Ecshop分类页面的品牌筛选默认不显示该品牌下商品数量,如果需要显示,可能通过一下方法进行修改。


首先打开category.php,搜索函数$brands,大约438行,在对应位置添加下面红色代码。


foreach ($brands AS $key => $val)

    {

        $temp_key = $key + 1;

发布:苗景云 | 查看全文 | 浏览(1324) | 分类:IT技术&设计 | 评论(0) | 2018年02月28日

说明:默认Ecshop添加添加新的商品相册图后,该图片就会置于商品相册的最后一个,于是前台显示放大图就会于相册第一张不同。原因是代码里面没有排序。

发布:苗景云 | 查看全文 | 浏览(1217) | 分类:IT技术&设计 | 评论(0) | 2018年02月27日

首页的推荐商品包括热销推荐和促销三个文件

发布:苗景云 | 查看全文 | 浏览(1335) | 分类:IT技术&设计 | 评论(0) | 2016年09月23日

1、打开mobile/index.php,添加以下代码


//获取商品分类 

$pcat_array = get_categories_tree();

foreach ($pcat_array as $key => $pcat_data)

{

    $pcat_array[$key]['goods_list'] = get_parent_category_goods($pcat_data['id']);

发布:苗景云 | 查看全文 | 浏览(2748) | 分类:管理&经济 | 评论(0) | 2016年09月23日
1.在sq执行语句
 
ALTER TABLE `ecs_goods` ADD `sales_volume_base` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'  
 
INSERT INTO `ecs_shop_config` (`parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order` ) VALUES ('7','show_goods_sales', 'select', '1,0', '', '1', '1');  
 
INSERT INTO `ecs_shop_config` (`parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order` ) VALUES ('3', 'show_sales_type', 'select', '1,0', '', '1', '1');  
注意:如果你的数据表前缀不是‘ecs_’ 请自行修改
 
2./admin/includes/lib_goods.php中
 
$sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, " .  
            " (promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today') AS is_promote ".  
            " FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='$is_delete' $where" .  
            " ORDER BY $filter[sort_by] $filter[sort_order] ".  
            " LIMIT " . $filter['start'] . ",$filter[page_size]";  
修改为
 
        $sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, sales_volume_base, " .   
                    " (promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today') AS is_promote ".  
                    " FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='$is_delete' $where" .  
                    " ORDER BY $filter[sort_by] $filter[sort_order] ".  
                    " LIMIT " . $filter['start'] . ",$filter[page_size]";  
 
3./admin/templates/goods_list.htm,在
 
{if $use_storage}  
<th><a href="javascript:listTable.sort('goods_number'); ">{$lang.goods_number}</a>{$sort_goods_number}</th>  
{/if}  
后,添加
 
<th><a href="javascript:listTable.sort('sales_volume_base'); ">{$lang.sales_volume_base}</a>{$sort_sales_volume_base}</th>  
 
{if $use_storage}  
<td align="right"><span onclick="listTable.edit(this, 'edit_goods_number', {$goods.goods_id})">{$goods.goods_number}</span></td>  
{/if}  
后,添加
 
<td align="center"><span onclick="listTable.edit(this, 'edit_sales_volume_base', {$goods.goods_id})">{$goods.sales_volume_base}</span></td>  
 
4./admin/goods.php,在
 
/** 
 * 列表链接 
 * @param   bool    $is_add         是否添加(插入) 
 * @param   string  $extension_code 虚拟商品扩展代码,实体商品为空 
 * @return  array('href' => $href, 'text' => $text) 
 */  
function list_link($is_add = true, $extension_code = '')  
前,添加
 
/*------------------------------------------------------ */  
//-- 修改商品虚拟销量  
/*------------------------------------------------------ */  
elseif ($_REQUEST['act'] == 'edit_sales_volume_base')  
{  
    check_authz_json('goods_manage');  
  
    $goods_id = intval($_POST['id']);  
    $sales_volume_base = json_str_iconv(trim($_POST['val']));  
  
    if ($exc->edit("sales_volume_base = '$sales_volume_base', last_update=" .gmtime(), $goods_id))  
    {  
        clear_cache_files();  
        make_json_result(stripslashes($sales_volume_base));  
    }  
}  
5.goods.php,在
 
$smarty->assign('categories',         get_categories_tree($goods['cat_id']));  // 分类树  
后,添加
 
$smarty->assign('sales_count',        get_sales_count($goods_id));  
在末尾添加
 
/* 商品累计销量带自定义_新增加 */  
function get_sales_count($goods_id)  
{  
    /* 查询该商品的自定义销量 */  
    $sales_base = $GLOBALS['db']->getOne('SELECT sales_volume_base FROM '.$GLOBALS['ecs']->table('goods').' WHERE goods_id = '.$goods_id);  
    /* 查询该商品的实际销量 */  
    $sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' .  
        'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' .  
            $GLOBALS['ecs']->table('order_goods') . ' AS g ' .  
        "WHERE o.order_id = g.order_id " .  
        "AND o.order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) .  
        "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) .  
        " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) .  
        " AND g.goods_id = '$goods_id'";  
    $sales_count = $GLOBALS['db']->getOne($sql);  
    /* 商品累计销量默认显示方式 */  
    if ($GLOBALS['_CFG']['show_sales_type'])  
    {  
        $row['sales_volume_total'] =  $sales_count; //实际销量  
    }  
    else  
    {  
        $row['sales_volume_total'] =  $sales_base + $sales_count; //自定义销量+实际销量  
    }  
    return ($row['sales_volume_total']);  
}  
6.在/languages/zh_cn/admin/shop_config.php,中
 
/languages/zh_cn/admin/shop_config.php  
下,添加
 
$_LANG['cfg_name']['show_goods_sales'] = '是否显示商品累计销量';  
$_LANG['cfg_range']['show_goods_sales']['1'] = '显示';  
$_LANG['cfg_range']['show_goods_sales']['0'] = '不显示';  
$_LANG['cfg_name']['show_sales_type'] = '商品累计销量默认显示方式';  
$_LANG['cfg_range']['show_sales_type'][1] = '真实显示';  
$_LANG['cfg_range']['show_sales_type'][0] = '虚拟显示';  
 
7./languages/zh_cn/admin/goods.php,中
 
$_LANG['goods_sn_exists'] = '您输入的货号已存在,请换一个';  
后,添加
 
$_LANG['sales_volume_base'] = '虚拟销量';  
 
8./languages/zh_cn/common.php,中
 
$_LANG['divided_into'] = '分成规则';  
后,添加
 
$_LANG['sales_volume_total'] = '累计销量:';   
$_LANG['pcs'] = '件';  
 
9./themes/default/goods.dwt,在
 
<img src="images/stars{$goods.comment_rank}.gif" alt="comment rank {$goods.comment_rank}" />  
 </dd>  
后,添加
 
{if $cfg.show_goods_sales}  
<dd style="width:48%; padding-left:7px;">  
<strong>{$lang.sales_volume_total}</strong>  
<font class="shop">{$sales_count}{if $goods.measure_unit}{$goods.measure_unit}{else}{$lang.pcs}{/if}</font>  
</dd>  
{/if}  
OK,完成!


发布:苗景云 | 查看全文 | 浏览(1396) | 分类:IT技术&设计 | 评论(0) | 2016年09月22日

 

管理员密码忘记,通过重新安装的密码更换数据库,或者通过md5加密密文替换数据库,都一一失败,这个问题困扰了很多朋友。

发布:苗景云 | 查看全文 | 浏览(1221) | 分类:IT技术&设计 | 评论(0) | 2016年09月21日

 1.includes/lib_goods.php 288行修改成,(红色是添加内容)
$sql = 'SELECT b.brand_name,g.goods_id,g.goods_sn, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price,' .
                "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
                "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " .
                'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
    'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' .
                "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
                "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]'";


2..includes/lib_goods.php 中 $goods[$idx]['brief']        = $row['goods_brief'];下面添加一行
$goods[$idx]['brand_name']        = $row['brand_name'];

3.首页index.dwt中 用{$goods.brand_name}调用

效果如下。可以连品牌一起调用出来咯
\

发布:苗景云 | 查看全文 | 浏览(1239) | 分类:IT技术&设计 | 评论(0) | 2015年08月06日

 

Ecshop修改商品分类页的排序方式为推荐排序

  要 修改Ecshop商品分类页图片的排序方式,我们只需要修改Ecshop里category.php的$default_sort_order_type 默认的排序方式,Ecshop默认的排序方式是以商品的goods_id商品的序号来排序的,我这里呢就改为推荐排序sort_order来排序了,这就 是Ecshop后台商品列表页的热销和库存中间的推荐排序,修改这里的数字就可以让商品分类页的商品按照这个来排序了!

发布:苗景云 | 查看全文 | 浏览(1054) | 分类:IT技术&设计 | 评论(0) | 2015年08月06日

 

ECSHOP留言板添加字段虽然有点繁锁,但也不是很难,操作方法如下(本人已经实现过):
步骤 1. 更改文件message_board.dwt
<tr>
<td align="right">{$lang.message_board_qq}</td>
<td><input name="msg_qq" type="text" class="inputBg" size="20" value=""/></td>
</tr>
<script type="text/javascript">
        {foreach from=$lang.message_board_js item=item key=key}
        var {$key} = "{$item}";
        {/foreach}
        {literal}
       
        function submitMsgBoard(frm)
        {
            var msg = new Object;
             msg.user_email  = frm.elements['user_email'].value;
      msg.msg_qq  = frm.elements['msg_qq'].value;         
             msg.msg_title   = frm.elements['msg_title'].value;
             msg.msg_content = frm.elements['msg_content'].value;
             msg.captcha     = frm.elements['captcha'] ? frm.elements['captcha'].value : '';
   
   
            var msg_err = '';
            if (msg.user_email.length > 0)
            {
               if (!(Utils.isEmail(msg.user_email)))
               {
                  msg_err += msg_error_email + '\n';
                }
             }
             else
             {
                  msg_err += msg_empty_email + '\n';
             }
            if (msg.msg_title.length == 0)
            {
                msg_err += msg_title_empty + '\n';
            }
            if (frm.elements['captcha'] && msg.captcha.length==0)
            {
                msg_err += msg_captcha_empty + '\n'
            }
            if (msg.msg_content.length == 0)
            {
                msg_err += msg_content_empty + '\n'
            }
   
   if (msg.msg_qq.length == 0)
            {
                msg_err += 'QQ不能为空\n';
            }
   
            if (msg.msg_title.length > 200)
            {
                msg_err += msg_title_limit + '\n';
            }
            if (msg_err.length > 0)
            {
                alert(msg_err);
                return false;
            }
            else
            {
                return true;
            }
        }
        {/literal}
        </script>
 
步骤 2. 更改文件message.php
 $message = array(
        'user_id'     => $user_id,
        'user_name'   => $user_name,
        'user_email'  => isset($_POST['user_email']) ? htmlspecialchars(trim($_POST['user_email']))     : '',
        'msg_qq'   => isset($_POST['msg_qq']) ? trim($_POST['msg_qq'])     : '', 
        'msg_type'    => isset($_POST['msg_type']) ? intval($_POST['msg_type'])     : 0,
        'msg_title'   => isset($_POST['msg_title']) ? trim($_POST['msg_title'])     : '',
        'msg_content' => isset($_POST['msg_content']) ? trim($_POST['msg_content']) : '',
        'order_id'    => 0,
        'msg_area'    => 1,
        'upload'      => array()
     );
 
步骤 2. 更改文件lib_clips.php
 $message['msg_area'] = isset($message['msg_area']) ? intval($message['msg_area']) : 0;
    $sql = "INSERT INTO " . $GLOBALS['ecs']->table('feedback') .
            " (msg_id, parent_id, user_id, user_name, user_email,msg_qq, msg_title, msg_type, msg_status,  msg_content, msg_time, message_img, order_id, msg_area)".
            " VALUES (NULL, 0, '$message[user_id]', '$message[user_name]', '$message[user_email]', ".
            " '$message[msg_qq]','$message[msg_title]', '$message[msg_type]', '$status', '$message[msg_content]', '".gmtime()."', '$img_name', '$message[order_id]', '$message[msg_area]')";
    $GLOBALS['db']->query($sql);

发布:苗景云 | 查看全文 | 浏览(1248) | 分类:IT技术&设计 | 评论(0) | 2015年08月06日

 

Ecshop 修改收货人信息 把电话改成选择填写 手机改为必填 (加强版)


发布:苗景云 | 查看全文 | 浏览(1205) | 分类:IT技术&设计 | 评论(0) | 2015年08月03日

打开,includes/lib_common.php

发布:苗景云 | 查看全文 | 浏览(996) | 分类:IT技术&设计 | 评论(0) | 2015年08月03日

 \
大家可以看到,上面是没有显示产品型号的,如何显示产品型号呢,请看下面操作步骤
一、ecshop后台->商品管理->商品上传->商品属性,添加产品型号
\
如果这个步骤不会的童鞋,请看Ecshop基础教程,关于后台编辑那块,网上很多的,我就不再重复
二、更改文件,根目录/category.php 大概第447行代码
  源代码:

发布:苗景云 | 查看全文 | 浏览(1324) | 分类:IT技术&设计 | 评论(0) | 2015年07月31日

 一、数据库结构修改
1、用phpMyAdmin打开mysql数据库
2、选择表“ecs_users ”
3】添加你想要加的字段
二、修改模板文件

修改themes/你所选模板目录下/user_transaction.dwt文件
<tr>
                  <td width="28%" align="right" bgcolor="#FFFFFF">{$lang.other_mobile_phone}:</td>
                  <td width="72%" align="left" bgcolor="#FFFFFF"><input name="other[mobile_phone]" type="text" value="{$profile.mobile_phone}" class="formBorder" />
                  </td>
                </tr>
   <tr>
                  <td width="28%" align="right" bgcolor="#FFFFFF">{$lang.other_family_birthday}:</td>
                  <td width="72%" align="left" bgcolor="#FFFFFF"><input name="extend_field6" type="text" value="{$profile.family_birthday}" class="formBorder" />
                  </td>
                </tr>

发布:苗景云 | 查看全文 | 浏览(1308) | 分类:IT技术&设计 | 评论(0) | 2015年07月28日

 

先上效果图吧

发布:苗景云 | 查看全文 | 浏览(1550) | 分类:IT技术&设计 | 评论(0) | 2015年07月26日
« 之后的文章苗景云的博客
<< 向左走,向右走 >>
更早的文章 »