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);
 }
예제 #2
0
 } elseif ($p->ipn_data['payment_status'] == ' Refunded') {
     do_action('eshop_order_status_updated', $checked, 'Failed');
     $subject .= __("Refunded Payment", 'eshop');
     $ok = 'no';
     $extradetails .= __("You have received a refund notification, eShop doesn't know how to handle these, but details of the notification are included below.", 'eshop');
 } else {
     $query2 = $wpdb->query("UPDATE {$detailstable} set status='Failed',transid='{$txn_id}' where checkid='{$checked}'");
     $subject .= __("A Failed Payment", 'eshop');
     $ok = 'no';
     $extradetails .= __("The transaction was not completed successfully. eShop could not validate the order.", 'eshop');
     if ($p->ipn_data['payment_status'] != 'Completed' && isset($p->ipn_data['pending_reason'])) {
         $extradetails .= __("The transaction was not completed successfully at Paypal. The pending reason for this is", 'eshop') . ' ' . $_POST['pending_reason'];
     }
 }
 $subject .= " Ref:" . $txn_id;
 $array = eshop_rtn_order_details($checked);
 // 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 (isset($array['dbid'])) {
     $body .= get_option('siteurl') . '/wp-admin/admin.php?page=eshop-orders.php&view=' . $array['dbid'] . "&eshop\n";
 }
 //debug
 //$body .= 'checked:'.$checked."\n".$p->ipn_data['business'].$p->ipn_data['custom'].$p->ipn_data['payer_email'].$chkamt."\n";
 if ($extradetails != '') {
     $body .= $extradetails . "\n\n";
 }
 foreach ($p->ipn_data as $key => $value) {
     $body .= "\n{$key}: {$value}";
 }
예제 #3
0
			</tr>';
            }
            echo '</table></div>';
            echo '<div class="updated fade"><p>' . __('Invoice Generate successfully.', 'eshop') . '</p></div>';
        } else {
            echo '<div class="error fade"><p>' . __('No Order were selected.', 'eshop') . '</p></div>';
        }
    }
    //end invoice
    //update ship id
    if (isset($_POST['shippingid']) && isset($_POST['shipsub'])) {
        if (isset($_POST['move']) && $_POST['move'][0] != '') {
            foreach ($_POST['move'] as $v => $ch) {
                $shipid = $_POST['shipping'][$ch];
                $query3 = $wpdb->get_results("UPDATE {$dtable} set shipid='{$shipid}' where checkid='{$ch}'");
                $arraydetail = eshop_rtn_order_details($ch);
            }
            echo '<div class="updated fade"><p>' . __('Shipping id changed successfully.', 'eshop') . '</p></div>';
        } else {
            echo '<div class="error fade"><p>' . __('No Order were selected.', 'eshop') . '</p></div>';
        }
    }
    //end update ship id
    //sent email
    if (isset($_POST['sentemail']) && isset($_POST['emailsub'])) {
        if (isset($_POST['move']) && $_POST['move'][0] != '') {
            foreach ($_POST['move'] as $v => $ch) {
                $mg_id = 3;
                eshop_send_customer_email($ch, $mg_id);
            }
            echo '<div class="updated fade"><p>' . __('Sentemail successfully.', 'eshop') . '</p></div>';