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.

Faulty conditional or other problem?

January 16, 2012 5:08pm

Subscribe [2]
  • #1 / Jan 16, 2012 5:08pm

    Linda A

    666 posts

    I am having an issue that I haven’t been able to pin down the culprit for. I am using Hop Studios Amazon plugin for a small “store” and the problem is that even products designated as UK products are coming out linked to Amazon.com. I think I have ruled out the plugin as a source of error, which leaves my if-statements or possibly some change in the API.

    The code below is what I am using. It checks to see if the 39_amazon_locale field is set to US or not. If it is, it fills out the appropriate region for the plugin. If not, it sets up the region for co.uk instead.

    Is the problem in my conditionals? I tried skipping the if:else and just doing one test for US and one for UK and that didn’t work either.

    <ul>
    {exp:weblog:entries weblog="weblog39" limit="10" orderby="date" category="249"}
    <li>
    <div class="StoreIndexItem">
    {if 39_amazon_locale == "us"}
    {exp:aws_products:search item_id="{39_amazon_asin}" region="com" associate_id="{39_amazon_id}" public_key="XXX" private_key="XXX"}
    {if:else}
    {exp:aws_products:search item_id="{39_amazon_asin}" region="co.uk" associate_id="{39_amazon_id}" public_key="XXX" private_key="XXX"}
    {/if}
    <div class="StoreIndexImage"><a href="http://{amazon_link}">{img_medium}</a></div>
    <div class="StoreIndexText">
    {title}
    
    
    {39_seller}
    </div>
    </div>
    {/exp:aws_products:search}
    </li>
    {/exp:weblog:entries}
    </ul>
  • #2 / Jan 18, 2012 12:12pm

    e-man

    1816 posts

    Could because your opening loop is inside a complex conditional, which is parsed later.
    Could you try this and see if that helps:

    <ul>
    {exp:weblog:entries weblog="weblog39" limit="10" orderby="date" category="249"}
    <li>
    <div class="StoreIndexItem">
    {if 39_amazon_locale == "us"}
    {exp:aws_products:search item_id="{39_amazon_asin}" region="com" associate_id="{39_amazon_id}" public_key="XXX" private_key="XXX"}
    <div class="StoreIndexImage"><a href="http://{amazon_link}">{img_medium}</a></div>
    <div class="StoreIndexText">
    {title}
    
    
    {39_seller}
    </div>
    </div>
    {/exp:aws_products:search}
    {if:else}
    {exp:aws_products:search item_id="{39_amazon_asin}" region="co.uk" associate_id="{39_amazon_id}" public_key="XXX" private_key="XXX"}
    <div class="StoreIndexImage"><a href="http://{amazon_link}">{img_medium}</a></div>
    <div class="StoreIndexText">
    {title}
    
    
    {39_seller}
    </div>
    </div>
    {/exp:aws_products:search}
    {/if}
    </li>
    {/exp:weblog:entries}
    </ul>
  • #3 / Jan 18, 2012 1:27pm

    Linda A

    666 posts

    Oh, that appears to be the issue. Thank you! Will rethink how those conditionals are structured to see if I can simplify the template a bit.

  • #4 / Jan 18, 2012 1:44pm

    e-man

    1816 posts

    For the lowdown (pun intended) on parse order in EE, check @low’s presentation here:
    http://www.slideshare.net/lodewijkschutte/parse-order-pro
    At the bottom of the page there’s even a download link to a very educational PDF.

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

ExpressionEngine News!

#eecms, #events, #releases