Skip Navigation

[Resolved] amending/creating template using 3rd party plugin fields

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#1155666

Tell us what you are trying to do?
My website uses woocommerce and YITH Event Tickets plugin to create event tickets as products. I would like to amend/customise the existing single product page and purchased Toolset for that purpose.
When I try to use Toolset, it seems that I have to create a brand new template that may not include the data already collected by YITH tickets. How do I use the existing data and templates that are on the system without having to recreate everything.

Is there any documentation that you are following?
I am using the instruction video for Toolset but it does not explain how to work with data collected by other plugins.

Is there a similar example that we can see?
I want to edit this single product template: hidden link

What is the link to your site?
hidden link

#1156068

Hello,

I assume you are going to display custom fields from other 3rd part plugins(YITH tickets) in Views content template:
https://toolset.com/documentation/user-guides/view-templates/

If those custom fields are standard wordpress custom field, you can use Views shortcode [wpv-post-field] to render them in content template, see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-field
Output a custom field for the current post.

#1156910
Tools_custompost.jpg
Tools_custompost.jpg
Tools_custompostYITH.jpg

Please see attached screenshot with all the ticket data that 3rd party plugin (YITH) has collected for the Product type Event Tickets.

When I try to create a custom post field using Toolset on the WP Admin and try to amend the Product Template on the Front End, I cannot see any of this info as available fields (start date/time/end time, ticket type etc). I am not sure how to create a template if the product data that I need is not available.

How do I access the data that was collected by Yith and add it as fields that I can format?

#1156925

I contacted YITH Tickets plugin for help in accessing their Ticket product fields and this is the code they gave me to get the event date and start /end time for the shop loop.

<?php

add_action( 'wp_enqueue_scripts', 'oceang_enqueue_styles' );
function oceang_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

if ( function_exists( 'YITH_Tickets' ) ) {

function woocommerce_after_shop_loop_item_title_start_date() {

global $product;

if ( $product instanceof WC_Product_Ticket_Event ){

$product_id = $product->get_id();
$date = yith_wecvti_get_date_message( $product_id );

echo "";
echo ( $date[ 'message_start' ] ) . "<br>";
echo ( $date[ 'message_end' ] );
echo "";

}

}

add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item_title_start_date', 5 );

}

?>

This is the Code to access the info about vendor:
1) "By" Vendor/Organiser: This is from the Yith Multivendor Plugin

$vendor = yith_get_vendor( 'current', 'user' );

2) Ticket price range? Is it possible to pull the low-to high

This is just getting the price of the product "$product->get_price()"

3) Category, Tag

$term = get_term_by( 'id', $product_id, 'product_cat' )

$term = get_term_by( 'id', $product_id, 'product_tag' )

Can you please explain how those functions can work with Toolset to create the custom templates?

Thanks

#1157545

No, the custom PHP codes do not help, it is using custom PHP function yith_wecvti_get_date_message() and yith_get_vendor() to retrieve data, they are not standard wordpress functions, I am not sure how do they work, you can search it here:
https://developer.wordpress.org/?s=yith_wecvti_get_date_message
https://developer.wordpress.org/?s=yith_get_vendor
Nothing Found

Since it is a custom PHP codes from other plugins, it is out the range of Toolset support, you can check it with our Toolset contractors:
https://toolset.com/contractors/

For the product's Category and Tag, you can use Views shortcode [wpv-post-taxonomy] to render them in the content template of single product post, for example:
[wpv-post-taxonomy type="product_cat" separator=", " format="link" show="name" order="asc"]
[wpv-post-taxonomy type="product_tag" separator=", " format="link" show="name" order="asc"]

See our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153472
Output the taxonomy for the current post.

#1159093

I was playing around with custom fields and it picked up shortcodes from 3rd party plugins. But I don't know how to access that anymore..please explain again how it is that data collected by 3rd party short codes can be picked up by Toolset.

#1159341

First, Toolset plugins don't collect data from 3rd party short codes.

If there is existed 3rd party short codes created by standard wordpress function:
https://codex.wordpress.org/Function_Reference/add_shortcode
you can put them into your page/post content, content template, and display their values

if the data are standard wordpress post custom fields, you can locate the meta_key (custom field slug) in your website database, table "wp_postmeta", for example:
- create a custom post field "my-field" (single line),
- create a post with field "my-field" value
You will be able to see it in your database table "wp_postmeta"(some website has different table pre-fix "wp_"), the meta key is "wpcf-my-field", you can display the field value using Views shortcode [wpv-post-field], like this:
[wpv-post-field name="wpcf-my-field"]

See the document I mentioned above:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-field

Hope it is clear