Support » Plugin: PeproDev Ultimate Invoice » Translation of labels into portuguese + Customize layout + Disable bar codes
Translation of labels into portuguese + Customize layout + Disable bar codes
-
Good afternoon.
I am developing an e-Commerce and its plugin “Ultimate Invoice” proved to be the most suitable.
1) I am trying to change the labels to Portuguese, without success ;-(
Please, how can I perform this change?2) To meet the needs of this website, I need to make some changes to the layout, if possible by placing the Seller data on the top line, next to the logo. With that I will gain more space on the page and more products will be printed on the same page.
3) I disabled the bar codes option (Invoice no. And Tracking no.), But they still appear on the page. Please, how do I resolve this issue?
Thank you for your attention.
The page I need help with: [log in to see the link]
-
Hello @sidneyts , Hope you’re doing well.
Plugin is fully translatable but invoices’ translation are read from template files. To translate invoices into your own language or edit template files, you should follow steps below:
1- Make a child-theme of your current theme and activate it
2- Copy default folder from wp-content\plugins\pepro-ultimate-invoice\template\default to your child-theme
3- Edit default.cfg file from folder you’ve just copied and change Name and Designer and Version
4- Edit function.php in child-theme and add code below:
// Add customized template to Ultimate Invoice add_filter( "puiw_get_templates_list", function ($templates){ $templates[] = get_stylesheet_directory() . '\default\default.cfg'; return $templates; }, 10, 1);
5- Now go to Ultimate Invoice setting > Theming Section > Change Default Theme to your new theme and Save
At this point, you’ve successfully added a new template to your invoices and you are free to edit this template as much as you need.
Please note that if you need to add Macros in your template .tpl files (like
sku
) you can use hook below:// Add new Macro to Ultimate Invoice templates add_filter( "puiw_get_default_dynamic_params", function ($macros, $order){ $macros["new_macro"] = 'Value Comes Here -- use $order to access WC_Order'; return $macros; }, 10, 2);
For example you need to add Order ID macro as my_order_id which returns Woocommerce Order ID, use code below:
// Add <code>my_order_id</code> as Woocommerce Order ID to Ultimate Invoice templates // You can also pass multiple macros at once (my_second_macro, my_third_macro) add_filter( "puiw_get_default_dynamic_params", function ($macros, $order){ $macros["my_order_id"] = $order->get_id(); $macros["my_second_macro"] = 'my_second_macro'; $macros["my_third_macro"] = 'my_third_macro'; return $macros; }, 10, 2);
If you had any problems or needed more help, please don’t hesitate and let us know.
Yours sincerely,
Amirhossein, CTO at Pepro Dev-
This reply was modified 12 months ago by
Pepro Dev. Group.
-
This reply was modified 12 months ago by
Pepro Dev. Group.
-
This reply was modified 12 months ago by
Pepro Dev. Group.
-
This reply was modified 12 months ago by
Pepro Dev. Group.
Good evening Amirhossein.
Thank you for your attention, and guidance. It’s working.
Please, there are three new issues, and I would like to know if there are solutions.
1) In my list of items, there will be some that the price will be “0.00”. Is it possible to leave the field blank in the “Price” and “Total” cells when the result is “0.00”?
2) What is the class code for “customer notes”?
3) Is there any Solution that when I receive the order, a Whatsapp will be sent to us to let us know about it?
Thank you very much.
Hi @sidneyts ,
——–
1- you can hook intopuiw_printinvoice_create_html_item_row_metas
which is located inpepro-ultimate-invoice\include\admin\class-print.php
and change row item’s meta or values.
——–
2- Classes are defined in template files, look those up inpepro-ultimate-invoice\template
.
——–
3- You can hook into WooCommerce built-in action hooks (woocommerce_checkout_order_processed, woocommerce_new_order) to fire an event when order is received, but for the WhatsApp part, I’m not sure weather WhatsApp has an API for such demands, but don’t give up and search for it.Sincerely yours,
Amirhossein-
This reply was modified 10 months, 3 weeks ago by
Pepro Dev. Group.
Good afternoon Amirhossein.
Thank you for your feedback and attention.
As a good marketing man that I am, and knowledgeable about programming, I managed to make the necessary changes to the layout and translation.
The question of how to leave the unit value and total value cells blank, when they have a “zero” price, I couldn’t do.
I confess that I messed up when I try to manage the “class-print.php” file.
Please, I know I am abusing it, but I would greatly appreciate it if you could send me the complete command that I should put in the “puiw_printinvoice_create_html_item_row_metas” area, to replace the “zero” price by leaving the unit and total value cells blank.
Thank you so much again for your help.
Hugs,
sydney
Hello @sidneyts , Hope you’re well.
I’ve created a sample for you: https://github.com/peprodev/ultimate-invoice/wiki/Filter-Order-Row-item-value
Hope this does the trick,
Let me know if there’s anything else you need help with.Kind regards,
Amirhossein-
This reply was modified 10 months, 3 weeks ago by
Pepro Dev. Group.
It almost worked.
The code left blank all values in the “price” and “total value” cells, regardless of whether the value is zero or non-zero
Sorry dear, code is fixed.
https://github.com/peprodev/ultimate-invoice/wiki/Filter-Order-Row-item-value
I did some tests, changing the expression
if ((float) $ item details [“base price”] <= 0) {
Regardless of changing the value “0” to a higher one, or changing “<= 0” to “>= 0”, the result was always the same, all items in the “price” and “total” cells appear empty.
/** * Filter Pepro Ultimate Invoice Order Row item's value * * @author Amirhosseinhpv ( @amirhosseinhpv ) */ add_filter( "puiw_printinvoice_create_html_item_row_metas", "make_zero_look_empty", 99, 5); /** * output empty string instead of zero with currency when price is empty * * @method make_zero_look_empty * @param array $item_details * @param int $item_id Current item's ID in Order items loop * @param WC_Order_Item $item Current item's instance in Order items loop * @param int $product_id Parent product in Order loop * @param WC_Order $order Current Order instance * @return array modified row data * @version 1.0.0 * @license https://pepro.dev/license Pepro.dev License */ function make_zero_look_empty($item_details, $item_id, $item, $product_id, $order ) { // current item's calculated price if ( $order->get_item_subtotal( $item, false, true ) <= 0 ){ $item_details["base_price"] = ""; $item_details["nettotal"] = ""; $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_price "; } // current item's calculated tax if ( $item->get_subtotal_tax() <= 0 ){ $item_details["tax"] = ""; $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_tax "; } // current item's calculated discount if ( (float) $item_details["discount"] <= 0 ){ $item_details["discount"] = ""; $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_discount "; } return $item_details; }
Yes, yes, yes, its working.
Thank you very, very much.
You saved my day.
I think it’s my the last questions.
I would like to change the layout at the end of the table, where there is “shipping”, “payment method” and “final total”, and I can’t find the file to make these changes.
Please how do I make this change?
Thank you very much.
We used functions to print order totals and added hooks to the output of those functions, so you can modify it. Check below links:
for HTML invoice: https://github.com/peprodev/ultimate-invoice/blob/8115f8c65e1a08a9e1e50bb1d7add4dcf4c7bfc4/include/admin/class-print.php#L1551
Thanks Pepro.
Its works fine. 😉In the case I was seeing with you, about leaving the “price” and “total price” cells empty, if the price value is zero, it’s working perfectly.
In the case of a product that has variations, one of the variations being the price “0”, and the other variation a value greater than “0”, it is possible to present in the “price” cell the value of the largest variation (greater than “0” ), when the cell item “price” is equal to “0”?
Please, can you help me with this last issue?
I really appreciate your help.
Hugs,
sidney
-
This reply was modified 12 months ago by
- The topic ‘Translation of labels into portuguese + Customize layout + Disable bar codes’ is closed to new replies.