花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來(lái)到素材無(wú)憂網(wǎng),按 + 收藏我們
登錄 注冊(cè) 退出 找回密碼

ecshop商品自定義商品促銷圖標(biāo)

時(shí)間: 2024-02-25 10:43 閱讀: 作者:素材無(wú)憂網(wǎng)

大家是不是在一些商城的產(chǎn)品列表中,產(chǎn)品價(jià)格的左側(cè)或右側(cè)看到"新品""精品""熱銷""促銷""瘋搶價(jià)"等,這些小圖標(biāo)在整個(gè)列表中,除了簡(jiǎn)單的標(biāo)示外,實(shí)際上也對(duì)用戶的吸引度起著不小的作用哦,默認(rèn)的似乎還不夠滿足我們的需要,帶大家一起來(lái)制作一個(gè)簡(jiǎn)易的圖標(biāo)效果吧,僅供大家參考哦。
還是以數(shù)據(jù)庫(kù)修改為妙,這樣做起來(lái)會(huì)比較快哦。首先我們?cè)谏唐窋?shù)據(jù)表:ecs_goods中,添加一個(gè)新的字段為:goods_icon,不懂的朋友直接運(yùn)行下面這句:
ALTER TABLE ecs_goods ADD goods_icon char(50) NOT NULL DEFAULT '';
后臺(tái)運(yùn)行前,請(qǐng)先自行備份好原數(shù)據(jù)庫(kù)。
然后在根目錄中找到admin文件夾,修改里面的兩個(gè)文件如下:
Admin/goods.php
Admin/templets/goods_info.html
1.在goods_info.html中添加一段代碼如下:

 * 瘋搶價(jià)小圖標(biāo):

瘋搶
促銷
正常

2.在goods.php中找到約
836行,在里面增加一句:
Goods_icon 和'$_POST[goods_icon]'
然后往下搜索數(shù)據(jù)庫(kù)里的其中一個(gè)字段,比如"is_best",看下分別在哪些位置出現(xiàn),我們相應(yīng)的在那里把新加入的字段加上,應(yīng)該是有831行左右,850行左右,914行左右三處,修改后點(diǎn)擊保存即可。
修改后的代碼參考:處:
{
$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, seo_title, suppliers_id, goods_icon)" .
"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','$_POST[seo_title]', '$suppliers_id', '$_POST[goods_icon]')";
}
第2處:
{
$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_real, " .
"is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral, seo_title, goods_icon)" .
"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', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ".
" '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$code', '$rank_integral','$_POST[seo_title]', '$_POST[goods_icon]')";
}
第3處:
$sql .= "keywords = '$_POST[keywords]', " .
"goods_brief = '$_POST[goods_brief]', " .
"seller_note = '$_POST[seller_note]', " .
"goods_weight = '$goods_weight'," .
"goods_number = '$goods_number', " .
"warn_number = '$warn_number', " .
"integral = '$_POST[integral]', " .
"give_integral = '$give_integral', " .
"rank_integral = '$rank_integral', " .
"seo_title='$_POST[seo_title]'," .
"goods_icon='$_POST[goods_icon]'," .
"is_best = '$is_best', " .
"is_new = '$is_new', " .
"is_hot = '$is_hot', " .
"is_on_sale = '$is_on_sale', " .
"is_alone_sale = '$is_alone_sale', " .
"is_shipping = '$is_shipping', " .
"goods_desc = '$_POST[goods_desc]', " .
"last_update = '". gmtime() ."', ".
"goods_type = '$goods_type' " .
"WHERE goods_id = '$_REQUEST[goods_id]' LIMIT 1";
這時(shí)候我們到后臺(tái)選擇其中一個(gè)商品,進(jìn)行修改,看看數(shù)據(jù)庫(kù)里能否正常接收到值,如果正常,說(shuō)明前面的操作OK。下面是顯示環(huán)節(jié)了,還需要修改include/lib_goods.php 文件,找到 527行和1586行左右,在代碼最開(kāi)始分別增加我們新的變量,參考代碼如下:
處:
$sql = 'SELECT g.goods_icon,g.goods_id,g.cat_id,c.parent_id,g.goods_name, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
第2處:
// 增加瘋搶價(jià)圖標(biāo) 2013-6-26
$goods[$idx]['goods_icon'] ? = $row['goods_icon'];
OK,解決了這里,基本上就是調(diào)用了。在首頁(yè)模板或庫(kù)文件中,可以這樣判斷調(diào)用:

{if $goods.goods_icon eq 'fengqiang'} {/if} {if $goods.goods_icon eq 'chuxiao'} {/if} {if $goods.goods_icon eq 'zhengchang'} {/if} {$goods.shop_price}{$goods.market_price}

本文只是提供代碼實(shí)現(xiàn)參考,樣式需要大家自行處理哦。

版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!

轉(zhuǎn)載請(qǐng)注明: ecshop商品自定義商品促銷圖標(biāo)

標(biāo)簽: ecshop商品  
相關(guān)文章
推薦文章
模板推薦