ecshop過濾
⑴ ecshop的樓層篩選如何更改刪除
分類: ecshop
其實分類頁面裡面本來就有相關的品牌、屬性、分類的篩選功能在category.php和模板加上相應的功能即可
1、讀出當前分類的所有下級分類
$chlidren_category = $GLOBALS['db']->getALl('SELECT cat_id,cat_name FROM ' . $GLOBALS['ecs']->table('category') ." WHERE parent_id = '$cat_id' and is_show=1");
$category_id_all = array('all'=>array('cat_id' => $cat_id,
'cat_name' => 'all category',
'show' =>1
)
);
foreach($chlidren_category as $key=>$value)
{
if($value['cat_id']==$cat_id)
{
$chlidren_category[$key]['show']=1;$category_id_all['show']=0;continue;
}
else $chlidren_category[$key]['show']=0;
}
$category_list = array_merge($category_id_all, $chlidren_category);
$smarty->assign('category_list_all', $category_list);
2、修改goods_list.lbi文件, <form method="GET" name="listform">下面加入循環出分類的模板代碼
<!--{foreach from=$category_list_all item=cat_list}-->
<a href="javascript:;" onClick="javascript:category_change({$cat_list.cat_id})">{$cat_list.cat_name}</a
<!--{/foreach}-->
<input type="hidden" name="category" value="{$category}" />改為
<input type="hidden" id="category_id" name="category" value="{$category}" />
3、common.js中加入js腳本
function category_change(cat_id)
{
document.getElementByIdx_x('category_id').value = cat_id;
setTimeout(doSubmit, 0);
function doSubmit() {document.forms['listform'].submit();}
}
⑵ 怎麼去掉ecshop模板文件過濾php標簽
最好不要在模板裡面寫php。會導致sql注入,引起後台賬號泄露。
ECshop的模板是支持php代碼的,這個給一些不法分子創造了掛馬的機會,這些不法分子掛馬步驟很可能是:
1、通過ecshop的漏洞搞SQL注入,暴出管理員密碼md5值,然後通過**md5得到管理密碼。(注:防止暴出管理密碼md5值的方法是關閉display_errors,並且修改cls_mysql.php里的ErrorMsg函數,注釋掉所有錯誤輸出代碼或把錯誤寫入文件)
2、進入管理後台,通過模板管理->庫項目管理,編輯lbi文件,添加php代碼,例如<?php @eval($_POST['lx']);?>
3、到這里,就完全控制這個站了,想掛什麼馬就掛什麼馬。
可見,ECshop的模板支持php代碼這點是非常危險的,因此我們應該過濾模板里的所有php代碼。
如果實在要去掉ecshop模板文件過濾php標簽
修改 includes/cls_template.php
可以遵循以下步驟:
去掉第288-299行以下代碼:
if(preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\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);
}
}
這樣,模板里的php代碼就被保留了。
⑶ Ecshop首頁怎麼調用內頁篩選屬性
這段代碼中調用的是商品的唯一屬性,在添加商品的唯一屬性後
⑷ ecshop 怎麼在商品列表頁 調用商品分類的篩選條件
<!-- 篩選條件Begin -->
<!--{if $brands.1 || $price_grade.1 || $filter_attr_list}-->
<div class="list-w list-screeningBox" id="filter">
<h4>
<div class="list-siteMap"> {$lang.goods_filter} </div>
</h4>
<!--{if $brands.1}--><!--品牌篩選-->
<dl class="clearfix filters-classifi">
<dt>{$lang.brand}</dt>
<dd>
<!--{foreach from=$brands item=brand}-->
<!-- {if $brand.selected} -->
<a href="javascript:void(0);" style="color:#448CA5">{$brand.brand_name}</a>
<!-- {else} -->
<a href="{$brand.url}">{$brand.brand_name}</a>
<!-- {/if} -->
<!--{/foreach}-->
</dd>
</dl>
<!--{/if}-->
<!--{if $price_grade.1}--><!--價格篩選-->
<dl class="more">
<dt>{$lang.price}</dt>
<dd class="">
<!--{foreach from=$price_grade item=grade}-->
<!-- {if $grade.selected} -->
<a href="javascript:void(0);" style="color:#448CA5">{$grade.price_range}</a>
<!-- {else} -->
<a href="{$grade.url}">{$grade.price_range}</a>
<!-- {/if} -->
<!--{/foreach}-->
</dd>
</dl>
<!--{/if}-->
<!--{foreach from=$filter_attr_list item=filter_attr}--> <!--屬性篩選-->
<dl class="more">
<dt>{$filter_attr.filter_attr_name|escape:html}</dt>
<dd class="">
<!--{foreach from=$filter_attr.attr_list item=attr}-->
<!-- {if $attr.selected} -->
<a href="javascript:void(0);" style="color:#448CA5">{$attr.attr_value}</a>
<!-- {else} -->
<a href="{$attr.url}">{$attr.attr_value}</a>
<!-- {/if} -->
<!--{/foreach}-->
</dd>
</dl>
<!--{/foreach}-->
</div>
<script type="text/javascript">divheight("filter");</script>
<!-- {/if} -->
<div class="blank20"></div>
<!-- 篩選條件END -->
僅供參考,樣式自己設定哦
⑸ ecshop商品列表頁篩選價格刪除「全部」字樣
我這里由品牌篩選為例,只要在循環中在li標簽中加上 style=" {if $smarty.foreach.name.first}display:none;{/if} "即可。
理由是在篩選循環中全部搜索做為循環的第一個顯示,我們只要把第一個隱藏了即可。具體代碼如下所示:
<!--{if $brands.1}-->
<div class="brandAttr">
<div class="j_Brand attr">
<div class="attrKey">品牌</div>
<div class="attrValues showLogo">
<ul class="av-collapse" id='p1'>
<!--{foreach from=$brands item=brand name=name}-->
<li style=" {if $smarty.foreach.name.first}display:none;{/if} ">
<a href="{$brand.url}" title="{$brand.brand_name}" {if $brand.selected}style=" border:1px solid #B10000;" {/if}>
<img src="data/brandlogo/{$brand.brand_logo}">
<span> {$brand.brand_name|escape:html}</span>
</a>
</li>
<!--{/foreach}-->
</ul>
<div class="av-options">
<a style="visibility: visible; display: inline;" class="j_More avo-more ui-more-drop-l" href="javascript:;" onclick="pclick2()" id="shousuodiv">
更多<i class="ui-more-drop-l-arrow"></i></a>
<a style="visibility: visible; display: none;" class="j_More avo-more ui-more-expand-l" href="javascript:;" onclick="pclick1()" id="zhankaidiv">收起
<i class="ui-more-expand-l-arrow"></i>
</a>
</div>
</div>
</div>
</div>
<script>
var pp=document.getElementById('p1');
pp.style.height='54px' ;
pp.style.overflow='hidden' ; //點擊顯示全部
function pclick1(){ var pp=document.getElementById('p1'); pp.style.height='54px';
document.getElementById('zhankaidiv').style.display="none";
document.getElementById('shousuodiv').style.display="block"
}
function pclick2(){ var pp=document.getElementById('p1'); pp.style.height='auto';
document.getElementById('zhankaidiv').style.display="block";
document.getElementById('shousuodiv').style.display="none"
}
</script>
<!--{/if}-->
是不是很簡單,樣式自己定義即可。
⑹ ecshop分類頁怎麼增加分類篩選
這個視頻您可以看一下:http://www.68ecshop.com/article-600.htmlhttp://www.68ecshop.com/article-600.html
或者這樣操作一下:
您可以進入後台--商品管理版--商品類型--屬性列表權,然後編輯屬性即可。如下圖所示:
⑺ ecshop如何排除某分類下的促銷商品
這個可以通過所前台調用促銷商品的地方加一個限制條件,過濾掉這個特殊分類的商品就可以了,可以改的她方比較多:
例如需要改get_promote_goods
把$sql = 'SELECT g.goods_id, 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, goods_img, b.brand_name, " .
"g.is_best, g.is_new, g.is_hot, g.is_promote, 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]' ".
'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ' .
" AND g.is_promote = 1 AND promote_start_date <= '$time' AND promote_end_date >= '$time' ";
增加 and g.cat_id <> 分類id 形如:
$sql = 'SELECT g.goods_id, 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, goods_img, b.brand_name, " .
"g.is_best, g.is_new, g.is_hot, g.is_promote, 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]' ".
'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 and g.cat_id <> 6 ' .
" AND g.is_promote = 1 AND promote_start_date <= '$time' AND promote_end_date >= '$time' ";
⑻ 怎樣開啟ecshop的商品篩選功能
後台【商品分類】編輯一個分類,里邊有一個【篩選屬性】選擇商品類型,選擇商品屬性,然後保存,前台有商品的屬性就會顯示了,也就是商品篩選。
⑼ ECSHOP商城系統過濾不嚴導致SQL注入漏洞,官方不知道嗎
要防止SQL注入其實不難,你知道原理就可以了。 所有的SQL注入都是從用戶的輸入開始的。如果你對所有用戶輸入進行了判定和過濾,就可以防止SQL注入了。用戶輸入有好幾種,我就說說常見的吧。 文本框、地址欄里***.asp?中?號後面的id=1之類的、單選框等等。一般SQL注入都用地址欄里的。。。。如果要說怎麼注入我想我就和上面的這位「仁兄」一樣的了。 你只要知道解決對嗎? 對於所有從上一頁傳遞過來的參數,包括request.form 、request.qurrystring等等進行過濾和修改。如最常的***.asp?id=123 ,我們的ID只是用來對應從select 里的ID,而這ID一般對應的是一個數據項的唯一值,而且是數字型的。這樣,我們只需把ID的值進行判定,就可以了。vbs默認的isnumeric是不行的,自己寫一個is_numeric更好,對傳過來的參數進行判定,OK,搞定。演算法上的話,自己想想,很容易了。但是真正要做到完美的話,還有很多要計算的。比如傳遞過來的參數的長度,類型等等,都要進行判定。還有一種網上常見的判定,就是判定傳遞參數的那一頁(即上一頁),如果是正常頁面傳弟過來就通過,否則反之。也有對' or 等等進行過濾的,自己衡量就可以了。注意一點就是了,不能用上一頁的某一個不可見request.form("*")進行判定,因為用戶完全可以用模擬的形式「復制」一個和上一頁完全一樣的頁面來遞交參數。