Guest User

Untitled

a guest
Apr 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <?php
  2. $productIDs = array();
  3. foreach($this->theVariables['products'] as $product) {
  4. $productIDs[] = $product['productID'];
  5. }
  6.  
  7. $strSQL = 'SELECT
  8. DISTINCT(technical_data_values.name) AS value, technical_data_types.name AS type,
  9. technical_data_values.value_id, technical_data_values.type_id
  10. FROM product_has_technical_data_values
  11. INNER JOIN technical_data_values
  12. ON technical_data_values.value_id = product_has_technical_data_values.value_id
  13. INNER JOIN technical_data_types
  14. ON technical_data_types.type_id = technical_data_values.type_id
  15. WHERE product_id
  16. IN(' . implode(', ', $productIDs) . ')
  17. ORDER BY technical_data_types.name, technical_data_values.name';
  18. $runSQL = $dbA->query($strSQL);
  19. ?>
  20. <script>
  21. $(document).ready(function() {
  22. var checked = new String();
  23. $('.filter-data').change(function() {
  24. if($(this).attr('checked')) {
  25. $('.product-overview').fadeOut(150);
  26. checked += '.' + $(this).attr('id');
  27. filter();
  28. } else {
  29. checked = checked.replace('.' + $(this).attr('id'), '');
  30. filter();
  31. }
  32. });
  33.  
  34. function filter() {
  35. checked.length > 0 ? $(checked).fadeIn(100) : $('.product-overview').fadeIn(250);
  36. }
  37. });
  38. </script>
  39. <?php if($dbA->count($runSQL) > 0) { ?>
  40. <div class="right-box">
  41. <h2>Narrow Your Search</h2>
  42. <?php
  43. while($row = $dbA->fetch($runSQL)) {
  44. echo $row['type'] !== $lastType ? '<h3 style="padding: 4px; padding-top: 20px;">' . $row['type'] . '</h3>' . "\n" : '';
  45. $lastType = $row['type'];
  46. ?>
  47. <input class="filter-data" type="checkbox" id="tdt<?php echo $row['type_id']; ?>v<?php echo $row['value_id']; ?>"> <?php echo $row['value']; ?> <br />
  48. <?php } ?>
  49. </div>
  50. <?php
  51. }
  52. ?>
Add Comment
Please, Sign In to add comment