Showing specific "list" records on detail pages

12 posts by 2 authors in: Forums > CMS Builder
Last Post: April 18, 2011   (RSS)

By (Deleted User) - April 11, 2011

I have a multi-records page for videos.

Each video is its own record.

I have Detail product pages where I want to pull in individual videos that relate to the specific product. I want this to be easy for the CMS user to just say
"ok, these 2 bulb videos should go on the "Bulb" product page, in addition the the full video list page"

Sounds simple in theory but doesn't seem to be in practice as far as I can see... Any insight on how to do this?

Re: [kimamel] Showing specific "list" records on detail pages

By Jason - April 12, 2011

Hi,

Just to clarify, for each of your product records, you want to be able to select videos from a list of video records. Is that right?

If so, what you need to do is go to your section editor for your products section and add a list field which you can call something like "videos". Under "Field Options" select either "pulldown(multi value) or "checkboxes(multi value)", whichever you prefer. Then under list options select "Get options from database (advanced)". You'll see 3 new drop downs appear.

Under "Section Tablename" select your video section
Under "use this field for option values", select "num"
Under "use this field for option labels", select whichever field you want, either "name" or "title" are usually good choices.

Then hit save. Now when you go into a product record you'll be able to select multiple "videos" from your video section.

Give that a try and let me know if you run into any issues. Once that's working, you can work on getting your video records on your product detail page. If you need some advice on that, please attach a copy of your product detail page to this thread.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Showing specific "list" records on detail pages

By (Deleted User) - April 12, 2011

Okay, so I took those steps and I feel like we're almost there. It seems REALLY cool and I can see the potential, but it's not working quite yet.

These are the videos:
http://www.atiintheusa.com/videos.php

And this is the page where I've selected 2 of the 3:
http://www.atiintheusa.com/bulbs.php
(Select the Support/Downloads tab)

You can see the titles appear, but not the Videos themselves, which are HTML...

Re: [kimamel] Showing specific "list" records on detail pages

By Jason - April 13, 2011

Hi,

It looks like you're most of the way there. If you could attach bulbs.php to this thread, I can take a look at your code an give you some examples of how to fix this.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Showing specific "list" records on detail pages

By (Deleted User) - April 13, 2011

This is the top
//////////////////
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/webadmin/www/atiintheusa/html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($bulbsRecords, $bulbsMetaData) = getRecords(array(
'tableName' => 'bulbs',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$bulbsRecord = @$bulbsRecords[0]; // get first record

// load records
list($bulb_specsRecords, $bulb_specsMetaData) = getRecords(array(
'tableName' => 'bulb_specs',
));

// show error message if no matching record is found
if (!$bulbsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

/////////////////////
and this is the area where it pulls in the videos
////////////////////


<p><?php echo $bulbsRecord['support_info'] ?></p>
<p><?php echo join(', ', getListLabels('bulbs', 'videos', $bulbsRecord['videos'])); ?></p>
<div class="clear"></div>

/////////////////////
In the Section editor, if I change
Use this field for option labels
from TITLE to Video Code,
It pulls in the videos, but not the title. I am trying to get the entire record to show up, which only consists of the title and video code. Thanks.

Re: [kimamel] Showing specific "list" records on detail pages

By (Deleted User) - April 14, 2011

Your assumptions are correct, but it's still not working.

First, everything was missing, then I noticed joing had a 'g' so I removed it and the content appeared.

Then I was getting an Undefined item error, so I went through and corrected names to all of the CMS names, and the error went away,but nothing is showing up now.

Re: [kimamel] Showing specific "list" records on detail pages

By Jason - April 15, 2011

Hi,

Good catch on the typo. I edited that post to reflect the change.

The code I gave you will select the proper video records. What you need to do is then output those records where you want them to display. I wasn't sure how you were outputting that information, so I didn't include it in the code.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Showing specific "list" records on detail pages

By (Deleted User) - April 15, 2011

Hi. Sorry, but I don't think I follow what you mean by output them? Can you clarify. Thanks.

Re: [kimamel] Showing specific "list" records on detail pages

By Jason - April 15, 2011

Hi,

After the code I gave you runs, you'll have a variable called $videoRecords. This will be all of the video records that were selected for your current product record.

What you'd have to do is loop through each of those records, and actually display the video the same way you did on your video page.

For example:

<?php foreach($videoRecords as $video):?>
- out put video here -
<?php endforeach ?>


Hope this helps clarify.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/