?> " href="?cat_id=<?php echo $cat['id']; ?> "> <div class="category-thumb"> <img src="lib/images/main-categories/id/<?php echo $cat['id']; ?> .jpg" alt="<?php echo Translate::string("categoryMain." . Product::slugify($cat["name"])); ?> Category"> </div> <span class="category-label"><?php echo Translate::string("categoryMain." . Product::slugify($cat["name"])); ?> </span> </a> </div> <?php } ?> <div id="sub-category-container" class="<?php echo $load ? "" : "hidden"; ?> "> <?php if ($load) { require_once "lib/ajax/getSubCategories.php";
public function getAllCategories($settings = array()) { $this->query("SELECT DISTINCT m.name, m.id FROM categories_main as m, categories_sub as s WHERE m.id = s.main_cat_id ORDER BY m.name asc"); $mainCategories = $this->fetchAll(); $returnArray = array(); if ($mainCategories) { foreach ($mainCategories as $mCat) { $returnArray["categoryMain." . Product::slugify($mCat['name'])] = $mCat['name']; $this->query("SELECT id, name FROM categories_sub WHERE main_cat_id = :mCatID ORDER BY name asc"); $this->bind(':mCatID', $mCat['id']); $subCategories = $this->fetchAll(); foreach ($subCategories as $sCat) { $returnArray["categorySub." . Product::slugify($sCat['name'])] = $sCat['name']; } } } return $returnArray; }
<?php spl_autoload_register(function ($class) { require_once "../../lib/classes/" . $class . ".class.php"; }); if (!isset($_SESSION)) { session_start(); } if (isset($_POST["id"]) && isset($_SESSION["employee"])) { $db = new Database(); $db->query("UPDATE attributes SET \n\t\t\t\tname = :name ,\n\t\t\t\tname_nor = :name_nor ,\n\t\t\t\tslug = :slug ,\n\t\t\t\tcount = :count\n\t\t\t \tWHERE id = :id "); $db->bind(':name', $_POST["name"]); $db->bind(':name_nor', $_POST["name_nor"]); $db->bind(':slug', Product::slugify($_POST["name"])); $db->bind(':count', $_POST["count"]); $db->bind(':id', $_POST["id"]); $update = $db->execute(); $message = "Changed attribute " . $_POST["id"] . " information to:"; $message .= "name = " . $_POST["name"]; $message .= "name_nor = " . $_POST["name_nor"]; $message .= ", count = " . $_POST["count"]; $insert = $db->insertAdminLog($_SESSION["employee"], $message, $_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR'], session_id()); if ($update && $insert) { echo 'success'; } else { echo 'Change Failed. Please try again.'; } }
?> <a href="?cat_id=<?php echo $cat_id; ?> &sub_cat_id=<?php echo $subCat['id']; ?> " data-id="<?php echo $subCat['id']; ?> " class="sub-category <?php echo $subCat['id'] == $sub_cat_id ? "sub-cat-active" : ""; ?> "> <span><?php echo Translate::string("categorySub." . Product::slugify($subCat['name'])); // echo $count["total"]; ?> </span> </a> <?php } } else { ?> <a href="?" data-id="0" class="sub-category"><span><?php echo Translate::string("categories.no_sub_categories"); ?> </span></a> <?php } ?>