ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Get category url within related entries from Playa

January 13, 2011 12:15pm

Subscribe [3]
  • #1 / Jan 13, 2011 12:15pm

    IDF MARKETING

    23 posts

    Hi Folks,

    I have a site where I am trying to pull in related products using Playa, because of my template structure (for clean URL’s and in using the Structure module) I have a template for the single product that loads the correct embed based on URL segments.

    Anyhow, I need to be able to get the category_url within a Playa loop for the specific related products that are been output - my code is below:

    {exp:weblog:entries weblog="simple_content"}
    
    
    <h1>{title}</h1>
    {page_body}
    
    {if related_products}
    <div class="relatedProducts">
    <h3>Related Products</h3>
    
    <p>{related_products}</p>
    
    <p><div class="related-products"><br />
    {product_images limit="1"}<br />
    <a href="http://{path=products/{category_url_title}}{url_title}">{site_url}scripts/timthumb/timthumb.php?src={product_image}&h=130&w=130&zc=1</a><br />
    {/product_images}<br />
    <strong><a href="http://{path=products/{category_url_title}}{url_title}">{title}</a></strong><br />
    </div>    </p>
    
    <p>{/related_products}<br />
    </div>    <br />
    {/if}</p>
    
    <p>{/exp:weblog:entries}

  • #2 / Jan 14, 2011 2:27am

    John Henry Donovan

    12339 posts

    IDF MARKETING,

    Both Structure and Play are third-party add-ons so you will need to use their own support resources to troubleshoot this issue. We troubleshoot ExpressionEngine specifically in these forums.

  • #3 / Jan 14, 2011 5:46am

    IDF MARKETING

    23 posts

    This post can be moved to the third party if need be for anyone elses future reference as the solution was a query as per below.

    {exp:query sql="
    SELECT exp_categories.cat_id AS cat_id,exp_categories.cat_url_title AS cat_url_title
    FROM exp_categories  
    JOIN exp_category_posts
    ON exp_categories.cat_id=exp_category_posts.cat_id
    WHERE
    exp_category_posts.entry_id = {entry_id}"
    }
  • #4 / Jan 14, 2011 9:35am

    Ingmar

    29245 posts

    Thank you, I am going to move this to the CodeShare Corner.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases