getbase(); $item_name = 'Diamond ring'; $item_number = '1234567890'; $payment_status = 'Paid'; $payment_amount = '2837'; $payment_currency = 'EUR'; $txn_id = '823005681045308HGSX2389NSHGD'; // edit this to test the mail function: $receiver_email = 'info@example.com'; $payer_email = 'info@example.com'; $email = 'info@example.com'; $paypalinvoice = 1223; $dir = '../../server/config/orders.conf.json'; $invoiceid = $invoicer->invoiceid($dir,'get'); $invoicer->invoiceid('set',$invoiceid+1); $sitecurrency = $shop->getsitecurrency('../../server/config/site.conf.json','../../server/config/currencies.conf.json'); $shippingcountry = $sanitizer->sanitize('Germany','encode'); $siteconf = $shop->load_json("../../server/config/shipping.conf.json"); $countryprice = $shop->getcountryprice($siteconf,$shippingcountry); if($countryprice != false) { $country_price = (int)$countryprice; } else { $country_price = 10; // default shipping fee. } // mail to shopowner. $setup = new \security\forms\SecureMail(); $siteconf = $shop->load_json("../../server/config/site.conf.json"); $result = $shop->getasetting($siteconf,'site.email'); if($result["site.email"] != '') { if(strlen($result["site.email"]) > 64) { $email = $shop->decrypt($result["site.email"]); } else { $email = $sanitizer->sanitize($result["site.email"],'email'); } } $siteconf = $shop->load_json("../../server/config/site.conf.json"); $result = $shop->getasetting($siteconf,'site.title'); if($result["site.title"] != '') { if(strlen($result["site.title"]) > 10) { $shopname = $sanitizer->sanitize($result["site.title"],'unicode'); } else { $shopname = 'Webshop owner'; } } $body = "Today, a new order was placed in the webshop and paid. Below are the details of the order." . PHP_EOL . PHP_EOL; $body .= "### ORDER ###" . PHP_EOL; if(isset($email)) { $products = $shop->getproductlist("../../inventory/shop.json"); $productsum_total = 0; $productsum = 0; $c = 1; $product = 1000010; $productqty = 3; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= '
'; for($i=0; $i < $c; $i++) { $j = 0; if(isset($product)) { foreach($products as $key => $value) { if($products[$j][0][1] == $product) { $producttitle = $products[$j][2][1]; $productdesc = $products[$j][3][1]; $productprice = $products[$j][18][1]; if($productprice == null || $productprice == 0 ) { $productprice = 1; } if($productqty == null || $productqty == 0 ) { $productqty = 1; } $productsum = round(($productprice * (int)$productqty),2); $qtyid = 'tscart-'.$j.$product; $body .= '
'; $body .= '
  • '.$producttitle.'
  • '; $body .= '
  • '.$productdesc.'
  • '; $body .= '
  • '.$sitecurrency .' '.$productprice.'
  • '; $body .= '
  • '.$productqty.'
  • '; $body .= '
  • '.$sitecurrency .' '. $productsum.'
  • '; $body .= '
    '; } $j++; } } $body .= '
    '; $body .= '
    '; $body .= '
  • '; $body .= '
  • Country
  • '; $body .= '
  • Subtotal
  • '; $body .= '
  • Shipping & handling
  • '; $body .= '
  • Total
  • '; $body .= '
    '; $body .= '
  • '; $body .= '
  • '; $body .= '
  • '; $body .= str_replace('shipping.','',$shippingcountry); $body .= '
  • '; $body .= '
  • '; $body .= $sitecurrency .' 100 '; $body .= '
  • '; $body .= '
  • '; $body .= $sitecurrency .' 10'; $body .= '
  • '; $body .= '
  • '; $body .= $sitecurrency .' 110'; $body .= '
  • '; $body .= '
    '; } } $body .= '
    '; $body .= ''; $body .= ''; $parameters = array( 'html_mail' => true, 'to' => $email, 'name' => $shopname, 'email' => $email, 'subject' => "A new order was placed in the shop today.", 'body' => $body ); $ordermail = new \security\forms\SecureMail($parameters); $ordermail->sendmail(); // destroy cart session. /* $_SESSION['cart'] = array(); $_SESSION['token'] = null; $_SESSION['messages'] = array(); session_destroy(); */ ?>