• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WC_Emails类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中WC_Emails的典型用法代码示例。如果您正苦于以下问题:PHP WC_Emails类的具体用法?PHP WC_Emails怎么用?PHP WC_Emails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WC_Emails类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($order_id = 0)
 {
     $this->order_id = $order_id;
     $this->order = new WC_Order($this->order_id);
     $wc_emails = new WC_Emails();
     $this->emails = $wc_emails->get_emails();
 }
开发者ID:brutalenemy666,项目名称:wp-utils,代码行数:7,代码来源:class-email-templates.php


示例2: run_email_script

function run_email_script()
{
    // assign email address and order id variables
    if (get_option("wc_email_test_email", false)) {
        $wc_email_test_email = get_option("wc_email_test_email", false);
    } else {
        $wc_email_test_email = get_bloginfo('admin_email');
    }
    if (get_option("wc_email_test_order_id", false) == 'recent') {
        $wc_email_test_order_id = '';
    } else {
        $wc_email_test_order_id = get_option("wc_email_test_order_id", false);
    }
    if (!$wc_email_test_order_id) {
        // get a valid and most recent order_id ( if no order is has been selected )
        global $wpdb;
        $order_id_query = 'SELECT order_id FROM ' . $wpdb->prefix . 'woocommerce_order_items ORDER BY order_item_id DESC LIMIT 1';
        $order_id = $wpdb->get_results($order_id_query);
        if (empty($order_id)) {
            echo "No order within your WooCommerce shop. Please create a test order first to test the emails";
            return;
        } else {
            $wc_email_test_order_id = $order_id[0]->order_id;
        }
    }
    // the email type to send
    $email_class = get_query_var('woocommerce_email_test');
    $for_filter = strtolower(str_replace('WC_Email_', '', $email_class));
    // change email address within order to saved option
    add_filter('woocommerce_email_recipient_' . $for_filter, 'your_email_recipient_filter_function', 10, 2);
    function your_email_recipient_filter_function($recipient, $object)
    {
        global $wc_email_test_email;
        $recipient = $wc_email_test_email;
        return $recipient;
    }
    // change subject link
    add_filter('woocommerce_email_subject_' . $for_filter, 'change_admin_email_subject', 1, 2);
    function change_admin_email_subject($subject, $order)
    {
        global $woocommerce;
        $subject = "TEST EMAIL: " . $subject;
        return $subject;
    }
    if (isset($GLOBALS['wc_advanced_notifications'])) {
        unset($GLOBALS['wc_advanced_notifications']);
    }
    // load the email classs
    $wc_emails = new WC_Emails();
    $emails = $wc_emails->get_emails();
    // select the email we want & send
    $new_email = $emails[$email_class];
    // make sure email isn't sent
    apply_filters('woocommerce_email_enabled_' . $for_filter, false, $new_email->object);
    $new_email->trigger($wc_email_test_order_id);
    // echo the email content for browser
    echo $new_email->style_inline($new_email->get_content());
}
开发者ID:JaneJieYing,项目名称:HiFridays,代码行数:58,代码来源:functions.php


示例3: trigger

 public function trigger($recipient, $subject, $content, $attachment = array())
 {
     /* global $woocommerce; */
     $mail = new WC_Emails();
     $email_heading = get_bloginfo('name');
     ob_start();
     $mail->email_header($email_heading);
     $message = ob_get_clean();
     $message .= $content;
     ob_start();
     $mail->email_footer();
     $message .= ob_get_clean();
     $mail->send($recipient, $subject, $message, "Content-Type: text/html\r\n", $attachment);
 }
开发者ID:baden03,项目名称:access48,代码行数:14,代码来源:WCAM_Email.php


示例4: send_email

 /**
  * Prepares and send the review request mail
  *
  * @since   1.0.0
  * @param   $order_id int the order id
  * @param   $days
  * @param   $items_to_review
  * @param   $stored_items
  * @return  void
  * @author  Alberto Ruggiero
  */
 static function send_email($order_id, $days, $items_to_review = array(), $stored_items = array())
 {
     $list = YWRR_Emails::get_review_list($order_id);
     $wc_email = WC_Emails::instance();
     $email = $wc_email->emails['YWRR_Request_Mail'];
     $email->trigger($order_id, $list, $days);
 }
