2 tables and tabs in order to display products per category
2 posts by 2 authors in: Forums > CMS Builder
Last Post: October 8, 2015 (RSS)
By Jesus - October 7, 2015
Hi everybody,
I've a couple of tables (products and categories) and I need some advice in order to display products for certain categories on tabs.
So far here's what I've...
1st I'm loading my 2 tables on the header
// load records from 'categories'
list($categoriesRecords, $categoriesMetaData) = getRecords(array(
'tableName' => 'categories',
'loadUploads' => true,
'allowSearch' => false,
'where' => "family='1'",
));
// load records from 'products'
list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'loadUploads' => true,
'allowSearch' => false,
));
Now... I'm creating my tabs this way...
<?php foreach ($categoriesRecords as $category): ?>
<li class="dm-icon-effect-1"><a href="#<?php echo $category['num'];?>" data-toggle="tab"><?php echo $category['category'];?></a></li>
<?php endforeach ?>
So far so good... but now, in order to display products per on each tab, I need to be able to define my tab content ID to match my previous tab code
<div class="tab-pane active" id="tab1">
on the previous line the id="tab1" needs to be equal to the each previous foreach <a href="#<?php echo $category['num'];?>"
The thing here its that I need to be able to match this 2 things from 2 different tables (categories and products).
Thanks in advance for pointing me to the right direction in order to make this work.
Once I'll be bale to complete the match, I'll just display the proper products on each tab with the foreach product command.
I hope I explained myself properly and my explanation makes sense.
Jesus
By Damon - October 8, 2015
Hi Jesus,
Could you post the HTML code of a working example of the category tabs with products (without PHP) so I can see what the end result code needs to look like?
Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/