链接 Dokan Woocommerce 电子邮件通知的订单号
Linking the order number for Dokan Woocommerce email notifications
我正在使用 Dokan 和 about up and 运行 但是 Woocommerce 的库存电子邮件模板有几个问题。
在新的订单邮件中,订单号也是link。理想情况下,这将 link 符合他们在 Dokan 中的订单。但是,link 地址指向我(作为管理员)的 wordpress 站点,并指示他们登录 wordpress,显然他们没有凭据。
客户收到有关其订单的各种电子邮件,但订单号文本不包含 link 我网站上的订单。
我们如何才能将正确的 link 添加到这些电子邮件中?我刚学php所以技能很有限
这是管理新订单和客户完成订单的代码:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* @hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<p><?php printf( __( 'You have received an order from %s. The order is as follows:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); ?></p>
<?php
/**
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* @hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<p><?php printf( __( "Hi there. Your recent order on %s has been completed. Your order details are shown below for your reference:", 'woocommerce' ), get_option( 'blogname' ) ); ?></p>
<?php
/**
* @hooked WC_Emails::order_details() Shows the order details table.
* @hooked WC_Structured_Data::generate_order_data() Generates structured data.
* @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
* @since 2.5.0
*/
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::order_meta() Shows order meta data.
*/
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::customer_details() Shows customer details
* @hooked WC_Emails::email_address() Shows email address
*/
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::email_footer() Output the email footer
*/
do_action( 'woocommerce_email_footer', $email );
* @hooked WC_Emails::order_details() Shows the order details table.
* @hooked WC_Structured_Data::generate_order_data() Generates structured data.
* @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
* @since 2.5.0
*/
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::order_meta() Shows order meta data.
*/
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::customer_details() Shows customer details
* @hooked WC_Emails::email_address() Shows email address
*/
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::email_footer() Output the email footer
*/
do_action( 'woocommerce_email_footer', $email );
为管理员或店长下了新订单,这就是订单 link 被 link 编辑到后端订单编辑页面的原因 (仅用于管理员通知).
这个订单号位于emails/email-order-details.php
This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-details.php, see: Template Structure + Overriding Templates via a Theme
如果你想在他们的我的帐户订单视图页面上的客户电子邮件中有一个 link(对于管理员电子邮件通知也是如此),你需要替换这个:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$text_align = is_rtl() ? 'right' : 'left';
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
<?php if ( ! $sent_to_admin ) : ?>
<h2><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></h2>
<?php else : ?>
<h2><a class="link" href="<?php echo esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
<?php endif; ?>
由此:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$text_align = is_rtl() ? 'right' : 'left';
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
<?php if ( ! $sent_to_admin ) : ?>
<h2><a class="link" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ) . get_option( 'woocommerce_myaccount_view_order_endpoint' ) . '/' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a></h2>
<?php else : ?>
<h2><a class="link" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ) . get_option( 'woocommerce_myaccount_view_order_endpoint' ) . '/' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
<?php endif; ?>
Now you will have the order number linked to their corresponding my account / order-view page for all notifications, included the admin email notifications as "New Order"…
与评论相关的更新(对于正确的“供应商”路径,替换为:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$text_align = is_rtl() ? 'right' : 'left';
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
<?php if ( ! $sent_to_admin ) : ?>
<h2><a class="link" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ) . get_option( 'woocommerce_myaccount_view_order_endpoint' ) . '/' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a></h2>
<?php else : ?>
<h2><a class="link" href="<?php echo home_url( '/' ) . 'dashboard/orders/?order_id=' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
<?php endif; ?>
我正在使用 Dokan 和 about up and 运行 但是 Woocommerce 的库存电子邮件模板有几个问题。
在新的订单邮件中,订单号也是link。理想情况下,这将 link 符合他们在 Dokan 中的订单。但是,link 地址指向我(作为管理员)的 wordpress 站点,并指示他们登录 wordpress,显然他们没有凭据。
客户收到有关其订单的各种电子邮件,但订单号文本不包含 link 我网站上的订单。
我们如何才能将正确的 link 添加到这些电子邮件中?我刚学php所以技能很有限
这是管理新订单和客户完成订单的代码:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* @hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<p><?php printf( __( 'You have received an order from %s. The order is as follows:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); ?></p>
<?php
/**
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* @hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<p><?php printf( __( "Hi there. Your recent order on %s has been completed. Your order details are shown below for your reference:", 'woocommerce' ), get_option( 'blogname' ) ); ?></p>
<?php
/**
* @hooked WC_Emails::order_details() Shows the order details table.
* @hooked WC_Structured_Data::generate_order_data() Generates structured data.
* @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
* @since 2.5.0
*/
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::order_meta() Shows order meta data.
*/
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::customer_details() Shows customer details
* @hooked WC_Emails::email_address() Shows email address
*/
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::email_footer() Output the email footer
*/
do_action( 'woocommerce_email_footer', $email );
* @hooked WC_Emails::order_details() Shows the order details table.
* @hooked WC_Structured_Data::generate_order_data() Generates structured data.
* @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
* @since 2.5.0
*/
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::order_meta() Shows order meta data.
*/
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::customer_details() Shows customer details
* @hooked WC_Emails::email_address() Shows email address
*/
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* @hooked WC_Emails::email_footer() Output the email footer
*/
do_action( 'woocommerce_email_footer', $email );
为管理员或店长下了新订单,这就是订单 link 被 link 编辑到后端订单编辑页面的原因 (仅用于管理员通知).
这个订单号位于emails/email-order-details.php
This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-details.php, see: Template Structure + Overriding Templates via a Theme
如果你想在他们的我的帐户订单视图页面上的客户电子邮件中有一个 link(对于管理员电子邮件通知也是如此),你需要替换这个:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$text_align = is_rtl() ? 'right' : 'left';
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
<?php if ( ! $sent_to_admin ) : ?>
<h2><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></h2>
<?php else : ?>
<h2><a class="link" href="<?php echo esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
<?php endif; ?>
由此:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$text_align = is_rtl() ? 'right' : 'left';
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
<?php if ( ! $sent_to_admin ) : ?>
<h2><a class="link" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ) . get_option( 'woocommerce_myaccount_view_order_endpoint' ) . '/' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a></h2>
<?php else : ?>
<h2><a class="link" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ) . get_option( 'woocommerce_myaccount_view_order_endpoint' ) . '/' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
<?php endif; ?>
Now you will have the order number linked to their corresponding my account / order-view page for all notifications, included the admin email notifications as "New Order"…
与评论相关的更新(对于正确的“供应商”路径,替换为:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$text_align = is_rtl() ? 'right' : 'left';
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
<?php if ( ! $sent_to_admin ) : ?>
<h2><a class="link" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ) . get_option( 'woocommerce_myaccount_view_order_endpoint' ) . '/' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a></h2>
<?php else : ?>
<h2><a class="link" href="<?php echo home_url( '/' ) . 'dashboard/orders/?order_id=' . $order->get_order_number(); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
<?php endif; ?>