开发者ID:allyeastman,项目名称:studio-sapphire,代码行数:18,代码来源:class-ywrr-emails.php


示例5: send_test_mail

 /**
  * Send a test mail from option panel
  *
  * @since   1.0.0
  * @return  void
  * @author  Alberto Ruggiero
  */
 public function send_test_mail()
 {
     ob_start();
     $total_products = wp_count_posts('product');
     if (!$total_products->publish) {
         wp_send_json(array('error' => __('In order to send the test email, at least one product has to be published', 'yith-woocommerce-review-reminder')));
     } else {
         $args = array('posts_per_page' => 2, 'orderby' => 'rand', 'post_type' => 'product');
         $random_products = get_posts($args);
         $test_items = array();
         foreach ($random_products as $item) {
             $test_items[$item->ID]['id'] = $item->ID;
             $test_items[$item->ID]['name'] = $item->post_title;
         }
         $days = get_option('ywrr_mail_schedule_day');
         $test_email = $_POST['email'];
         $template = $_POST['template'];
         try {
             $wc_email = WC_Emails::instance();
             $email = $wc_email->emails['YWRR_Request_Mail'];
             $email_result = $email->trigger(0, $test_items, $days, $test_email, $template);
             if (!$email_result) {
                 wp_send_json(array('error' => __('There was an error while sending the email', 'yith-woocommerce-review-reminder')));
             } else {
                 wp_send_json(true);
             }
         } catch (Exception $e) {
             wp_send_json(array('error' => $e->getMessage()));
         }
     }
 }
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:38,代码来源:class-ywrr-ajax.php


示例6: instance

 /**
  * Main WC_Emails Instance.
  *
  * Ensures only one instance of WC_Emails is loaded or can be loaded.
  *
  * @since 2.1
  * @static
  * @return WC_Emails Main instance
  */
 public static function instance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:rahul13bhati,项目名称:woocommerce,代码行数:16,代码来源:class-wc-emails.php


示例7: output

 /**
  * Render the settings for the current section
  *
  * @since 2.0.0
  */
 public function output()
 {
     $settings = $this->get_settings();
     // inject the actual setting value before outputting the fields
     // ::output_fields() uses get_option() but customizations are stored
     // in a single option so this dynamically returns the correct value
     if (isset($_GET['section']) && $_GET['section'] == 'email_options') {
         // email options
         $wc_emails = (array) WC_Emails::instance()->emails;
         foreach (self::$wc_emails_enabled as $filed => $id) {
             $email_enabled = (array) $wc_emails[$filed];
             if ($email_enabled['enabled'] == 'no') {
                 add_filter("pre_option_{$filed}", function () {
                     return 'no';
                 });
             } else {
                 add_filter("pre_option_{$filed}", function () {
                     return 'yes';
                 });
             }
         }
     }
     if (isset($_GET['section']) && $_GET['section'] == 'sms_options') {
     }
     foreach ($this->customizations as $filter => $value) {
         add_filter("pre_option_{$filter}", array($this, 'get_customization'));
     }
     WC_Admin_Settings::output_fields($settings);
 }
开发者ID:GaunYun,项目名称:woocommerce-sendinblue-newsletter-subscription,代码行数:34,代码来源:wc-sendinblue-settings.php


示例8: load

 public function load()
 {
     if (class_exists('WC_Emails')) {
         $wc_emails = WC_Emails::instance();
         $emails = $wc_emails->get_emails();
         if (!empty($emails)) {
             $this->emails = $emails;
         }
     }
 }
开发者ID:BurlesonBrad,项目名称:woocommerce-preview-emails,代码行数:10,代码来源:class-woocommerce-preview-emails.php


