import other tables to the detailed listing

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 27, 2011   (RSS)

By loccom - June 25, 2011

Hi

I am having a small problem, in my detailed listing page i want to import another table from the CMS. This works if i go to the detailed page directly with no query but as go to a product query ie: "productInfo.php?6" the record does'nt work.

here is my header:

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


// load viewer library
$libraryPath = 'cms/lib/viewer_functions.php';
$dirsToCheck = array('/home/websitem/public_html/sites/','','../','../../','../../../');
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($healthgood_productsRecords, $healthgood_productsMetaData) = getRecords(array(
'tableName' => 'healthgood_products',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));


$healthgood_productsRecord = @$healthgood_productsRecords[0]; // get first record


// load records
list($popular_productsRecords, $popular_productsMetaData) = getRecords(array(
'tableName' => 'popular_products',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$popular_productsRecord = @$popular_productsRecords[0]; // get first record

// load records
list($product_linksRecords, $product_linksMetaData) = getRecords(array(
'tableName' => 'product_links',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$product_linksRecord = @$product_linksRecords[0]; // get first record


// show error message if no matching record is found
if (!$healthgood_productsRecord) { dieWith404("Record not found!"); }

?>


Can anyone help me please?

Re: [loccom] import other tables to the detailed listing

By Damon - June 27, 2011 - edited: June 27, 2011

Hi,

Is the detail page for healthgood_products?

And you want to pull in the latest 1 record each from both popular_products and product_links?

If this is the case, remove
where' => whereRecordNumberInUrl(1),
from both popular_products and product_links parts of the code.

And add to both
'allowSearch' => '0',
so the results are not effected by the product query.

Let me know if that helps.

Thanks!
Cheers,
Damon Edis - interactivetools.com

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