Custom pdf only for specific product

WooCommerce
20 November, 2021 06:20:38
itautomation
Topics: 4
Messages: 10
Dear e2pdf support,

we are currently setting up an online shop with WooCommerce and require generating a pdf for each product X that is configured in our shop.

In other words, not for each ordered cart, but for each time s/o orders the product X, this pdf needs to be generated. It should only be available for us, not the customer (this pdf is used for production), and it requires listing the configuration parameters of product X (like color, wood type, ...). Is this use case in general possible?

We are also looking forward to the WooCommerce documentation, and currently having a hard time to get started. Is there any pre-published documentation already available, or an ETA of when you are going to release the docu?
Or, would it be possible to share basic codes already on how to access configuration parameters of a certain product in the e2pdf template?

Thanks a lot for your help, and this great product (which we used with FormidableForms already successfully in the past)!

Best Regards
Sören
20 November, 2021 08:52:55
E2Pdf
Support
Topics: 7
Messages: 2366
Hi,

We are sorry for inconvenience with documentation, we are working on it however due the complex of WooCoomerce and a lot of information which can be pulled from, it's taking a bit more time than we expected. We hope that we finally release it till the end of this year. Currently most of available shortcodes located under "Visual Mapper" or as example under "Auto PDF". if E2Pdf Template Connected to "Products" / "Variations" - "Visual Mapper" has 13 sections (Screenshot 1), if E2Pdf Template connected to "Orders" it will be almost similar but a bit with other shortcodes and its structure as same information must be retrieved with different ways in "Product" or "Order" context:

Product - Static data of Product
Product Common - Static data of Product
Product Attributes - Attributes of Product
Product Special Shortcodes - Data which can be pulled via complex "foreach" shortcode it iterate over product item meta data or all attributes (unfortunately it's also not yet documented as it's still under "beta").
Product Meta Keys - Meta Keys of the Product
Product Taxonomy - Taxonomies of the Product
Order Product - Data of purchased Product, usually it contains some dynamic data like custom fields, etc.
Order Product Item Meta Keys - Meta Data of Purchased Product, usually it contains some dynamic data like custom fields, etc.
Order - Data of the Order (if product purchased)
Order Special Shortcodes - Data which can be pulled via complex "foreach" shortcode it iterate over order item meta
Order Meta Keys - Meta Keys of Order
Order Taxonomy - Taxonomies of Order
Order Item Meta Keys - Product item meta keys

So depending on how you are using configuration parameters it will depend which shortcodes to use. If it's attributes - you will need to look into "Product Attributes" section. If you are using addon fields - you will need to use "Order Product Item Meta Keys" section.

As about functionality, the process will look like this, correct us if we are wrong:
User purchase some Product X -> You must be able to generate PDF connected to this Order and to the Product X which parameters were checked by user.

If so, unfortunately this functionality works only partially for your needs:

1. You can connect E2Pdf Template to "Products" / "Variations" and:
- Currently shortcodes can be used as "File Download URL" under "Product" - but it will not fit your needs as you mention that only administrators must have access to generated PDF.
- It's possible to use shortcode [e2pdf-attachment id="1" dataset="32"], where 1 is the ID of E2Pdf Template connected to "Products" and "32" is the Product ID. In this case E2Pdf will send PDF as attachment to administrators (depending on in which "Email Additional Content" shortcode will be added) but only if it will be purchased product with ID: 32. (Screenshot 2). It will slow down a bit the process of submission order as PDF must be sent on "Order" submission step.

As we see you must be able to export data via "E2Pdf" -> "Export" with selecting "E2Pdf Template" -> "Product" and "Order" however currently E2Pdf can export only for "Product" data but without "Order" information. We are working on extending this functionality to be able to choose also from which order it must added order item meta data information...

OR

2. You can connect E2Pdf Template to "Orders" and in this case you will be able to export data via "E2Pdf" -> "Export" for specified product, however in this case you will need to use some specified shortcodes inside E2Pdf Template to get exact product data from "Order Product Item Meta Keys" or if it's attribute from "Product Attributes" section but with difference:

By default it will be generated shortcodes from "Visual Mapper" as:
[e2pdf-wc-product key="_product_id" order_item_meta="true" index="0"]

[e2pdf-wc-product key="get_attribute" attribute="custom-attribute" show="value" index="0"]

You will need to modify it as:
[e2pdf-wc-product key="_product_id" order_item_meta="true" id="32"]

[e2pdf-wc-product key="get_attribute" attribute="custom-attribute" show="value" id="32"]

* replace index="0" with id="32". It will output information for Product with ID "32" as by default "index" is the "index" product added to order but you need to get information from exact product id. Attributes will be showing always but "order_item_meta" will be showed only if Product with ID 32 purchased with current "Order" for which you are trying to export PDF.

P.S. To use 2nd option you will need also to update plugin to latest RC version 1.17.05 as by default "Order Product Item Meta Keys" shortcodes not added to current stable version: https://e2pdf.com/support/desk/how-to-update-plugin-to-rc-release-candidate-version-from-e2pdf-com.

It looks a bit complicated however we will do our best to explain all possible combinations in our documentation soon.

We remain at your service.
If you appreciate our support , we would really appreciate your feedback at WordPress.org!
20 November, 2021 14:07:23
itautomation
Topics: 4
Messages: 10
Thanks a lot for your fast and detailed response! Really appreciate it.

