kevinzhai
Forum Replies Created
-
Hi Kenil
After you told me your code worked well in your side, I reinstalled the plugin. Now I can switch two different templates. My problem is fixed!Thank you very much for your Help!
Regards!
KevinHi Kenil
Thank you very much for your code!
I tried your code. The print page still uses “print-content.php” template whether I choose the button of “Print Invoice” or “Print Receipt”.
I think the problem with the condition judgment. I found “if( $template_type == ‘receipt’ )” always is false.Regards!
KevinHi Kenil
I test to use condition. I find “if( $template_type == ‘receipt’ )” doesn’t work whether I choose “Print Invoice” or “Print Receipt”. The print page is blank.
Regards!
Kevin
The code is below.if( $template_type == ‘receipt’ ) {
wcdn_get_template_content( ‘print-content.php’, array( ‘order’ => $order, ‘template_type’ => $template_type ) );
}Hi Kenil
Thank you very much for your reply!
I can not print 2 different templates. Maybe I have some things wrong.
Please teach me.
Regards!
KevinMy “print-content11.php” is original. The “print-content.php” just shows order number. They both located in “themes/ample/woocommerce/print-order” dir.
Now I add your code, and the function is below.
function wcdn_content( $order, $template_type ) {
…
…
// Add template
if( $template_type == ‘receipt’ ) { ‘print-content11.php’;}
// Load the template
wcdn_get_template_content( ‘print-content.php’, array( ‘order’ => $order, ‘template_type’ => $template_type ) );
}Hi Kenil
Thank you very much for your reply!In “if( $template_type == ‘receipt’ ) { <add template> }”
For “<add template>” , do I need create a new php file? Does the file locate as same dir with print-content.php?Regards!
Kevin