OK, I think I;ve completely painted myself into a corner here with these breadcrumbs. Hope you can help. The example of category down to product detail page is this:
Home > Agriculture > All Boxes > Oyster Box
or;
Home > Category > Sub Category > Product Detail
1. Top Level Categories - no problem with breadcrumbs as I just repeat the title in the breadcrumb and it does not need to be hyperlinked (only home does) - i.e. Home > Agriculture
2. Sub Category Page - I can get the text to present correctly but can not get the links to go to the correct page in the breadcrumbs.
I am using this in the header:
// load records
list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'where' => "sub_category = '". intval($product_sub_categoriesRecord['num']) ."'" ,
));
and this is in breadcrumbs:
<ul class="breadcrumbs">
<li><a href="index.php">Home</a></li>
<li><a href="#"><?php echo $product_sub_categoriesRecord['category:label'] ?></a></li>
<li><?php echo $product_sub_categoriesRecord['title'] ?></li>
</ul>
I don;t know what code to put for the link for the sub category label.
3. Product detail pages - I can not get the labels correct (showing wrong sub category) nor links for the subcategories.
I am using this in the header:
// load records
list($product_sub_categoriesRecords, $product_sub_categoriesMetaData) = getRecords(array(
'tableName' => 'product_sub_categories',
'limit' => '1',
));
$product_sub_categoriesRecord = @$product_sub_categoriesRecords[0]; // get first record
$subCategories = mysql_select("product_sub_categories");
$subCategoryNumToTitle = array_combine(array_pluck($subCategories, 'num'), array_pluck($subCategories, 'title'));
and this in the body:
<ul class="breadcrumbs">
<li><a href="#">Home</a></li>
<li><a href="#"><?php echo $productsRecord['category:label'] ?></a></li>
<li><a href="#"><?php echo $subCategoryNumToTitle[$product_sub_categoriesRecord['category']]; ?></a></li>
<li><?php echo $productsRecord['title'] ?></li>
</ul>
Any ideas what I am doing wrong?
Thanks in advance.