关于ecshop增加发布商品时可自定义或者随机一个初始点击数

2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家

ecshop增加发布商品时可自定义或者随机一个初始点击数

效果图:

先来说增加发布商品时可自定义一个初始点击数

打开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')";
       }
   }

完成!

 

当你把随机和自定义都改好后,2种都可以使用了。