/** * Get other templates (e.g. product attributes) passing attributes and including the file */ function woocommerce_get_template($template_name, $args = array()) { global $woocommerce; if ($args && is_array($args)) { extract($args); } include woocommerce_locate_template($template_name); }
/** * Get other templates (e.g. product attributes) passing attributes and including the file. * * @access public * @param mixed $template_name * @param array $args (default: array()) * @param string $template_path (default: '') * @param string $default_path (default: '') * @return void */ function woocommerce_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { global $woocommerce; if ($args && is_array($args)) { extract($args); } $located = woocommerce_locate_template($template_name, $template_path, $default_path); do_action('woocommerce_before_template_part', $template_name, $template_path, $located, $args); include $located; do_action('woocommerce_after_template_part', $template_name, $template_path, $located, $args); }
function wishlist_completed_order_customer_notification($order_id) { global $woocommerce, $wpdb; $send_msg = get_post_meta($order_id, 'notify_receiver', true); if (!$send_msg || '' == $send_msg || '1' != $send_msg) { return; } $send_msg = get_post_meta($order_id, 'notify_receiver_already', true); if ($send_msg || '1' == $send_msg) { return; } $message = get_post_meta($order_id, 'notify_receiver_message', true); if (!$message || '' == trim($message)) { return; } $message = wpautop($message); $witems = get_post_meta($order_id, 'wishlist_purchased_for', true); if (!$witems || !is_array($witems)) { return; } if (!$woocommerce->woocommerce_email) { $woocommerce->mailer(); } foreach ($witems as $key => $item) { if (!$item['user'] || !$item['wlid'] || !$item['pid']) { continue; } $userdata = get_userdata($item['user']); if (!$userdata || is_wp_error($userdata) || !isset($userdata->data->user_email) && !is_email($userdata->data->user_email)) { continue; } $to = $userdata->data->user_email; global $followup_content, $email_heading, $wishlist_item; $wishlist_item = get_the_title($item['pid']); if ('' != $item['vid']) { $type = ''; $value = ''; $sql = 'select * from ' . $wpdb->postmeta . ' where post_id = ' . $item['vid'] . ' and meta_key like "attribute_%"'; $vals = $wpdb->get_results($sql); if ($vals) { foreach ($vals as $v) { $type = ucfirst(str_replace('attribute_', '', $v->meta_key)); $value = $v->meta_value; break; } } $wishlist_item .= ' – ' . $type . ': ' . $value; } $followup_content = $message; $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $subject = __('Wishlist Item Purchased!', 'ignitewoo-wishlists-pro'); $subject = sprintf(__('[%s] %s', 'ignitewoo-wishlists-pro'), $blogname, $subject); $email_heading = $subject; ob_start(); $template_name = 'emails/wishlist_email_template.php'; $template_path = ''; $default_path = dirname(__FILE__) . '/'; $located = woocommerce_locate_template($template_name, $template_path, $default_path); if ($located) { do_action('woocommerce_before_template_part', $template_name, '', $located); require $located; do_action('woocommerce_after_template_part', $template_name, '', $located); } else { ob_end_clean(); return; } $msg = ob_get_clean(); // Queue additional mail envelope headers $headers = apply_filters('woocommerce_email_headers', '', 'followup_message'); $mailer = $woocommerce->mailer(); $message = $mailer->wrap_message($subject, $msg); $mailer->send($to, $subject, $msg, $headers); //$woocommerce->woocommerce_email->send( $to, $subject, $msg, $headers ); update_post_meta($order_id, 'notify_receiver_already', '1'); } }