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.

If statement help

June 10, 2010 8:37pm

Subscribe [3]
  • #1 / Jun 10, 2010 8:37pm

    webster10

    9 posts

    I need to create an {if} statement.

    I have a list of products{model} and each Model has various {colors}. Each color has its own entry_id number and a parent model number included in the entry.

    I need the {if} statement to basically say {if model == {model}} and list all the {colors} with the parent model number. (without hard coding the actual model number.)

    I’m sure I can explain more but I hope this will give you an idea of what I am attempting to write.  Thank you in advance.

  • #2 / Jun 10, 2010 8:58pm

    Brandon Jones

    5500 posts

    Hi webster10, and welcome to the forums!

    If you’re new to EE, I’d suggest taking a step back and re-evaluating how you can best harness EE’s power for your needs. Jumping straight to a bunch of {if} statements seems counterproductive based on what you’ve described, plus…

    {if model == {model}}

    ...isn’t recommended syntax, and would likely always evaluate to TRUE. For related entries, you can go from the built-in functionality all the way up to Playa.

    You might also consider the How-to forum to get some further ideas. Does that help?

  • #3 / Jun 11, 2010 8:54pm

    webster10

    9 posts

    Okay, you have me going in the correct direction.  however, I am having an issue:
    related_entries is not showing up.

    Here is the code:

    {exp:weblog:entries weblog="guitars"}
    {related_entries id="skuoptions"}
    
     {if no_related_entries}
      <h2>No Color Information Available</h2>
    
    <p>{/if}<br />
    COLOR: {sku_Color}</p>
    
    <p>{/related_entries}<br />
    {/exp:weblog:entries}

    Could I have my Weblog and related_entries reversed?  It just does not show up.

  • #4 / Jun 12, 2010 12:06pm

    Greg Salt

    3988 posts

    Hi webster10,

    Let’s just review your current setup to make sure that it’s right. Please confirm that if you remove the related_entries tag pair that your template displays entries that are in the ‘guitars’ weblog?

    Your ‘skuoptions’ custom field should be in the field group assigned to the ‘guitars’ weblog and the ‘skuoptions’ field is related to another weblog? What is that other weblog called?

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases