Example #1
0
 function eshop_cron()
 {
     global $wpdb, $eshopoptions, $blog_id;
     if ($eshopoptions['cron_email'] != '') {
         $dtable = $wpdb->prefix . 'eshop_orders';
         $max = $wpdb->get_var("SELECT COUNT(id) FROM {$dtable} WHERE status='Completed' OR status='Waiting'");
         if ($max > 0) {
             $to = $eshopoptions['cron_email'];
             //  your email
             $body = __("You may have some outstanding orders to process\n\nregards\n\nYour eShop plugin", 'eshop');
             $body .= "\n\n" . get_admin_url($blog_id) . '/admin.php?page=eshop-orders.php&action=Completed' . "\n";
             $headers = eshop_from_address();
             $subject = get_bloginfo('name') . __(": outstanding orders");
             wp_mail($to, $subject, $body, $headers);
         }
     }
 }
Example #2
0
            } else {
                $query2 = $wpdb->query("UPDATE {$detailstable} set status='Failed',transid='{$txn_id}' where checkid='{$checked}'");
                do_action('eshop_order_status_updated', $checked, 'Failed');
                $subject .= __("Invalid and Failed Payment", 'eshop');
                $extradetails .= __("Paypal has reported an invalid, and failed payment.", 'eshop');
                if ($_POST['payment_status'] != 'Completed' && isset($_POST['pending_reason'])) {
                    $extradetails .= __("Paypal has reported an invalid, and failed payment. The pending reason for this is", 'eshop') . ' ' . $_POST['pending_reason'];
                }
            }
            $subject .= __(" Ref:", 'eshop') . $txn_id;
            // email to business a complete copy of the notification from paypal to keep!!!!!
            $body = __("An instant payment notification was received", 'eshop') . "\n";
            $body .= "\n" . __('from', 'eshop') . " " . $p->ipn_data['payer_email'] . __(" on ", 'eshop') . date('m/d/Y');
            $body .= __(' at ', 'eshop') . date('g:i A') . "\n\n" . __('Details:', 'eshop') . "\n";
            if ($extradetails != '') {
                $body .= $extradetails . "\n\n";
            }
            foreach ($p->ipn_data as $key => $value) {
                $body .= "\n{$key}: {$value}";
            }
            $body .= "\n\n" . __("Regards, Your friendly automated response.", 'eshop') . "\n\n";
            $headers = eshop_from_address();
            $eshopemailbus = $eshopoptions['business'];
            if (isset($eshopoptions['business_sec']) && $eshopoptions['business_sec'] != '') {
                $eshopemailbus = $eshopoptions['business_sec'];
            }
            $to = apply_filters('eshop_gateway_details_email', array($eshopemailbus));
            wp_mail($to, $subject, $body, $headers);
        }
        break;
}
 function eshop_send_customer_email($checked, $mg_id)
 {
     global $wpdb;
     //runcode - return false to stop the rest from running.
     //checked is reference for db, mg_id is the email template to use
     $runcode = true;
     $runcode = apply_filters('eshop_send_customer_email_replace', $runcode, $checked, $mg_id);
     //this is an email sent to the customer:
     //first extract the order details
     $array = eshop_rtn_order_details($checked);
     $etable = $wpdb->prefix . 'eshop_emails';
     //grab the template
     $thisemail = $wpdb->get_row("SELECT emailSubject,emailContent FROM " . $etable . " WHERE (id='" . $mg_id . "' AND emailUse='1') OR id='1'  order by id DESC limit 1");
     $this_email = stripslashes($thisemail->emailContent);
     // START SUBST
     $csubject = stripslashes($thisemail->emailSubject);
     $this_email = eshop_email_parse($this_email, $array);
     //try and decode various bits
     $this_email = html_entity_decode($this_email, ENT_QUOTES);
     $headers = eshop_from_address();
     if ($runcode == true) {
         wp_mail($array['eemail'], $csubject, $this_email, $headers);
     }
     do_action('eshop_send_customer_email', $csubject, $this_email, $headers, $array);
     //affiliate
     if ($array['affiliate'] != '') {
         // to allow for the removal of shipping vlaue from the order. total is sent by default, shipping can be removed.
         $sale_amt = apply_filters('eShop_aff_order_total', $array['total'], $array['shipping_charge']);
         //for affiliates.
         $affcheck = apply_filters('eShop_aff_order_check', true, $array);
         if ($affcheck == true) {
             do_action('eShop_process_aff_commission', array("id" => $array['affiliate'], "sale_amt" => $sale_amt, "txn_id" => $array['transid'], "buyer_email" => $array['eemail']));
         }
     }
     //this is fired on successful purchase, so might as well have this action here
     do_action('eshop_on_success', $checked);
 }