christer_f
Forum Replies Created
-
Forum: Plugins
In reply to: [Invoices for WooCommerce] Packing slip file has .pdf.html extensionHi Bas,
Yes, works perfectly! I tested in Safari, Firefox and Chrome on OSX.
Thanks!
— christerForum: Plugins
In reply to: [Invoices for WooCommerce] Packing slip file has .pdf.html extensionHi Bas, i’m travelling. Back on Tuesday. Will check and let you know then.
Forum: Plugins
In reply to: [Invoices for WooCommerce] Packing slip file has .pdf.html extensionHi again,
Good news!
In the public function generate in abstract-document.php I inserted ob_clean() at the beginning and ob_end_flush() at the end and things now work also in Safari!(I still get asked if I want to save changes made in the packing slip though, but that’s really a very minor little issue)
— christer
Forum: Plugins
In reply to: [Invoices for WooCommerce] Packing slip file has .pdf.html extensionHi Bas,
I saw you have released a new version 2.9, which I installed.
On OSX. Result:
Chrome : fine
Firefox : fine, BUT – I have set up FF to load downloaded pdf file into Acrobat Pro. The invoice works fine, the packing slip loads fine, but when I try to close the file I get asked if I want to save the changes made to the file. So there is something lurky going on.
Safari: Invoice fine, packing slip same problem as beforeI’ll try to patch with your suggested code and will come back to you
Forum: Plugins
In reply to: [Invoices for WooCommerce] Packing slip file has .pdf.html extensionYes, I also noticed. Adding the exit statement solved THAT problem, but created others (with the invoices)
Forum: Plugins
In reply to: [Invoices for WooCommerce] Packing slip file has .pdf.html extensionHi Bas,
I think I have solved the problem thanks to this answer on stackoverflow:http://stackoverflow.com/questions/4230423/fpdf-ouput-saves-file-with-html-extension
So, apparently the problem does not show up in Firefox, which is maybe why you could not reproduce it.
I debugged your code and could confirm that the call to generate the output around line 195 in abstract-bewpi-document.php had correct parameters (i.e. the $name was correctly set with the extension.pdf), so I assumed the problem was within mpdf. Following the advice in the question on stackoverflow, I added an exit statement right after the call on line 195. And it now works! So please make this change to your code.
Forum: Plugins
In reply to: [Invoices for WooCommerce] Packing slip file has .pdf.html extensionI made a quick video that you can find here: http://tutos.tekomatik.com/pdf-invoice/tutorial.html
This used work all right and seems to be a problem after the last release.
I need to tell you that I use custom templates for the invoice and packing-slip in uploads/woocommerce-pdf-invoices, both having the same name
Forum: Plugins
In reply to: [Boot-Modal] Show page content containing shortcodeHello @albedo0,
Don’t know h2 contact you, but you can mail me at christer@tekomatik.com
CheersForum: Plugins
In reply to: [Invoices for WooCommerce] After Woo update to 3.+ I get a bunch of errorsYou need to update your templates for WC3. The ‘minimal’ template provided with the new version of the plugin has been updated to reflect the changes in WC3, but the ‘micro’ has not (and will break).
Forum: Plugins
In reply to: [WC Fields Factory] woocommerce 3 updateI have also noticed several deprecation notices from this plugin when using WC 3.x (currently 3.0.5)
To follow up: the problem is that the action hook
woocommerce_add_order_item_meta
is deprecated in WC3 and a deprecation notification in the logfile suggests that the hook should be replaced withwoocommerce_new_order_item
.Quick temporary solution : ignore the warning. For more details, continue reading.
If you follow the suggestion in the notification (which I did) and replace the hook (line 160 in class.yith-wapo.frontend.php) Woocommerce will embed the
_wapo_meta_data
parameter inside alegacy_values
array, which will not be picked in the action handlerorder_item_meta
(around line 810 in the same file).A possible solution would be to change the code in this function and look for
yith_wapo_options
insidelegacy
values`. Things would work, and the deprecation notification would go away. However, it seems kind of fragile to depend on data which is marked as legacy; you never know what will happen to it in the future. Hopefully the plugin author will come up with a more long-lived solution.Forum: Plugins
In reply to: [Invoices for WooCommerce] Multilingual InvoiceI use qtranslate-X and it works fine.
In cases where your products have multi-lingual names and meta-data you may need to do some coding in the template files. For example in the packing slip body i replaced the line (which BTW uses a deprecated function):
$order->display_item_meta( $item );
With
$my_locale = explode('_', get_locale())[0]; // Get first part of locale, like fr from fr_FR $my_str = wc_display_item_meta( $item, array('echo' => false)); echo apply_filters('translate_text', $my_str, $my_locale);
Forum: Plugins
In reply to: [Invoices for WooCommerce] Multi language siteWoops! You need to translate the meta_value in the else-part also, by adding one more line. It should be:
// Get attribute data. if ( taxonomy_exists( wc_sanitize_taxonomy_name( $meta['meta_key'] ) ) ) { // Changes by Christer: Make sure product info is translated here $my_locale = explode('_', get_locale())[0]; // ** added $term = get_term_by( 'slug', $meta['meta_value'], wc_sanitize_taxonomy_name( $meta['meta_key'] ) ); $meta['meta_key'] = wc_attribute_label( wc_sanitize_taxonomy_name( $meta['meta_key'] ) ); $meta['meta_key'] = apply_filters('translate_text',$meta['meta_key'], $my_locale) ; // ** added $meta['meta_value'] = isset( $term->name ) ? $term->name : $meta['meta_value']; $meta['meta_value'] = apply_filters('translate_text',$meta['meta_value'], $my_locale) ; // ** added } else { $meta['meta_key'] = apply_filters( 'woocommerce_attribute_label', wc_attribute_label( $meta['meta_key'], $product ), $meta['meta_key'] ); $meta['meta_key'] = apply_filters('translate_text',$meta['meta_key'], $my_locale) ; // ** added $meta['meta_value'] = apply_filters('translate_text',$meta['meta_value'], $my_locale) ; // ** added ...
Joe,
Your question has little to do with this thread. You have access to the order object ($this->order). Then you need to look into the Woocommerce utility functions to extract the information you need from the order object. (BTW that is generally a better approach than using calls to get_post_meta).Actually, I went for the second solution, adding a filter that processes the output from add_my_account_pdf. You can put it in functions.php or make a plugin. The code is:
// Add filter that runs after the filter in the woocommerce-pdf-invoices plugin add_filter( 'woocommerce_my_account_my_orders_actions', 'my_invoice_download_btn', 200, 2 ); function my_invoice_download_btn($actions, $order) { if ( array_key_exists('invoice', $actions)) { $actions['invoice'] = array( 'name' => "Facture", 'url' => $actions['invoice']['url'], ); }; return $actions; }