ecshop批量打印快递单

在ecshop后台系统中,在订单的详细页面,可以打印快递单,是一些和ecshop订单相关的资料.在配送方式列表中,你可以设置他的打印模板.

首先,修改order_list.htm加上一按扭.

[html]
<input name="print_shopping" type="submit" id="btnSubmit5" value="快速打印快递" disabled="true" onclick="this.form.target = '_blank'" />用来批量打印快递单.
[/html]

在ecshop后台的order.php中加入

[php]
elseif (isset($_POST['print_shopping'])){

$region_array = array();
$region_id = !empty($_CFG['shop_country']) ? $_CFG['shop_country'] . ',' : '';
$region_id .= !empty($_CFG['shop_province']) ? $_CFG['shop_province'] . ',' : '';
$region_id .= !empty($_CFG['shop_city']) ? $_CFG['shop_city'] . ',' : '';
$region_id = substr($region_id, 0, -1);
$region = $db->getAll("SELECT region_id, region_name FROM " . $ecs->table("region") . " WHERE region_id IN ($region_id)");
if (!empty($region))
{
foreach($region as $region_data)
{
$region_array[$region_data['region_id']] = $region_data['region_name'];
}
}
$smarty->assign('shop_name', $_CFG['shop_name']);
$smarty->assign('province', $region_array[$_CFG['shop_province']]);
$smarty->assign('city', $region_array[$_CFG['shop_city']]);
$smarty->assign('shop_address', $_CFG['shop_address']);
$smarty->assign('service_phone',$_CFG['service_phone']);
//以上是系统参数
$order_sn_list = explode(',', $_POST['order_id']);
foreach ($order_sn_list as $order_sn)
{
/* 取得订单信息 */
$order = order_info(0, $order_sn);
$smarty -> assign('order',$order);
$shipping_print = $db->getOne("SELECT shipping_print FROM " . $ecs->table("shipping") . " WHERE shipping_id=" . $order['shipping_id']);
if (!empty($shipping_print))
{
echo $smarty->fetch("str:$shipping_print");
}
else
{
$shipping_code = $db->getOne("SELECT shipping_code FROM " . $ecs->table('shipping') . " WHERE shipping_id=" . $order['shipping_id']);
include_once(ROOT_PATH . 'includes/modules/shipping/' . $shipping_code . '.php');
if (!empty($_LANG['shipping_print']))
{
echo $smarty->fetch("str:$_LANG[shipping_print]");
}
else
{
echo $_LANG['no_print_shipping'];
}
}
}

exit;
}
[/php]

阅读剩余
THE END