David Mosterd
Forum Replies Created
-
Forum: Plugins
In reply to: [Print Invoice & Delivery Notes for WooCommerce] Security VulnerabilityI think this should be marked as resolved?
Only when you add an email address to the link you can see the order. @harasse also noted this.
Forum: Plugins
In reply to: [Print Invoice & Delivery Notes for WooCommerce] add Custom FieldWhere do you want to add this field?
When it’s data that is already tied to the order you should have no problem adding this. (I think this is also handled in the FAQ of the plugin).
But say I wanted to add some type of order meta to an invoice:
function my_order_info_fields( $fields, $order ) { $fields[] = array( 'label' => 'City', 'value' => $order->billing_city ); return $fields; } add_filter( 'wcdn_order_info_fields', 'my_order_info_fields', 10, 3 );
This filter can be found in the print-content.php file in the templates/print-order directory. There are a few more actions and filters there that could help you do what you want.
I don’t know what your plugin adds, but I’m sure you should be able to find something in their documentation on how to retrieve the data they are storing.
Do you just want to print the thank you page? Or do you want a link that shows you the invoice if it’s there? Or something else?
This example just uses the print button from the WCDN plugin:
function add_print_button_to_thankyou() { if ( ! function_exists( 'wcdn_navigation' ) ) { return; } wcdn_navigation(); } add_action( 'woocommerce_thankyou', 'add_print_button_to_thankyou' );
However, you can also just link to an invoice:
function add_print_invoice_button_to_thankyou( $order_id ) { $order = new WC_Order( $order_id ); $url = wcdn_get_print_link( $order_id, 'invoice', $order->billing_email ); $button = sprintf( '<a href="%s">Print invoice</a>', $url ); echo $button; } add_action( 'woocommerce_thankyou', 'add_print_invoice_button_to_thankyou' );
Hope it helps, if not let me know ??
PS. for brevity I just made a functional example. You might want to add extra checks like if the order exists and be somewhat sure that it’s valid that you expose this link (it does after all contain an email address)
You probably have found it by now, but to be sure: it’s located in print-content.php in /templates/print-order around line 141.
A good editor like Sublime Text or PHP Storm will let you search that quickly ??
Forum: Plugins
In reply to: [Print Invoice & Delivery Notes for WooCommerce] Order barcode in printIt is sort of out of scope of this plugin. The plugin supplies a couple of hooks that you can use do basically anything you like. Be it a barcode or an image of an elephant ??
Anyhow, maybe I can help. Can you supply:
- The barcode plugin you are using
- Any errors you get (have WP_DEBUG on in wp-config.php?)
- A snippet of the code you are using and in which file this is?
Ok, good to hear.
Just double check: you only need one function to which you can let all 4 order actions point. So, you don’t have to create 4 functions.
Cheers!
I think you only need to call it once, so just call the function on the most early status available that makes sense. I think if you just use on-hold you should be fine for the entire process.
Give it a try ??
You are welcome. Let me know what happens, we might be able to use your input ??
Forum: Plugins
In reply to: [Print Invoice & Delivery Notes for WooCommerce] spanish translationThe file.io link is not working indeed; server is busy or something or file is deleted already.
Let me know if you still need the file, I will try to upload it somewhere else or make a git clone you can download.
Good to hear you are making progress!
Forum: Plugins
In reply to: [Print Invoice & Delivery Notes for WooCommerce] spanish translationHi,
It could reproduce the ES translations not working. What I did was take the .po file and upload it here: https://localise.biz (it’s free for 1 or 2 projects)
Once processed, I could see that this translation was not complete and some translations were invalid. But, the .mo file I generated did work on my installation: I have working Spanish translations now.
We need to figure out how to do this properly with regard to updates and all, but for now you can replace the woocommerce-delivery-notes-es_ES.mo file with a new one in the languages folder.
I have uploaded the .mo file here as well, but this link is only valid a couple of weeks: https://file.io/u6B3Xs
It seems to happen the first time you make a request to get the invoice number. There are several places where this happens, which explains why you could not find a consistent way to trigger it. Though, I’d say generating a printed invoice should always trigger this.
A possible workaround might be to hook into the plugin asap after an order is set to a status that would make sense to send invoices. For example:
function create_invoice_number( $order_id ) { WCDN()->print->get_order_invoice_number( $order_id ); } add_action( 'woocommerce_order_status_completed', 'create_invoice_number', 5 );
If what you say is true; I think it could be good enhancement to make functionality consistent.
Forum: Plugins
In reply to: [Print Invoice & Delivery Notes for WooCommerce] About the print page sizeIn most cases it will scale just fine, so no need to do anything. Are you looking for something special? ??
CSS has some support for print though. If you want some more control on pagesize and know how to add your own CSS, this article might be wordt a read:https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/
I think that is a pretty good solution. Does it work out for you, or does this remove too much?
I had a similar thing. WCDN comes with a few API functions, like:
function my_wcdn_head() { $type = wcdn_get_template_type(); if ( $type == 'delivery-note' ) { // do thing you want on only the delivery note type } } add_action( 'wcdn_head', 'my_wcdn_head' );
That way you can hook into the actions and apply conditional statements based on the type of note.
If the API functions are not helping you, there is also the function WCDN() which gets you the main instance of the plugin, allowing you to anything you want ??
Forum: Plugins
In reply to: [Print Invoice & Delivery Notes for WooCommerce] Shipping Address PositionHi,
You can do this by overriding one of the templates in the plugins directory (/woocommerce-delivery-notes/templates/print-order).
In this case you can copy print-content.php to /your-theme/woocommerce/templates/print-order/print-content.php.
There you can easily modify it to what you require to be. I made a gist that does what you need for example: https://gist.github.com/davidmosterd/26876afb2a98fc1a945e
If you don’t want to change the template, you can also use some custom CSS to solve this.
Let me know if that works out for you ??
Forum: Plugins
In reply to: [Admin Columns] Custom fields not showingHi Helen,
Your setup is correct probably and we do support Pods, but just not when using custom fields on taxonomies. We are working on this though. We can’t give you an eta yet but it’s in scope for 2015.
We are sorry your initial ticket about this was not answered sooner. We received your ticket on Friday evening (local time) and we don’t always work during the weekends. We are looking into this by improving our knowledge-base and see if we can extend our availability.
Have a great day and thanks again for sharing your feedback.