将ecshop三级下拉放后台程序

2009-08-14 13:15 来源:www.chinab4c.com 作者:ecshop专家

     ecshop三级下拉移植到网站的后台,其实是不容易的。包括很多脚本,很多调用。在privilege.php中增加管理员基本信息增加区域选择。

      首先。在privilege.php中编辑管理员程序的页面增加。以下代码。

        $sql = "SELECT phone,country,province, city, district,user_category,tel,address,real_name,end_way,card_num,sale_card, disacount*100 as disacount,user_id, user_name,user_group, email, password, agency_id FROM " .$ecs->table('bussine_user').
           " WHERE user_id = '".$_REQUEST['id']."'";
    $user_info = $db->getRow($sql);
    $smarty->assign('country_list',       get_regions());
    $smarty->assign('shop_province_list', get_regions(1, $_CFG['shop_country']));
    $province_list = get_regions(1, $user_info['country']);
    $city_list     = get_regions(2, $user_info['province']);
    $district_list = get_regions(3, $user_info['city']);

   $smarty->assign('user',        $user_info);
   $smarty->assign('province_list',    $province_list);
 $smarty->assign('city_list',        $city_list);
 $smarty->assign('district_list',    $district_list);

   在privilege_info.htm中,增加以下代码。

    <select name="country" id="selCountries_1" onchange="region.changed(this, 1, 'selProvinces_1')">
       <option value="0">请选择国家</option>
       <!-- {foreach from=$country_list item=country} -->
       <option value="{$country.region_id}" {if $country.region_id eq $user.country}selected{/if}>{$country.region_name}</option>
       <!-- {/foreach} -->
       </select>
       <select name="province" id="selProvinces_1" onchange="region.changed(this, 2, 'selCities_1')">
       <option value="0">请选择省份</option>
       <!-- {foreach from=$province_list item=province} -->
       <option value="{$province.region_id}" {if $province.region_id eq $user.province}selected{/if}>{$province.region_name}</option>
       <!-- {/foreach} -->
       </select>
       <select name="city" id="selCities_1" onchange="region.changed(this, 3, 'selDistricts_1')">
       <option value="0">请选择城市</option>
       <!-- {foreach from=$city_list item=city} -->
       <option value="{$city.region_id}" {if $city.region_id eq $user.city}selected{/if}>{$city.region_name}</option>
       <!-- {/foreach} -->
       </select>
       <select name="district" id="selDistricts_1" {if !$district_list}style="display:none"{/if}>
       <option value="0">请选择地区</option>
       <!-- {foreach from=$district_list item=district} -->
       <option value="{$district.region_id}" {if $district.region_id eq $user.district}selected{/if}>{$district.region_name}</option>
       <!-- {/foreach} -->
       </select>

    {insert_scripts files="../js/transport.js,../js/region.js"}

    最重要的是需要增加region.isAdmin = true;var action = "{$action}";在js中。这样就可以顺利的把ecshop三级下拉移植到后台使用了。

    相关文章:

   如何删除ecshop测试数据

   修改ecshop底部信息

   ecshop首页调用最新评论并且显示产品图片

    来源:中国B4C电子商务