Re: [benedict] Category selection populates sub categories
Hi Jason,
Following on from the above issue, I am now coding the front end and have got a bit stuck. here is the scenario:
1. User arrives at the home page and is able to select a category tab and see all the subcategories of that category and click through to subcategory page.
2. Subcategory page needs to show the subcategory content plus the products that fit within that category > subcategory. This is where I am getting stuck with the header code.
Currently, I am trying this:
// load records
list($product_sub_categoriesRecords, $product_sub_categoriesMetaData) = getRecords(array(
'tableName' => 'product_sub_categories',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$product_sub_categoriesRecord = @$product_sub_categoriesRecords[0]; // get first record
// load records
list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'where' => "sub_category LIKE '". $product_sub_categoriesRecord['title'] ."'" ,
'debugSql' => true,
));
But I think this is relying on the name of categories too much, i.e. shouldn;t it relate to record numbers? I also note that this does not make any reference to the category above the subcategory. This is important because many sub-categories actually appear in multiple categories:
For example:
Agriculture and Aquaculture > Ice Boxes
Packaging > Ice Boxes
Building and Construction > Ice Boxes
I'd appreciate any assistance you could offer.
Cheers,
B