URL link to product attribute - version 2
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from mark.jackson@gpkgroup.com.au on August 7, 2023, 09:31Hi (like the support ticket before this one), I am also trying to add a hyperlink to a text field as a product attribute to a Product in WooCommerce and show that field in my WOOT Table.
The product attribute is to be a hyperlink to a PDF file which is a manual for the product.Here is the content I placed in the WooCommerce Attribute;
<a href="https://www.crosshydraulics.com.au/wp-content/uploads/2022/05/Valves_Mechanical_and_Solenoid_Cartridge_Valves_Delta_Cartridge_Valves_Mechanical_Pressure_Controls_Relief_DE-RVA_DERVA.pdf" target="new">SPEC PDF</a>However the resulting hyperlink in my WOOT table is;
https://www.crosshydraulics.com.au/specsheet/spec-pdf/Results page:
https://www.crosshydraulics.com.au/product/cvm-pc-relief/Another example is the link: https://www.crosshydraulics.com.au/wp-content/uploads/2022/05/Valves_Mechanical_and_Solenoid_Cartridge_Valves_Delta_Cartridge_Valves_Mechanical_Pressure_Controls_Relief_DE-RVA_DERVA.pdf
Changes to: https://www.crosshydraulics.com.au/specsheet/https-www-crosshydraulics-com-au-wp-content-uploads-2022-05-valves_mechanical_and_solenoid_cartridge_valves_delta_cartridge_valves_mechanical_pressure_controls_relief_de-rva_derva-pdf/In the SPEC Column all the links are wrong, how can this be fixed?
Regards
Mark
Hi (like the support ticket before this one), I am also trying to add a hyperlink to a text field as a product attribute to a Product in WooCommerce and show that field in my WOOT Table.
The product attribute is to be a hyperlink to a PDF file which is a manual for the product.
Here is the content I placed in the WooCommerce Attribute;
<a href="https://www.crosshydraulics.com.au/wp-content/uploads/2022/05/Valves_Mechanical_and_Solenoid_Cartridge_Valves_Delta_Cartridge_Valves_Mechanical_Pressure_Controls_Relief_DE-RVA_DERVA.pdf" target="new">SPEC PDF</a>
However the resulting hyperlink in my WOOT table is;
https://www.crosshydraulics.com.au/specsheet/spec-pdf/
Results page:
https://www.crosshydraulics.com.au/product/cvm-pc-relief/
Another example is the link: https://www.crosshydraulics.com.au/wp-content/uploads/2022/05/Valves_Mechanical_and_Solenoid_Cartridge_Valves_Delta_Cartridge_Valves_Mechanical_Pressure_Controls_Relief_DE-RVA_DERVA.pdf
Changes to: https://www.crosshydraulics.com.au/specsheet/https-www-crosshydraulics-com-au-wp-content-uploads-2022-05-valves_mechanical_and_solenoid_cartridge_valves_delta_cartridge_valves_mechanical_pressure_controls_relief_de-rva_derva-pdf/
In the SPEC Column all the links are wrong, how can this be fixed?
Regards
Mark
Quote from Alex Dovlatov on August 7, 2023, 16:18Hello Mark
Its doing in another way:
- Use meta field instead, because product attribute is taxonomy and not text https://share.pluginus.net/image/i20230807171246.png
- install this plugin https://wordpress.org/plugins/woo-bulk-editor/ to set links to docs for your products
- https://share.pluginus.net/image/i20230807171336.png + https://share.pluginus.net/image/i20230807171417.png - its not obligated but will make life more easy - value should be link only, do not use HTML
- next, into functions.php file of the current wp theme add next code
add_action('woot_meta_data_cell', function($value, $meta_data, $post_id, $table_id) { if ($meta_data['meta_key'] === '_my_txt_link'/* AND $table_id === 21*/) { $value = "<a href='{$value}'>SPEC PDF</a>"; } return $value; }, 10, 4);- result will be as you want https://share.pluginus.net/image/i20230807171740.png
_my_txt_link - is just an example, you can name meta key as you want but do not use spaces!
Hello Mark
Its doing in another way:
- Use meta field instead, because product attribute is taxonomy and not text https://share.pluginus.net/image/i20230807171246.png
- install this plugin https://wordpress.org/plugins/woo-bulk-editor/ to set links to docs for your products
- https://share.pluginus.net/image/i20230807171336.png + https://share.pluginus.net/image/i20230807171417.png - its not obligated but will make life more easy - value should be link only, do not use HTML
- next, into functions.php file of the current wp theme add next code
add_action('woot_meta_data_cell', function($value, $meta_data, $post_id, $table_id) { if ($meta_data['meta_key'] === '_my_txt_link'/* AND $table_id === 21*/) { $value ="<a href='{$value}'>SPEC PDF</a>"; } return $value; }, 10, 4); - result will be as you want https://share.pluginus.net/image/i20230807171740.png
_my_txt_link - is just an example, you can name meta key as you want but do not use spaces!
Quote from mark.jackson@gpkgroup.com.au on August 8, 2023, 10:17Hi and thank you for your prompt reply Elisio
I purchased the full version of the Bulk Editor (I hope that helps support you guys for the good work you do).
I did as above and that worked perfectly.There would be two further requests please.
1. How can I make the links open in a new window?
2. Currently on my WOOT table - the column I have setup displays 'SPEC PDF' in each row even if there is no link entered (if no manual link has been added it links to a product URL). Is it possible to show nothing unless an entry has been made?Again, your help is greatly appreciated.
Regards
Mark
Hi and thank you for your prompt reply Elisio
I purchased the full version of the Bulk Editor (I hope that helps support you guys for the good work you do).
I did as above and that worked perfectly.
There would be two further requests please.
1. How can I make the links open in a new window?
2. Currently on my WOOT table - the column I have setup displays 'SPEC PDF' in each row even if there is no link entered (if no manual link has been added it links to a product URL). Is it possible to show nothing unless an entry has been made?
Again, your help is greatly appreciated.
Regards
Mark
Quote from Alex Dovlatov on August 8, 2023, 12:08Hello Mark
Thank you :)
Here is the code:
add_action('woot_meta_data_cell', function ($value, $meta_data, $post_id, $table_id) { if (!empty($value)) { if ($meta_data['meta_key'] === '_my_txt_link'/* AND $table_id === 21 */) { $value = "<a href='{$value}' target='_blank'>SPEC PDF</a>"; } } return $value; }, 10, 4);In new version of the code is going value check, so if field is empty nothing to display, and also to open pdf document in new window into link added attribute _target with its value '_blank'
I hope this version will help you ...
Hello Mark
Thank you :)
Here is the code:
add_action('woot_meta_data_cell', function ($value, $meta_data, $post_id, $table_id) {
if (!empty($value)) {
if ($meta_data['meta_key'] === '_my_txt_link'/* AND $table_id === 21 */) {
$value ="<a href='{$value}' target='_blank'>SPEC PDF</a>";
}
}
return $value;
}, 10, 4);
In new version of the code is going value check, so if field is empty nothing to display, and also to open pdf document in new window into link added attribute _target with its value '_blank'
I hope this version will help you ...