示例9: save

 /**
  * Save settings.
  */
 public function save()
 {
     global $current_section;
     if (!$current_section) {
         WC_Admin_Settings::save_fields($this->get_settings());
     } else {
         $wc_emails = WC_Emails::instance();
         if (in_array($current_section, array_map('sanitize_title', array_keys($wc_emails->get_emails())))) {
             foreach ($wc_emails->get_emails() as $email_id => $email) {
                 if ($current_section === sanitize_title($email_id)) {
                     do_action('woocommerce_update_options_' . $this->id . '_' . $email->id);
                 }
             }
         } else {
             do_action('woocommerce_update_options_' . $this->id . '_' . $current_section);
         }
     }
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:21,代码来源:class-wc-settings-emails.php


示例10: send_email

 /**
  * Prepares and send the review request mail
  *
  * @since   1.0.0
  *
  * @param   $order_id int the order id
  * @param   $days
  * @param   $items_to_review
  * @param   $stored_items
  *
  * @return  void
  * @author  Alberto Ruggiero
  */
 public function send_email($order_id, $days, $items_to_review = array(), $stored_items = array())
 {
     if (defined('YWRR_PREMIUM')) {
         if (empty($stored_items)) {
             if (empty($items_to_review)) {
                 $list = YWRR_Emails_Premium()->get_review_list($order_id);
             } else {
                 $list = YWRR_Emails_Premium()->get_review_list_forced($items_to_review, $order_id);
             }
         } else {
             $list = $stored_items;
         }
     } else {
         $list = $this->get_review_list($order_id);
     }
     $wc_email = WC_Emails::instance();
     $email = $wc_email->emails['YWRR_Request_Mail'];
     $email->trigger($order_id, $list, $days);
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:32,代码来源:class-ywrr-emails.php


示例11: unsubscribe_review_request

 /**
  * Handles the unsubscribe form
  *
  * @since   1.0.0
  * @return  void
  * @author  Alberto Ruggiero
  */
 public function unsubscribe_review_request()
 {
     if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
         return;
     }
     if (empty($_POST['action']) || 'unsubscribe_review_request' !== $_POST['action'] || empty($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'unsubscribe_review_request')) {
         return;
     }
     $customer_email = !empty($_POST['account_email']) ? sanitize_email($_POST['account_email']) : '';
     if (empty($customer_email) || !is_email($customer_email)) {
         wc_add_notice(__('Please provide a valid email address.', 'yith-woocommerce-review-reminder'), 'error');
     } elseif ($customer_email !== urldecode(base64_decode($_GET['email']))) {
         wc_add_notice(__('Please retype the email address as provided.', 'yith-woocommerce-review-reminder'), 'error');
     }
     if (wc_notice_count('error') === 0) {
         $wc_email = WC_Emails::instance();
         $email = $wc_email->emails['YWRR_Unsubscribe_Mail'];
         $email->trigger($customer_email);
         wc_add_notice(__('An email has been sent with your request', 'yith-woocommerce-review-reminder'));
         wp_safe_redirect(get_permalink(get_option('ywrr_unsubscribe_page_id')));
         exit;
     }
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:30,代码来源:class-ywrr-form-handler.php


示例12: register_wp_admin_settings

 /**
  * Register WC settings from WP-API to the REST API.
  * @since  2.7.0
  */
 public function register_wp_admin_settings()
 {
     $pages = WC_Admin_Settings::get_settings_pages();
     foreach ($pages as $page) {
         new WC_Register_WP_Admin_Settings($page, 'page');
     }
     $emails = WC_Emails::instance();
     foreach ($emails->get_emails() as $email) {
         new WC_Register_WP_Admin_Settings($email, 'email');
     }
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:15,代码来源:class-wc-api.php


示例13: payment_complete_handler

 /**
  * Sends an email when a partial payment is made
  */
 public function payment_complete_handler($order_id)
 {
     $order = wc_get_order($order_id);
     if ('wc-partial-payment' !== $order->post_status) {
         return;
     }
     $wc_emails = WC_Emails::instance();
     $customer_email = $wc_emails->emails['WC_Email_Customer_Processing_Order'];
     $admin_email = $wc_emails->emails['WC_Email_New_Order'];
     $customer_email->trigger($order);
     $admin_email->trigger($order);
 }
开发者ID:Veraxus,项目名称:wc-deposits-with-variations,代码行数:15,代码来源:class-wc-deposits-order-manager.php


示例14: send

 /**
  * Send an email
  *
  * @param Email $email
  * @param string $recipient
  *
  * @return bool
  */
 public function send(Email $email, $recipient)
 {
     $wc_emails = new \WC_Emails();
     return $wc_emails->send($recipient, $email->get_subject(), $email->get_content());
 }
开发者ID:ChromeOrange,项目名称:license-wp,代码行数:13,代码来源:Manager.php


示例15: addOfferNoteCallback

 public function addOfferNoteCallback()
 {
     if (is_admin() && (defined('DOING_AJAX') || DOING_AJAX)) {
         $post_id = $_POST["targetID"];
         // Get current data for Offer
         $post_data = get_post($post_id);
         // Filter Post Status Label
         $post_status_text = strtolower($post_data->post_status) == 'publish' ? 'Pending' : $post_data->post_status;
         $post_status_text = ucwords(str_replace("-", " ", str_replace("offer", " ", strtolower($post_status_text))));
         $noteSendToBuyer = isset($_POST["noteSendToBuyer"]) && $_POST["noteSendToBuyer"] != '' ? '1' : '';
         $offer_notes = $_POST['noteContent'];
         $current_user = wp_get_current_user();
         // Insert WP comment
         $comment_text = "<span>" . __('Offer Note:', $this->plugin_slug) . "</span>";
         if ($noteSendToBuyer != '1') {
             $comment_text .= "&nbsp;" . __('(admin only)', $this->plugin_slug);
         } else {
             $comment_text .= "&nbsp;" . __('(sent to buyer)', $this->plugin_slug);
         }
         $comment_text .= "<br />" . $offer_notes;
         $data = array('comment_post_ID' => '', 'comment_author' => $current_user->user_login, 'comment_author_email' => $current_user->user_email, 'comment_author_url' => '', 'comment_content' => $comment_text, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => get_current_user_id(), 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_agent' => '', 'comment_date' => date("Y-m-d H:i:s", current_time('timestamp', 0)), 'comment_approved' => 'post-trashed');
         $new_comment_id = wp_insert_comment($data);
         // insert comment meta
         if ($new_comment_id) {
             add_comment_meta($new_comment_id, 'angelleye_woocommerce_offer_id', $post_id, true);
         }
         if ($new_comment_id) {
             if ($noteSendToBuyer == '1') {
                 // Email buyer the offer note (not private admin note)
                 /**
                  * Offer note email template
                  * @since   0.1.0
                  */
                 // set recipient email
                 $recipient = get_post_meta($post_id, 'offer_email', true);
                 $offer_id = $post_id;
                 $offer_uid = get_post_meta($post_id, 'offer_uid', true);
                 $offer_name = get_post_meta($post_id, 'offer_name', true);
                 $offer_email = $recipient;
                 $product_id = get_post_meta($post_id, 'offer_product_id', true);
                 $variant_id = get_post_meta($post_id, 'offer_variation_id', true);
                 $_pf = new WC_Product_Factory();
                 $product = $variant_id ? $_pf->get_product($variant_id) : $_pf->get_product($product_id);
                 // if buyercountered-offer previous then use buyer counter values
                 $is_offer_buyer_countered_status = $post_data->post_status == 'buyercountered-offer' ? true : false;
                 $product_qty = $is_offer_buyer_countered_status ? get_post_meta($post_id, 'offer_buyer_counter_quantity', true) : get_post_meta($post_id, 'offer_quantity', true);
                 $product_price_per = $is_offer_buyer_countered_status ? get_post_meta($post_id, 'offer_buyer_counter_price_per', true) : get_post_meta($post_id, 'offer_price_per', true);
                 $product_total = $product_qty * $product_price_per;
                 $offer_args = array('recipient' => $recipient, 'offer_email' => $offer_email, 'offer_name' => $offer_name, 'offer_id' => $offer_id, 'offer_uid' => $offer_uid, 'product_id' => $product_id, 'product_url' => $product->get_permalink(), 'variant_id' => $variant_id, 'product' => $product, 'product_qty' => $product_qty, 'product_price_per' => $product_price_per, 'product_total' => $product_total, 'offer_notes' => $offer_notes);
                 if ($variant_id) {
                     if ($product->get_sku()) {
                         $identifier = $product->get_sku();
                     } else {
                         $identifier = '#' . $product->variation_id;
                     }
                     $attributes = $product->get_variation_attributes();
                     $extra_data = ' &ndash; ' . implode(', ', $attributes);
                     $offer_args['product_title_formatted'] = sprintf(__('%s &ndash; %s%s', 'woocommerce'), $identifier, $product->get_title(), $extra_data);
                 } else {
                     $offer_args['product_title_formatted'] = $product->get_formatted_name();
                 }
                 // the email we want to send
                 $email_class = 'WC_Offer_Note_Email';
                 // load the WooCommerce Emails
                 $wc_emails = new WC_Emails();
                 $emails = $wc_emails->get_emails();
                 // select the email we want & trigger it to send
                 $new_email = $emails[$email_class];
                 $new_email->recipient = $recipient;
                 // set plugin slug in email class
                 $new_email->plugin_slug = $this->plugin_slug;
                 // define email template/path (html)
                 $new_email->template_html = 'woocommerce-offer-note.php';
                 $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/';
                 // define email template/path (plain)
                 $new_email->template_plain = 'woocommerce-offer-note.php';
                 $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/';
                 $new_email->trigger($offer_args);
             }
             $redirect_url = admin_url('post.php?post=' . $post_id . '&action=edit&noheader=true&message=11');
             echo $redirect_url;
         } else {
             echo 'failed';
         }
         die;
         // this is required to return a proper result
     }
 }
开发者ID:tuvell,项目名称:wordpress-woocommerce-paypal-starter-kit,代码行数:88,代码来源:class-offers-for-woocommerce-admin.php


示例16: _enable_emails

 protected static function _enable_emails()
 {
     self::_disable_emails();
     $emails = WC_Emails::instance();
     add_action('woocommerce_order_status_pending_to_processing_notification', array($emails->emails['WC_Email_Customer_Processing_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_on-hold_notification', array($emails->emails['WC_Email_Customer_Processing_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_completed_notification', array($emails->emails['WC_Email_Customer_Completed_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_processing_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_completed_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_on-hold_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_failed_to_processing_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_failed_to_completed_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_failed_to_on-hold_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
 }
开发者ID:galapas,项目名称:opentickets-community,代码行数:14,代码来源:admin.class.php


示例17: handler_wc_init

	/**
	 * Needed to load email classes in admin to adjust optionsv and add additional hook
	 */
	public function handler_wc_init()
	{
		if( is_admin() ) 
		{
				//	fires wc_email_classes -> handler_wc_email_classes
			$wc_emails = WC_Emails::instance();
			unset( $wc_emails );
		}
	}
开发者ID:qhuit,项目名称:dcosta,代码行数:12,代码来源:class-wc-email-att.php


示例18: invoice_scheduled_orders

 /**
  * Send an invoice for a scheduled order when the post date passes the current date
  */
 public static function invoice_scheduled_orders()
 {
     global $wpdb;
     $mailer = WC_Emails::instance();
     $date = date("Y-m-d H:i:s", current_time('timestamp'));
     $due_orders = $wpdb->get_col($wpdb->prepare("\n\t\t\tSELECT \tposts.ID\n\t\t\tFROM \t{$wpdb->posts} AS posts\n\t\t\tWHERE \tposts.post_type = 'shop_order'\n\t\t\tAND \tposts.post_status = 'wc-scheduled-payment'\n\t\t\tAND \tposts.post_date < %s\n\t\t", $date));
     if ($due_orders) {
         foreach ($due_orders as $due_order) {
             $order = wc_get_order($due_order);
             $order->update_status('pending', __('Scheduled order ready for payment.', 'woocommerce-deposits'));
             $mailer->customer_invoice($order);
         }
     }
 }
开发者ID:Veraxus,项目名称:wc-deposits-with-variations,代码行数:17,代码来源:class-wc-deposits-scheduled-order-manager.php


示例19: new_offer_form_submit


//.........这里部分代码省略.........
                 }
             }
             /**
              * Email Out - admin email notification of new or countered offer
              * @since   0.1.0
              */
             $offer_id = $parent_post_id;
             $offer_name = get_post_meta($parent_post_id, 'offer_name', true);
             $offer_phone = get_post_meta($parent_post_id, 'offer_phone', true);
             $offer_company_name = get_post_meta($parent_post_id, 'offer_company_name', true);
             $offer_email = get_post_meta($parent_post_id, 'offer_email', true);
             $product_id = get_post_meta($parent_post_id, 'offer_product_id', true);
             $variant_id = get_post_meta($parent_post_id, 'offer_variation_id', true);
             $_pf = new WC_Product_Factory();
             $product = $variant_id ? $_pf->get_product($variant_id) : $_pf->get_product($product_id);
             $product_qty = $formData['offer_quantity'];
             $product_price_per = $formData['offer_price_per'];
             $product_total = $formData['offer_amount'];
             $offer_args = array('offer_email' => $offer_email, 'offer_name' => $offer_name, 'offer_phone' => $offer_phone, 'offer_company_name' => $offer_company_name, 'offer_id' => $offer_id, 'product_id' => $product_id, 'product_url' => get_permalink($product_id), 'variant_id' => $variant_id, 'product' => $product, 'product_qty' => $product_qty, 'product_price_per' => $product_price_per, 'product_total' => $product_total, 'offer_notes' => $comments);
             if ($variant_id) {
                 if ($product->get_sku()) {
                     $identifier = $product->get_sku();
                 } else {
                     $identifier = '#' . $product->variation_id;
                 }
                 $attributes = $product->get_variation_attributes();
                 $extra_data = ' &ndash; ' . implode(', ', $attributes);
                 $offer_args['product_title_formatted'] = sprintf(__('%s &ndash; %s%s', 'woocommerce'), $identifier, $product->get_title(), $extra_data);
             } else {
                 if (!empty($product)) {
                     $identifier = $product->get_sku();
                 } else {
                     $identifier = '#' . $product_id;
                 }
                 $offer_args['product_title_formatted'] = sprintf(__('%s &ndash; %s', 'woocommerce'), $identifier, $product->get_title());
             }
             if ($is_counter_offer) {
                 $offer_args['is_counter_offer'] = true;
                 /**
                  * send admin 'New counter offer' email template
                  */
                 // the email we want to send
                 $email_class = 'WC_New_Counter_Offer_Email';
             } else {
                 $offer_args['is_counter_offer'] = false;
                 /**
                  * send admin 'New offer' email template
                  */
                 // the email we want to send
                 $email_class = 'WC_New_Offer_Email';
             }
             // load the WooCommerce Emails
             $wc_emails = new WC_Emails();
             $emails = $wc_emails->get_emails();
             // select the email we want & trigger it to send
             $new_email = $emails[$email_class];
             // set plugin slug in email class
             $new_email->plugin_slug = $this->plugin_slug;
             if ($is_counter_offer) {
                 // define email template/path (html)
                 $new_email->template_html = 'woocommerce-new-counter-offer.php';
                 $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/';
                 // define email template/path (plain)
                 $new_email->template_plain = 'woocommerce-new-counter-offer.php';
                 $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/';
             } else {
                 // define email template/path (html)
                 $new_email->template_html = 'woocommerce-new-offer.php';
                 $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/';
                 // define email template/path (plain)
                 $new_email->template_plain = 'woocommerce-new-offer.php';
                 $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/';
             }
             $new_email->trigger($offer_args);
             /**
              * Send buyer 'offer received' email notification
              */
             // the email we want to send
             $email_class = 'WC_Offer_Received_Email';
             // set recipient
             $recipient = $offer_email;
             $offer_args['recipient'] = $offer_email;
             // select the email we want & trigger it to send
             $new_email = $emails[$email_class];
             $new_email->recipient = $recipient;
             // set plugin slug in email class
             $new_email->plugin_slug = $this->plugin_slug;
             // define email template/path (html)
             $new_email->template_html = 'woocommerce-offer-received.php';
             $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/';
             // define email template/path (plain)
             $new_email->template_plain = 'woocommerce-offer-received.php';
             $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/';
             $new_email->trigger($offer_args);
             // Success
             echo json_encode(array("statusmsg" => 'success'));
             exit;
         }
     }
 }
开发者ID:elarson,项目名称:offers-for-woocommerce,代码行数:101,代码来源:class-offers-for-woocommerce.php


示例20: new_order

 /**
  * Send proforma invoice when order is created with status pending
  * 
  * @access public
  * @param int $order_id
  * @param array $posted
  * @return void
  */
 public function new_order($order_id, $posted)
 {
     if ($this->opt['woo_pdf_send_customer_invoice'] && class_exists('WC_Emails')) {
         $order = new WC_Order($order_id);
         $wc_emails = WC_Emails::instance();
         if (is_object($order) && is_object($wc_emails) && method_exists($wc_emails, 'customer_invoice')) {
             $wc_emails->customer_invoice($order);
         }
     }
 }
开发者ID:ardiqghenatya,项目名称:web4,代码行数:18,代码来源:woocommerce-pdf-invoice.php



注:本文中的WC_Emails类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WC_Geolocation类代码示例发布时间:2022-05-23
下一篇:
PHP WC_Email类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap