给ecshop增进宣布商品时可随机一个初始点击数

2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家

网上有教自界说的有教随机的,我在想何不整合2个一路用呢,新添加商品时,想要随机点击数的,不去填【商品点击数】这项,想要自界说的方填。。


tiansrj59.com




先来说增进宣布商品时可自界说一个初始点击数

打开admin/templates/good_info.htm 在吻合的位置插手:

<tr>
<td class="label">商品点击数:</td>
<td><input type="text" name="click_count" value="{$goods.click_count}" size="20" /></td>
</tr>

接着打开admin/goods.php,找到
setcookie('ECSCP[last_choose]', $catgory_id . '|' . $brand_id, gmtime() + 86400);

在它的上边增进一段PHP代码,留意是上边

/* 宣布商品时自界说初始化点击数 */
if($_POST['click_count'])
{
$db->query("UPDATE".$ecs->table('goods')."SET click_count='$_POST[click_count]' WHERE goods_id='{$goods_id}'");
}

完成!

再来说说 增进宣布商品时随机一个初始点击数

打开admin/goods.php,查找并增进如下标亮几个处所即可。

/* 入库 */
if ($is_insert)
{
$rand = rand(100,500);
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_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, suppliers_id, click_count)" .
"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', '$suppliers_id', '$rand')";
}
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_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral, click_count)" .
"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', '$rand')";
}
}

完成!

http://tiansrjpt85.com
当你把随机和自界说都改好后,2种都可以行使了。

回答:
有点意思