Page 1 of 1

Calling An Individual field in the Availability Module 1.7.1 [SOLVED]

Posted: Thu Oct 08, 2009 8:59 pm
by clj83
Hi,

I am trying to call an individual field in the Availability Module 1.7.1 and cant get it to work. I have used this quite alot in the Products module and have it working fine there and there is also a helpful hint from Calguy in the template stating that "fields are also available by name as $one.fields_byname.". I have been at it for ages and just cant get it to work.

The field I am trying to call is named 'summaryimage' and using this code:

      {foreach from=$one.fields_byname.summaryimage item='field'}
        {$field.prompt}: {if isset($field.thumbnail)}{else}{$field.value}{/if}
      {/foreach}

Does call something, see the random code below, but not my image.

                    1:
               s:
               A:
               i:
               :
               c:

               t:


Can someone help me out here?

Thanks

Re: Calling An Individual field in the Availability Module 1.7.1

Posted: Thu Oct 08, 2009 10:35 pm
by Jeff
Try doing a {$field|@print_r} to check how the data is arranged.

Re: Calling An Individual field in the Availability Module 1.7.1

Posted: Fri Oct 09, 2009 10:36 am
by clj83
Hey,

Thanks for the response, I had done that already but it hadn't really helped that much. However, I have now sorted the problem and for anyone else who wants to know this is the solution:

Calling A Custom Field That Is An Image:
{if isset($rsrcs)}
  {foreach from=$rsrcs item='one'}

      {foreach from=$one.fields item='field'}
       {if $field.name == 'PUT FIELD NAME YOU WISH TO CALL HERE'}
         {$field.prompt}: {/if}
      {/foreach}

{/foreach}
{/if}


Calling A Text Custom Field:
{if isset($rsrcs)}
  {foreach from=$rsrcs item='one'}

      {foreach from=$one.fields item='field'}
       {if $field.name == 'PUT FIELD NAME YOU WISH TO CALL HERE'}
         {$field.prompt}: {$field.value}{/if}
      {/foreach}

{/foreach}
{/if}

I hope this helps someone too.

Chris

Re: Calling An Individual field in the Availability Module 1.7.1 [SOLVED]

Posted: Tue Aug 03, 2010 10:35 am
by nicmare
just to keep it up to date. you solution seems to be a lil bit complicated.
try this one for summary template:


and this one for detail template of resource:

Re: Calling An Individual field in the Availability Module 1

Posted: Fri Sep 23, 2011 8:44 pm
by bunker
I go with

$rsrc.fields.YOUR_FIELD.value

Re: Calling An Individual field in the Availability Module 1

Posted: Mon Apr 30, 2012 12:38 am
by yumein
I believe that this is a more complete Answer:


For the "Summary template" Use:

For Field Array:
{$one.fields.YOUR_FIELD}
For Field Value:
{$one.fields.YOUR_FIELD.value}


For the "Detail template" Use:

For Field Array:
{$rsrc.fields.YOUR_FIELD}
For Field Value:
{$rsrc.fields.YOUR_FIELD.value}



Works 100%

Regards.