Hi @smipweb
It’s better to work with our relationship fields!
https://docs.pods.io/fields/relationship/
Cheers, Jory
Thank you Jory,
it’s not easy for me…I didn’t understand how to make it.
I mean, on the option “connections” “Enable Connections to Post Types”, I selected “product”, that’s it.
So, for each product…Ive to show the information about the producer. With pods I create like a new “Category”, where I put the producers with some fields that I defined in pods.
I didn’t understand where I find the basic field setting ? https://docs.pods.io/fields/relationship/
thanks
Hi @smipweb
You are talking about taxonomies, that is something totally different.
Might be best to view our introduction video to get a better understanding of how Pods (and relationships) work:
https://docs.pods.io/videos/grow-beyond-posts-pages-introduction-pods-framework/
Cheers, Jory
thank you for the video, now it’s more clear, but not 100%.
So, on my pods (producer) I added the relationship related_product. Now, I can add for each producer, which product they are doing.
But, this is really a nightmare: in each product page (classic woocomerce), thanks to pods, I can select the “producer”. I didn’t understand why is not already the relationship.
I mean: in each product, I already selected the producer. You know what I mean?
Ok, I partially solved the problem: I had to add a relation to the product element (I extended the “product” page).
Now, the only problem is: in every product page, I select the producer (the relationship) and it’s fine. The problem is that when I display some details of the producer, it will display the producer selected, but also another producer. It’s like doesn’t overwrite the producer…it’s strange.
Hi @smipweb
No problem, glad you’ve got the relationship field fixed.
The problem is that when I display some details of the producer, it will display the producer selected, but also another producer. It’s like doesn’t overwrite the producer…it’s strange.
How are you currently displaying the producer information? A shortcode? Something else? Please share the code!
Cheers, Jory
I display in this way:
[pods name=”produttore” ] [if related_prod] {@producer_address}, {@producer_name}<br/><br/> [else]nothing[/if][/pods]
One example of printing:
nothing via valgersa 6, antonio prod
campagna 6, Cristina frutta
via giovanni 7, Govanni
When it should display, in this case, just the second line “campagna 6, Cristina frutta”
Hello @smipweb
Sorry for my late reply, please view the introduction video again since you do not fully grasp how it works yet,
With this shortcode: [pods name=”produttore” ]
you are fetching ALL produttore CPT’s, not just the related ones.
You should do something like [pods field="related_prod"]
to fetch all relationships.
Cheers, Jory
super thank you! now it’s going, thanks!!!
Hello,
Ive now another small problem:
[pods field=”producer”] <b>{@producer_name}</b>
[/pods]
So, I print just the producer name on each product page. And it’s working good, except for one producer: in this case, his name is printed 3 times!
I didn’t understand why. Do you know how can I force to print just once?
Thank you
Hi @smipweb
No idea why this is happening, is the same name used in multiple posts?
I’ll need some more info to better understand where this might be coming from.
Cheers, Jory
yes: it’s an ecommerce with product. Every product has a producer: so I print the producer name related.
Hi @smipweb
Ah check, so you loop through products and then loop through all producers?
If so, you can’t really add more checks in there as our template tags do not support variables to verify.
If you need more flexibility then you’ll have to go the PHP route!
Cheers, Jory