Detail Page of Products from URL id

3 posts by 2 authors in: Forums > CMS Builder
Last Post: December 16, 2009   (RSS)

I have been searching your forums and found many similar posts, but still haven't been able to get this to work. Any help much appreciated:

I have a table of product_categories (fields: name, content, photo)

I have my main products table that has a "list" field that pulls in the category from product_categories table. I want my products_detail.php page to list all products under a category that is specified in the url from the previous category list page. (ie product_details.php?ipphones-2)


require_once "/home/......./admin/lib/viewer_functions.php";

list($product_categoryRecords, $product_categoryMetaData) = getRecords(array(
'tableName' => 'product_category',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$product_categoryRecord = @$product_categoryRecords[0]; // get first record

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

list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'where' => "category LIKE '%\t" . mysql_escape($product_categoryRecord['num']) . "\t%'",
));

?>

Re: [chris] Detail Page of Products from URL id

Gosh, i was so so close :) Hey, you rock, i really appreciate the help.