html - Only one product is listing in php email even with multiple products in order -


i created php email send out after order has been placed. i'm not sure doing wrong because if have more 1 different type of product, email send first 1 added. transaction receipts sending authorize.net include of products order, not email. not getting errors , email sending fine.

$to = $email; $subject = 'your example order'; $message = '<img src="'.$logoimage.'">'; $message = ' <html> <head>   <title>example order</title> </head> <body>   <p>thank ordering us!</p>       <p>your order sent , start processing immediately.</p><br><br>       <p>a charge of $'.$total_price.' taken '.$billtoname.'\'s account sent order.       <p>your order contained:</p>       <p> '.$prdqty.' - '.$prdsize.' - '.$prdname.'</p><br><br>       <p>'.  $authorrizeresponsetext.';</p><br><br>       <p>we appreciate business!</p> </body> </html> '; $from = "auto-confirm@example.com"; $cc = "order-receipts@example.com";  // send html mail, content-type header must set $headers  = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n";  // additional headers $headers .= 'to: ' .$to. "\r\n"; $headers .= 'from: ' .$from. "\r\n"; $headers .= 'cc: '.$cc. "\r\n";  // send email mail($to,$subject,$message,$headers); 

the line having issues this...

<p> '.$prdqty.' - '.$prdsize.' - '.$prdname. $post_values.'</p> 

i need include of different products in order , not one. grab products in site same way. output them db , carry them through session throughout site. i'm sending email carrying same session. how variables structured...

 foreach($_session['shopping_cart'] $id => $product) {         $product_id = $product['product_id'];         $prdname =  $products[$product_id]['product_name']; 

is there way can or missing doing?

update: wrote code, including part after

<p>'.  $authorrizeresponsetext.';</p><br><br>       <p>we appreciate business!</p>   $to = $email; $subject = 'your example order'; $message = '<img src="'.$logoimage.'">'; $message = ' <html> <head>   <title>example order</title> </head> <body>   <p>thank ordering us!</p>       <p>your order sent , start processing immediately.</p><br><br>       <p>a charge of $'.$total_price.' taken '.$billtoname.'\'s account sent order.       <p>your order contained:</p><br><ul>';  foreach($_session['shopping_cart'] $id => $product) {         $product_id = $product['product_id'];         $prdname =  $products[$product_id]['product_name'];         $prdprice =  $products[$product_id]['price'];         $prdqty = $product['quantity'];         $prdsize = $product['size']; $message .= '<li>' .$prdqty.' - '.$prdsize.' - '.$prdname.'</li><br>';                                   } $message .= '</ul>'; $message ='        <p>'.  $authorrizeresponsetext.';</p><br><br>       <p>we appreciate business!</p> </body> </html> '; $from = "auto-confirm@example.com"; $cc = "order-receipts@example.com"; 

any ideas on wrong that??

you can include foreach loop between parted $message variable.i don't know db structure , session contains, try this

$message = '<img src="'.$logoimage.'">'; $message .= ' <html> <head>   <title>example order</title> </head> <body>   <p>thank ordering us!</p>       <p>your order sent , start processing immediately.</p><br><br>       <p>a charge of $'.$total_price.' taken '.$billtoname.'\'s account sent order.       <p>your order contained:</p>'; foreach( $_session['shopping_cart'] $product ) {      $product_id = $product['product_id'];      $prdname =  $product[$product_id]['product_name'];      // , on each field need      echo '<p> '.$prdqty.' - '.$prdsize.' - '.$prdname.'</p><br><br>'; }  $message .= '<p>'.  $authorrizeresponsetext.'</p><br><br>       <p>we appreciate business!</p> </body> </html> '; 

don't forget $var = "value" giving value variable, $var .= "add more" adding new value , keep old. if put = again, old value replaced new one.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -