• Resolved [email protected]

    (@scrappyhuborg)


    sorry, hate coming up with subjects … hopefully my ask is better …

    Hopefully I’m asking this in the right place .. the repeater field is implemented with Panda, so I’m figuring it has something to do with how its being linked …

    I’ve got a pod created that defines a staff member for a spa, and I’ve added a ACT using Panda pods to define their hourly rates … it all set up great, I can enter data, I can see it on the backend … and I can even see it ( sort of ) on the front end, but I’m trying to do something that i’m jus tnot figuring out …

    I made a Pod Template:

    <center>
    <table width=75% border=1>
    [each hourly_rates]
    <tr>
    <td width=25%>{@time_label}</td>
    <td width=25%>$ {@service1}</td>
    <td width=25%>[if field=”service2″ value=”0″ compare=”>”]$ {@service2}[/if]</td>
    <td width=25%>$ {@service3}</td>
    </tr>
    [/each]
    </table>
    </center>

    But I can’t get the if statement to work … if I take the if statement out, the value for @server2 shows properly … with the if statement there, then the table entry is empty, as if the if is returning FALSE, so I’m thinking I’m somehow referencing the fields wrong … ?

    the ACT is defined as a table, and as:

    > describe wp_gtuqdz_pods_rate_table;
    +————————-+—————–+——+—–+———————+—————-+
    | Field | Type | Null | Key | Default | Extra |
    +————————-+—————–+——+—–+———————+—————-+
    | id | bigint unsigned | NO | PRI | NULL | auto_increment |
    | time_label | decimal(4,0) | YES | | NULL | |
    | service2 | decimal(4,0) | YES | | NULL | |
    | service1 | decimal(4,0) | YES | | NULL | |
    | service3 | decimal(4,0) | YES | | NULL | |
    | pandarf_parent_pod_id | int | NO | | NULL | |
    | pandarf_parent_post_id | int | NO | | NULL | |
    | pandarf_pod_field_id | int | NO | | NULL | |
    | pandarf_order | text | NO | | NULL | |
    | pandarf_created | datetime | NO | | 0000-00-00 00:00:00 | |
    | pandarf_modified | datetime | NO | | 0000-00-00 00:00:00 | |
    | pandarf_modified_author | int | NO | | NULL | |
    | pandarf_author | int | NO | | NULL | |
    | pandarf_trash | int | NO | | 0 | |
    +————————-+—————–+——+—–+———————+—————-+
    14 rows in set (0.00 sec)

    I’ve checked the backend … when I leave a field blank during data entry ( ie. service3 is blank ), it gets a value of 0 in the field, which is why I’m asking it to display a value *only* if that field is > 0 …

    I’m always happy with a pointer to RTFM, but am hoping that its something stupid that I’ve just not tried or found in my searches of the docs to date …

    Thanks for your patience, any help appreciated …

Viewing 1 replies (of 1 total)
  • Plugin Author Coding Panda

    (@codingpanda)

    Hi @scrappyhuborg

    I can’t get it to work too. I think the if condition only works for the parent pod, not the child pod (hourly_rates). Maybe @sc0ttkclark could help.

    My workaround is to apply a CSS class to it, like the one below:
    <td width=25%><span class="service-{@food_price}">$ {@food_price}</span></td>

    and then in CSS, do the following if {@food_price} is 0.

    .service-0{
    display:none;
    }

    I hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘[each] loop + [if field … ]’ is closed to new replies.