我最近安装了(新)OpenCart 1.5.6.1版。
我一直在关注这篇文章中给出的建议:http://forum.opencart.com/viewtopic.php?t=11056关于如何直接将链接添加到要从OpenCart下载的项目。
我更新了order.tpl,现在看起来像这样(下图)。当我创建新订单时,在我添加上面帖子推荐的代码后,订单确认电子邮件根本没有出去。当我使用order.tpl文件的原始版本时,电子邮件没有问题。我是OpenCart和php的新手,所以无法理解为什么这不起作用。任何人都可以给我任何关于我可能需要注意什么才能使其工作的提示?任何帮助表示赞赏。
谢谢!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $title; ?></title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">
<div style="width: 680px;"><a href="<?php echo $store_url; ?>" title="<?php echo $store_name; ?>"><img src="<?php echo $logo; ?>" alt="<?php echo $store_name; ?>" style="margin-bottom: 20px; border: none;" /></a>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
<?php if ($customer_id) { ?>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_link; ?></p>
<p style="margin-top: 0px; margin-bottom: 20px;"><a href="<?php echo $link; ?>"><?php echo $link; ?></a></p>
<?php } ?>
<?php if ($download) { ?>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_download; ?></p>
<p style="margin-top: 0px; margin-bottom: 20px;"><a href="<?php echo $download; ?>"><?php echo $download; ?></a></p>
<?php } ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;" colspan="2"><?php echo $text_order_detail; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><b><?php echo $text_order_id; ?></b> <?php echo $order_id; ?><br />
<b><?php echo $text_date_added; ?></b> <?php echo $date_added; ?><br />
<b><?php echo $text_payment_method; ?></b> <?php echo $payment_method; ?><br />
<?php if ($shipping_method) { ?>
<b><?php echo $text_shipping_method; ?></b> <?php echo $shipping_method; ?>
<?php } ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><b><?php echo $text_email; ?></b> <?php echo $email; ?><br />
<b><?php echo $text_telephone; ?></b> <?php echo $telephone; ?><br />
<b><?php echo $text_ip; ?></b> <?php echo $ip; ?><br /></td>
</tr>
</tbody>
</table>
<?php if ($comment) { ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_instruction; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $comment; ?></td>
</tr>
</tbody>
</table>
<?php } ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_payment_address; ?></td>
<?php if ($shipping_address) { ?>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_shipping_address; ?></td>
<?php } ?>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $payment_address; ?></td>
<?php if ($shipping_address) { ?>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $shipping_address; ?></td>
<?php } ?>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_product; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_model; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;"><?php echo $text_quantity; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;"><?php echo $text_price; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;"><?php echo $text_total; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) { ?>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $product['name']; ?>
<?php foreach ($product['option'] as $option) { ?>
<br />
<small> - <?php echo $option['name']; ?>: <?php echo $option['value']; ?></small>
<?php } ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $product['model']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $product['quantity']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $product['price']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $product['total']; ?></td>
</tr>
<?php } ?>
<?php foreach ($vouchers as $voucher) { ?>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $voucher['description']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;">1</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $voucher['amount']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $voucher['amount']; ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<?php foreach ($totals as $total) { ?>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;" colspan="4"><b><?php echo $total['title']; ?>:</b></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $total['text']; ?></td>
</tr>
<!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
<a href="<?php echo $store_url; ?>index.php?route=account/download/download&order_download_id=<?php echo $download['order_download_id']; ?>"><?php echo $download['name']; ?></a><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
<?php } ?>
</tfoot>
</table>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_footer; ?></p>
</div>
</body>
</html>
这是我根据上述论坛帖子添加的部分:
enter code <!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
<a href="<?php echo $store_url; ?>index.php?route=account/download/download&order_download_id=<?php echo $download['order_download_id']; ?>"><?php echo $download['name']; ?></a><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
<!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
<a href="<?php echo $store_url; ?>index.php?route=account/download/download&order_download_id=<?php echo $download['order_download_id']; ?>"><?php echo $download['name']; ?></a><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
答案 0 :(得分:0)
这就像你能得到它一样简单。
<?php
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
header(‘Content-Type: text/plain’);
header("Content-Disposition: attachment; filename=orderConfirmation.txt");
foreach ($query->rows as $temp) {
echo $temp['order_download_id'];
echo $temp['name'];
}
?>