<?php define('ALLOW_ACCESS', true); // allow access to this page require_once "includes/header.php"; $db = new Database(); // $mainCatID = false; if (isset($_GET["cat_id"])) { $mainCatID = $_GET["cat_id"]; $subCategories = $db->getSubCategoriesArray($mainCatID, "CASE WHEN name = 'Other' THEN 2 ELSE 1 END,name ASC"); require_once "../lib/includes/sanitize-all.php"; } $mainCategories = $db->getMainCategoriesArray("case when name = 'Deleted' then 3 when name = 'Free Stuff' then 2 else 1 end,name desc"); $subCatID = NULL; if (isset($_GET["sub_cat_id"])) { $subCatID = $_GET["sub_cat_id"]; $db->query('SELECT id, slug, name, name_nor, type, count FROM attributes WHERE sub_cat_id = :subCatID ORDER BY name ASC'); $db->bind(':subCatID', $subCatID); $attributes = $db->fetchAll(); } if (isset($_GET["attr_id"])) { $attrID = $_GET["attr_id"]; $db->query('SELECT id, name, name_nor, slug, count FROM specs WHERE id IN ( SELECT DISTINCT spec_id FROM product_specs WHERE attribute_id = :attrID ) ORDER BY name DESC '); // $db->query('SELECT id, name, slug, count FROM specs WHERE id IN ( SELECT DISTINCT spec_id FROM product_specs WHERE attribute_id = :attrID AND product_id IN (SELECT id FROM products WHERE sub_cat_id = :subCatID ) ) ORDER BY name DESC '); // $db->bind(':subCatID', $subCatID); $db->bind(':attrID', $attrID); $specifications = $db->fetchAll(); } $change_attribute = false; if (isset($_GET["change_attribute"])) { $change_attribute = $change_attribute;