Retrieve data from cart and send using mail

后端 未结 2 1760
醉酒成梦
醉酒成梦 2021-01-27 12:10

This project is with E-Commerce. There is option to Add to Cart. When user click on add, product will be added to his cart as well and working fine.

2条回答
  •  情歌与酒
    2021-01-27 13:00

    For view cart and receive it as mail use this...

    In mail use this code...

    $tpl_file = 'cartmail.php';
    if (!file_exists($tpl_file)) {
    die('Mail could not be sent');
    exit;
    }
    $msg_tmpl = file_get_contents($tpl_file);
    $to = 'mail@gmail.com';
    $subject = 'Enquiry from ' .$_REQUEST['guest_name'];
    $message = $msg_tmpl;
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
    $headers .= 'From: '.$_REQUEST['email'];
    mail($to, $subject, $message, $headers);
    

    And in the cartmail.php file use this code

    query("SELECT product_name,product_desc, price FROM products WHERE product_code='$product_code' LIMIT 1"); $obj = $results->fetch_object(); ?>
        Product Price Quantity Total
    product_name; ?> price;?>
    price*$cart_itm["qty"]; echo $ptotal; ?> ×';?>

提交回复
热议问题