Open angelsnails opened 4 years ago
Hello, The plugin you referred to is not implementing the languages correctly. I had to do a hack to the plugin file templates -> print-order -> print-content.php to make it work in my site. This is not a general fix, whoever. This relates to plugin version 4.5.5.
Hello, The plugin you referred to is not implementing the languages correctly. I had to do a hack to the plugin file templates -> print-order -> print-content.php to make it work in my site. This is not a general fix, whoever. This relates to plugin version 4.5.5.
@ahsipila
Thank you for your answer. Could you share with me what fixed the problem in your site?
Like I said it is a change into the file print-content.php. I implemented a function to check the language and clean the output. This only works for languages .fi and .en - could be modified, of course.
Here is the fucntion: <?php function ahs_wcdn_clean_print($input) { if( preg_match("/:/", $input) != 1) return $input; $out_array = preg_split('/[\[\]]/',$input); if( get_bloginfo($show='language') == 'fi') { return $out_array[2]; } else { return $out_array[4]; } } ?>
Then this function is used in places where the print-out is formed, like so: ` $product_name = ahs_wcdn_clean_print($product_name); echo apply_filters( 'wcdn_order_item_name', $product_name , $item ); ?>
<?php
if ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">=" ) ) {
if( isset( $item[ 'variation_id' ] ) && $item[ 'variation_id' ] != 0 ) {
$variation = wc_get_product( $item[ 'product_id' ] );
foreach ( $item[ 'item_meta' ] as $key => $value ) {
if( !( 0 === strpos($key, '_' ) ) ) {
$term = get_term_by( 'slug', $value, $key );
$attribute_name = wc_attribute_label( $key, $variation );
if( isset( $term->name ) ) {
echo '<br>'.ahs_wcdn_clean_print($attribute_name).':'.ahs_wcdn_clean_print($term->name);
} else {`
Sorry, that the code does not present itself very well above.
@ahsipila Thank you so much for your answer. I tried using this solution but i cant get it to work. I think i'm doing something wrong. I put the function you provided in print-content.php. But the rest confused me. I found the code that is shown but i dont know where to put these:
_` $product_name = ahs_wcdn_clean_print($product_name); echo apply_filters( 'wcdn_order_item_name', $productname , $item ); ?>
Could you be so kind to help me with this too? Thank you again!
Hi, can you tell me what languages you have on your site? The code needs to be adjusted to these to work.
Hi, can you tell me what languages you have on your site? The code needs to be adjusted to these to work.
@ahsipila Thank you for your time! It's greek and english with the [el] and [en] used for each.
Ok, try this: go to the folder:
woocommerce-delivery-notes->templates->print-order
rename print-order.php to print-orderOLD.php (for backup)
get the modified print-order.php from here:
https://we.tl/t-omOzSXUlxY
If this link does not work, try this one:
https://wetransfer.com/downloads/c1382d6c62211cc5d4ca674bb6cf569220201116203037/1c6d66549c17fe6539585ac11d1cd12720201116203037/c3946c
Test this, let me know if it works.
Regards,
Ps. note that the wetransfer expires on Nov. 23rd
@ahsipila Thank you so much for taking the time and doing this for me. Unfortunately it didnt work.
I was confused though, as the file i downloaded was named "print-content.php" and not "print-order.php" as you explained. I tried it both ways anyway but didn't work :/
Again thank you so much for your trouble!
Yes, sorry, the folder is print-order the file is print-content.php
@ahsipila Unfortunately the tags show up still. Regardless thank you very much for trying to help
Hello, thank you so much for continuing the q-translate x project! The plugin works great and you saved us from a lot of trouble!
I was wondering if you managed to find a way to hide lang tags from the products names in invoices or delivery notes with any invoice plugin. I'm currently using the Print Invoice & Delivery Notes for WooCommerce by Tyche Software.
Again thank you for q translate xt!