国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > php开源 > DedeCMS > ecshop批量打印快递单的方法

ecshop批量打印快递单的方法

来源:程序员人生   发布时间:2014-02-02 10:31:36 阅读次数:2363次
在ecshop后台系统中,在订单的详细页面,可以打印快递单,是一些和ecshop订单相关的资料.在配送方式列表中,你可以设置他的打印模板.

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

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

在ecshop后台的order.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;
}
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生