function displaysearch() { $language_fields_addition = $_SESSION['language'] == 'en_US' ? '' : '_' . $_SESSION['language']; //select all the categories in the database $category_dao = new CategoryDAO(); $categories = $category_dao->getAllCategories(); $specification_dao = new SpecificationDAO(); ?> <ul class="nav nav-tabs"> <?php foreach ($categories as $category) { ?> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php echo $category->{'name' . $language_fields_addition}; ?> <span class="caret"></span></a> <?php $specifications = $specification_dao->getbyCategoryid($category->id); ?> <ul class="dropdown-menu"> <?php foreach ($specifications as $specification) { ?> <li><a href="?category=<?php echo $category->id; ?> &specification=<?php echo $specification->id; ?> "><?php echo $specification->{'name' . $language_fields_addition}; ?> </a></li> <?php } ?> </ul> <?php } ?> </ul> <?php }
function displayspecification(category_id) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { document.getElementById("specification").innerHTML = xhttp.responseText; } } xhttp.open("GET", "../getspecification.php?idcategory="+category_id, true); xhttp.send(); } </script> <?php $category_dao = new CategoryDAO(); $categories = $category_dao->getAllCategories(); $page['title'] = 'Add product'; require '../../include/header.inc'; require '../../include/index.inc'; ?> <h3><?php echo t('Add product'); ?> </h3> <form class="form-horizontal" action = "?" method="POST" enctype="multipart/form-data"> <div class="form-group"> <label class="col-md-1 control-label" for="textinput"><?php echo t('Category'); ?> </label>