Skip Navigation

[Resolved] Need help establishing a relationship between two different plugin fields

This thread is resolved. Here is a description of the problem and solution.

Problem:

This is what I have setup on the website

1. WooCommerce, where I have created 150 products, so I have a unique Permalink URL and a unique ID for each product.

2. A Portfolio plugin, where I have created 150 custom posts, each post is used to present a WooCommerce product, the custom post has the ability to add HTML code into a text field.

Solution:

I suggest you try these:

https://toolset.com/forums/topic/need-help-establishing-a-relationship-between-two-different-plugin-fields/#post-2295127

Relevant Documentation:

https://toolset.com/course-lesson/displaying-related-posts/#displaying-one-related-item-parent

This support ticket is created 3 years, 11 months 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)

This topic contains 3 replies, has 2 voices.

Last updated by leeG-2 3 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#2294673

I would like to automate a process I am doing manually at the moment.
I know what I want to accomplish but not sure which direction to go but I think Toolset would be a good fit to accomplish what I am trying to achieve.

This is what I have setup on the website

1. WooCommerce, where I have created 150 products, so I have a unique Permalink URL and a unique ID for each product.
2. A Portfolio plugin, where I have created 150 custom posts, each post is used to present a WooCommerce product, the custom post has the ability to add HTML code into a text field.

The Task to Be accomplished
The task is to create a "Buy Now" button in the Portfolio HTML text field, the anchor for the button link is the WooCommerce product permalink and price.

Manual Method to complete the task
Currently I manually copy the Product permalink and paste it into the Portfolio HTML text field wrap it in the button attributes, repeat this for 150 Products/Portfolio Items

Automated Method to complete the task
Dynamically link the "Product ID" to the "Portfolio ID" and pull in the product permalink value and the price into the Portfolio HTML text field and wrap the button around the permalink.

I am certain this can be done but trying to figure out where to start is not as easy as I though so any help you can provide to get me started would be very welcome.

Thank you

Lee

#2295127

Hello,

In your case, I suggest you try these:
1) Setup one-to-many relationship between post types "Product" and "Portfolio"
https://toolset.com/course-lesson/how-to-set-up-post-relationships-in-wordpress/

2) Edit each "Portfolio", connect it with specific "Product" post

3) In single "Portfolio" post, display the related "Product" post information:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-one-related-item-parent

#2297399

Thank you
I have accomplished step 1 and step 2 but step 3 is not so straightforward.
I think for the sake of getting the project completed I will manually add the product URL to the Portfolio pages until I have time to look at this again.
I am also looking at the plugin WP Data Access, it looks like a tool that could open up a lot of possibilities.

I will mark this ticket has resolved

#2297401

My issue is resolved now. Thank you!