We will review and test out the approaches you mentioned, and in case of question come back to you on this thread.

Looking forward to the docu already :-)
23 November, 2021 06:49:51
itautomation
Topics: 4
Messages: 10
Dear e2pdf support team,

thanks again for the information so far.

We could successfully insert configuration items from a Formidable-Form-based product order in WooCommerce to our pdf form by using "order item meta keys". However, configuration fields, where images can be selected, are not properly displayed in the pdf form. Instead html code is shown (<div class="frm_has_image_options"><span class="frm_show_images frm_image_option_cpntainer ...). Is there any possibility to only show the associated value instead of trying to display the image?

Furthermore we have selectable items in our configuration form. Now we want to only display items, that have been selected. With formidable form extension we solved this by using [if 602 like="..."]....[/if 602] where 602 is an ID. Is there a similar solution for woocommerce extension?

Thanks a lot again!

Best Regards
Sören
23 November, 2021 09:27:48
E2Pdf
Support
Topics: 7
Messages: 2366
Hi,

Unfortunately Formidable Forms syntax not yet available under WooCommerce "Products", however we have this point of integration in our TODO list. Such integration was already done for Gravity Forms but due the more complex structure of Formidable Forms plugin we have delay in implementation for Formidable Forms.

So to show only "Value" you can try to use shortcode wrapper with "strip_tags" and "trim" filter to have only value without image (If it's present in HTML code):

[e2pdf-format-output filter="strip_tags,trim"][e2pdf-wc-product key="Images" order_item_meta="true"][/e2pdf-format-output]

As about "if" conditions unfortunately there is no yet globally implemented inline conditional logic, however can you please add some screenshots of "Value" of the "HTML" object which you setup? Maybe we will be able to offer some other solution, until the full integration of Formidable Forms + WooCommerce will be implemented.

We remain at your service.
If you appreciate our support , we would really appreciate your feedback at WordPress.org!
24 November, 2021 13:39:10
itautomation
Topics: 4
Messages: 10
Dear e2pdf support team,

the first part worked already, great!

For the "if" conditions: Find attached a screenshot of such an exemplary value. Does any other solution come to your mind to only display those items, that have been selected?
If not, is there any rough ETA for the globally implemented inline conditional logic?

Thanks a lot again!

Best Regards
Sören
25 November, 2021 01:03:51
E2Pdf
Support
Topics: 7
Messages: 2366
Hi,

You can try to use some of following solutions:

1. If you need to print all selected options you can create "HTML" object, set "Disable WYSIWYG Editor" and use shortcode inside (Screenshot 1) as:

[e2pdf-foreach shortcode="e2pdf-wc-product" key="get_formatted_meta_data" index="0"][e2pdf-wc-product key="get_formatted_meta_data" index="0" path="[e2pdf-foreach-key].display_key"]: [e2pdf-format-output filter="replace,strip_tags,trim" search="<\/li><li>" replace=", "][e2pdf-wc-product key="get_formatted_meta_data" index="0" path="[e2pdf-foreach-key].display_value"][/e2pdf-format-output]<br>
[/e2pdf-foreach]


It will iterate over all product item meta and will output it as Key: Value.

2. You can try to create "HTML" object and "Merge" value dynamically. Screenshot 2.

In example:
1st action: If [e2pdf-wc-product key="Schwenktisch - 40 x 22 cm" order_item_meta="true" index="0"] is not empty then we add to block "Value": Some value: [e2pdf-wc-product key="Schwenktisch - 40 x 22 cm" order_item_meta="true" index="0"]<br>

2nd action: If [e2pdf-wc-product key="Other Key" order_item_meta="true" index="0"] is not empty then we add to block "Value": Some other value: [e2pdf-wc-product key="Other Key" order_item_meta="true" index="0"]<br>

So it will dynamically generate final value by "merging" it.

3. You can try to use "Hide" and "Change" position action if you do not have a lot of properties to output. Screenshot 3, 4, 5.
For this you need to create elements on needed positions and:

For 1st block:
- check if it's "Empty" and "Hide" if Yes.

For 2nd block:
- check if it's "Empty" and "Hide" if Yes.
- check if 1st block is "Empty" and change "Top" position to the value of 1st block "height" + space below.

For 3rd block:
- check if it's "Empty" and "Hide" if Yes.
- check if 1st block is "Empty" and change "Top" position to the value of 1st block "height" + space below.
- check if 2nd block is "Empty" and change "Top" position to the value of 2nd block "height" + space below.

For 4th block:
- check if it's "Empty" and "Hide" if Yes.
- check if 1st block is "Empty" and change "Top" position to the value of 1st block "height" + space below.
- check if 2nd block is "Empty" and change "Top" position to the value of 2nd block "height" + space below.
- check if 3rd block is "Empty" and change "Top" position to the value of 3rd block "height" + space below.

Unfortunately there is no yet ETA when global inline "if" conditionals logic will be released but it's approximately expected in 1st quarter of 2022.

Let us know please if any of this solutions can work for you. If not, let us know please a bit more information about expected output and the logic which must be done.

We remain at your service.
If you appreciate our support , we would really appreciate your feedback at WordPress.org!