relatedRecordLookupFunctions plugin implementation issue

9 posts by 3 authors in: Forums > CMS Builder
Last Post: January 26, 2021   (RSS)

By gkornbluth - January 3, 2021 - edited: January 4, 2021

Hi All,

I’m using the relatedRecordLookupFunctions plugin in a list page and I could use some help

I have a multi record section called 'musicians_listings' that contains images, bios and contact info for a number of musicians, and another multi record section called 'listen_live' to list information about various live concerts. There's a 'is_this_a_jojs_presents_event' check box in each record since only jojs presents' events will have featured musicians.

There’s a pillbox list field in the 'listen_live' section that pulls featured musician names from the 'musicians_listings' section.

Using the relatedRecordLookupFunctions plugin I’m able to display the musician’s information for each 'jojs presents' concert on the detail page for that concert.

I’m having a problem with using this approach to list the correct musician information on a concert list page.

I can’t seem to figure out how to pull the related musician information (based on pillbox entries) from anything but the first record.

Even if there are multiple records that meet the date criteria, and that have the ‘is_this_a_jojs_presents_event’ check box checked, even if there are different musicians in the pillbox field for each record, only the musicians from the first record in the list are retrieved and are repeated multiple times.

Below is the active code that I have so far.

The issue is probably something obvious (just not to me.

Any Thoughts?

Thanks,and best for the New Year!

Jerry Kornbluth

AT THE TOP OF MY PAGE
<?php
// load records
list($listen_liveRecords, $listen_liveMetaData) = getRecords(array(
'tableName' => 'listen_live',

));

// load record from 'listen_live_presets'
list($listen_live_presetsRecords, $listen_live_presetsMetaData) = getRecords(array(
'tableName' => 'listen_live_presets',
'where' => '', // load first record
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$listen_live_presetsRecord = @$listen_live_presetsRecords[0]; // get first record

// load records from 'musicians_lisings'
list($musicians_lisingsRecords, $musicians_lisingsMetaData) = getRecords(array(
'tableName' => 'musicians_lisings',
'loadUploads' => true,
'allowSearch' => false,
));

beta_lookupRelatedFields(array(
'table' => 'listen_live',
'recordList' => &$listen_liveRecords,
'fieldList' => array( 'performers' )

));
$listen_liveRecord = @$listen_liveRecords[0]; // get first record
?>

IN THE BODY

<!-- BEGIN PERFORMER LISTING CODE -->
<?php // only retrieve records where the presentation date is within the upcoming 31 days
list($listen_liveRecords, $listen_liveMetaData) = getRecords(array(
'tableName' => 'listen_live',
'where' => '((NOW() + INTERVAL 31 DAY) >= presentation_date AND presentation_date >= TIMESTAMP(CURDATE(), "00:00:00"))',
'orderBy'=> 'presentation_date ASC',
));
?>

<table width="100%" border="0" align="center">
<?php foreach ($listen_liveRecords as $record): ?>
<?php if ($record['is_this_a_jojs_presents_event'] == 1 && !empty($record['performers'])):
// only JOJS Presents! listings have performers listed
?>
<?php
foreach ($listen_liveRecord['performers'] as $performer):?>
<tr>
<td width="25%"><a href="musicians_detail.php?<?php echo $performer['num'] ?>">
<?php foreach ($performer['list_page_image'] as $upload): ?>
<img class="img_shadow" style="border:hidden" src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php endforeach ?>
</a>
</td>
<td>
<a href="<?php echo $common_informationRecord['master_url'] >/musicians_detail.php?<?php echo $performer['num'] ?>"><span class="sub_heading_font" style="text-decoration:underline"> <?php echo $performer['full_performer_or_group_name'] ?> - <?php echo $performer['medium'] ?></span> <br />
</a></td>
</tr>
<?php endforeach ?>
<?php endif ?>
<?php endforeach ?>
</table>
<!-- END PERFORMER LISTING CODE -->

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By hans - January 4, 2021

Hello, perhaps you would like to discuss this over a screen share? Just in order to understand things better.

Thanks.

Hans Marcon
PHP Programmer (In Training)
interactivetools.com

By hans - January 4, 2021

Do you have a gmail account?

Hans Marcon
PHP Programmer (In Training)
interactivetools.com

By hans - January 4, 2021

Where do you prefer to have a video call in?

Hans Marcon
PHP Programmer (In Training)
interactivetools.com

Would Zoom work for you?

You can send the invite to my gmail address

Thank you for this

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By hans - January 4, 2021

Alrighty. I sent an invite

Hans Marcon
PHP Programmer (In Training)
interactivetools.com

By Jenna - January 26, 2021

Hi Jerry,

Just checking in on this post. Did you and Hans arrive at a suitable answer or are you still looking for a solution?

Please let me know.

Jenna Cooke - PHP Programmer
interactivetools.com

Hi Jenna,

Yes we did, thanks for checking.

I'm writing up the solution as a 'recipe' in my CMSB Cookbook http://thecmsbcookbook.com

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php