tueddy

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • tueddy
    Participant

      This is exactly the documentation i was looking for.
      Thanks Olly!

      in reply to: PHP Notice #49400
      tueddy
      Participant

        Hi,

        in frontend ordering the is no PHP notice, only in Dashboard.
        Thanks
        Dirk

        tueddy
        Participant

          Any suggestion how to solve this?
          Thanks!

          in reply to: add order details as attachment (JSON) to email #25020
          tueddy
          Participant

            Hi Olly,

            i managed to attach the order data as json on demand but i’m very unhappy to patch the file “wppizza.send-emails.inc.php” directly.
            Is there a better way to do this via filter/plugin?

            This is my patch:

            Index: wppizza.send-emails.inc.php
            ===================================================================
            --- wppizza.send-emails.inc.php	(revision 9754)
            +++ wppizza.send-emails.inc.php	(working copy)
            @@ -489,6 +489,14 @@
            $order_details=$orderDetails->getOrder();/**all order vars => plaintext**/
            /***********************************************************
            +			Add orderdetails as JSON attachment
            +		***********************************************************/
            +		$txt .= json_encode($orderDetails->getOrder(), JSON_PRETTY_PRINT);
            +		$orderfilename = 'order'.$orderId.'.json';
            +		file_put_contents($orderfilename, $txt);
            +
            +		
            +		/***********************************************************
            [set name and email of the the person that is ordering]
            ***********************************************************/
            /*get order details for html too if required*/
            @@ -547,7 +555,7 @@
            foreach($tpl_recipients as $template_id=>$recipients){
            -			$mail_result=$this->send_email_execute($recipients, $email_markup[$template_id], $template_id, $order_details['customer'], $no_attachments[$template_id]);
            +			$mail_result=$this->send_email_execute($orderfilename, $recipients, $email_markup[$template_id], $template_id, $order_details['customer'], $no_attachments[$template_id]);
            /**only return results for main email sent to shop**/
            if(!empty($recipients['email_shop'])){
            $send_email_result=$mail_result;
            @@ -554,6 +562,11 @@
            }
            }
            +		// delete temp order file
            +//		if (file_exists($orderfilename)) {
            +//          unlink($orderfilename);
            +//		}  
            +		
            return $send_email_result;
            }
            @@ -566,7 +579,7 @@
            *	@customer_in_cc true to cc, false to send separate email
            *
            *********************************************************************************************************************/
            -	function send_email_execute($recipients, $email_markup, $template_id, $customer_data, $omit_attachments=false){
            +	function send_email_execute($orderfilename, $recipients, $email_markup, $template_id, $customer_data, $omit_attachments=false){
            //global $phpmailer;
            static $static=0; $static++;
            /*get plugin options*/
            @@ -689,7 +702,11 @@
            }
            }
            }}
            -
            +     		if(!empty($orderfilename) && is_file($orderfilename)){
            +			  $email_attachments[]=$orderfilename;
            +			}  
            +			
            +			
            /**send as html ? */
            $asHtml=!empty($email_markup['html']) ? true : false;
            

            Thanks
            Dirk

            in reply to: add order details as attachment (JSON) to email #24742
            tueddy
            Participant

              Hi Olly,

              thank’s for always good & fast response!
              So this my feature request: Can you add a filter while adding attachments to mail to intercept and userdefined data to mail? In my case just the $order data?

              something like this (pseudo code for “wppizza.send-emails.inc.php”, line 662 ff):

              /*attachments*/
              if(!$omit_attachments){
              if(!empty($options[‘order’][‘order_email_attachments’])){
              foreach($options[‘order’][‘order_email_attachments’] as $attachment){
              if(!empty($attachment) && is_file($attachment)){
              $email_attachments[]=$attachment;
              }
              }
              }}

              /**allow adding/changing attachments on the fly***/
              $options = apply_filters(‘wppizza_filter_order_email_attachments’, $options , $order, $email_attachments);

              /**send as html ? */
              $asHtml=!empty($email_markup[‘html’]) ? true : false;

              That filter would allow my plugin to add orderdata in a computer-parseable JSON/XML/CSV format..
              Best regards
              Dirk

            Viewing 5 posts - 1 through 5 (of 5 total)