fixed address formating in order confirmatio nemail
This commit is contained in:
parent
b2e57f8ff9
commit
6de094c36b
1 changed files with 1 additions and 11 deletions
|
|
@ -69,7 +69,6 @@ module.exports = (pool, query, authMiddleware) => {
|
|||
WHERE oi.order_id = $1
|
||||
`, [order_id]);
|
||||
|
||||
// Generate items HTML table for email
|
||||
const itemsHtml = itemsResult.rows.map(item => `
|
||||
<tr>
|
||||
<td style="padding: 10px; border-bottom: 1px solid #eee;">${item.product_name}</td>
|
||||
|
|
@ -79,20 +78,11 @@ module.exports = (pool, query, authMiddleware) => {
|
|||
</tr>
|
||||
`).join('');
|
||||
|
||||
// Format shipping address for email
|
||||
let shippingAddress = 'No shipping address provided';
|
||||
if (order.shipping_address) {
|
||||
const address = typeof order.shipping_address === 'string' ? order.shipping_address : JSON.parse(order.shipping_address);
|
||||
|
||||
shippingAddress = `
|
||||
${address.name || ''}<br>
|
||||
${address.street || ''}<br>
|
||||
${address.city || ''}, ${address.state || ''} ${address.zip || ''}<br>
|
||||
${address.country || ''}
|
||||
`;
|
||||
shippingAddress = order.shipping_address;
|
||||
}
|
||||
|
||||
// Send order confirmation email
|
||||
await emailService.sendOrderConfirmation({
|
||||
to: order.email,
|
||||
first_name: order.first_name || 'Customer',
|
||||
|
|
|
|||
Loading…
Reference in a new issue