• Resolved smipweb

    (@smipweb)


    I have a shop with woocommerce: every product as a producer. So I created a pods for producer.
    Now, I want to show, in each product, the producer’s details.
    The problem is: how to select the producer of the product?
    I mean:
    [pods name=”producer” where=”taxonomy_name.slug = ‘THIS PAGE'”]{@producer_address} <br/>{@producer_name} [/pods]

    where the slug “THIS PAGE” would be the producer. How I can “get” the slug of a specific product?
    Thank you

Viewing 15 replies - 1 through 15 (of 28 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @smipweb

    It’s better to work with our relationship fields!
    https://docs.pods.io/fields/relationship/

    Cheers, Jory

    Thread Starter smipweb

    (@smipweb)

    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.

    Thread Starter smipweb

    (@smipweb)

    I didn’t understand where I find the basic field setting ? https://docs.pods.io/fields/relationship/

    thanks

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter smipweb

    (@smipweb)

    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?

    Thread Starter smipweb

    (@smipweb)

    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.

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter smipweb

    (@smipweb)

    I display in this way:

    [pods name=”produttore” ] [if related_prod] {@producer_address}, {@producer_name}<br/><br/> [else]nothing[/if][/pods]

    Thread Starter smipweb

    (@smipweb)

    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”

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter smipweb

    (@smipweb)

    super thank you! now it’s going, thanks!!!

    Thread Starter smipweb

    (@smipweb)

    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

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter smipweb

    (@smipweb)

    yes: it’s an ecommerce with product. Every product has a producer: so I print the producer name related.

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Pods related specific to the page’ is closed to new replies.