当前位置:编程学习 > html/css >>

ecshop红包指定某些商品不能使用修改步骤

第一步:在goods表格增加一个字段 is_bonus 类型 tinyint 默认为1 (1是可以使用红包)

第二步:修改后台模板页 goods_info.htm

<tr id=”alone_sale_1″>
<td id=”alone_sale_2″>{$lang.lab_is_on_sale}</td>
<td id=”alone_sale_3″><input type=”checkbox” name=”is_on_sale” value=”1″ {if $goods.is_on_sale}checked=”checked”{/if} /> {$lang.on_sale_desc}</td>
</tr>
<tr id=”alone_sale_1″>
<td id=”alone_sale_2″>红包使用</td>
<td id=”alone_sale_3″><input type=”checkbox” name=”is_bonus” value=”1″ {if $goods.is_bonus}checked=”checked”{/if} /> 打勾表示允许用使用红包,否则不允许使用。</td>
</tr>
<tr>
<td>{$lang.lab_is_alone_sale}</td>
<td><input type=”checkbox” name=”is_alone_sale” value=”1″ {if $goods.is_alone_sale}checked=”checked”{/if} /> {$lang.alone_sale}</td>
</tr>
<tr id=”alone_sale_1″>            <td id=”alone_sale_2″>{$lang.lab_is_on_sale}</td>            <td id=”alone_sale_3″><input type=”checkbox” name=”is_on_sale” value=”1″ {if $goods.is_on_sale}checked=”checked”{/if} /> {$lang.on_sale_desc}</td>          </tr>

<tr id=”alone_sale_1″>            <td id=”alone_sale_2″>红包使用</td>            <td id=”alone_sale_3″><input type=”checkbox” name=”is_bonus” value=”1″ {if $goods.is_bonus}checked=”checked”{/if} /> 打勾表示允许用使用红包,否则不允许使用。</td>          </tr>

<tr>            <td>{$lang.lab_is_alone_sale}</td>            <td><input type=”checkbox” name=”is_alone_sale” value=”1″ {if $goods.is_alone_sale}checked=”checked”{/if} /> {$lang.alone_sale}</td>          </tr>

这个大概在230行左右

*注:我没有修改语言包,如果你需要可以先去修改语言包,然后这里调言(呵呵)

第三步:修改后台goods.php文件

在添加新商品 编辑商品 下面修改

158行和230行左右的 $goods数组加下下面红色的部分(我这里默认是可以使用红包的)
$goods = array(

‘goods_id’      => 0,

‘goods_desc’    => ”,

‘cat_id’        => $last_choose[0],

‘brand_id’      => $last_choose[1],

‘is_on_sale’    => ’1′,

‘is_bonus’      => ’1′,

‘is_alone_sale’ => ’1′,

‘is_shipping’ => ’0′,

‘other_cat’     => array(), // 扩展分类

‘goods_type’    => 0,       // 商品类型

‘shop_price’    => 0,

‘promote_price’ => 0,

‘market_price’  => 0,

‘integral’      => 0,

‘goods_number’  => $_CFG['default_storage'],

‘warn_number’   => 1,

‘promote_start_date’ => local_date(‘Y-m-d’),

‘promote_end_date’   => local_date(‘Y-m-d’, local_strtotime(‘+1 month’)),

‘goods_weight’  => 0,

‘give_integral’ => -1,

‘rank_integral’ => -1

);

插入和修改部份修改的代码:

805行

$is_on_sale = isset($_POST['is_on_sale']) ? 1 : 0;

$is_bonus = isset($_POST['is_bonus']) ? 1 : 0;

$is_alone_sale = isset($_POST['is_alone_sale']) ? 1 : 0;

/* 入库 */

if ($is_insert)

{

if ($code == ”)

{

$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_bonus,is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, suppliers_id)” .

“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_bonus’,’$is_alone_sale’, $is_shipping, “.

” ‘$_POST[goods_desc]‘, ‘” . gmtime() . “‘, ‘”. gmtime() .”‘, ‘$goods_type’, ‘$rank_integral’, ‘$suppliers_id’)”;

}

else

{

$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_bonus is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral)” .

“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’,”.

” &lsq

补充:web前端 , HTML/CSS  ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,