Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.98 KB | None | 0 0
  1. <div class="container">
  2.         <div class="sixteen columns list" style="margin-top:100px; min-height: 350px;">
  3.             <div id="filters">
  4.             <div class="ui-group">
  5.             <div class="button-group js-radio-button-group" data-filter-group="cat1">
  6.             <?php //first check first category, then second, then third? count amount?
  7.             $conn = mysqli_connect("localhost","root","","easesign_products");
  8.             // Check connection
  9.             if ($conn->connect_error) {
  10.                 die("Connection failed: " . $conn->connect_error);
  11.             }
  12.             $count_cat1=array_count_values($product_category1);//Counts the values in the array, returns associatve array
  13.             arsort($count_cat1);//Sort it from highest to lowest
  14.             $keys_cat1=array_keys($count_cat1);//Split the array so we can find the most occuring key
  15.            
  16.             $count_cat2=array_count_values($product_category2);//Counts the values in the array, returns associatve array
  17.             arsort($count_cat2);//Sort it from highest to lowest
  18.             $keys_cat2=array_keys($count_cat2);//Split the array so we can find the most occuring key
  19.            
  20.             $count_cat3=array_count_values($product_category3);//Counts the values in the array, returns associatve array
  21.             arsort($count_cat3);//Sort it from highest to lowest
  22.             $keys_cat3=array_keys($count_cat3);//Split the array so we can find the most occuring key
  23.            
  24.             $cat_amount1 = count($count_cat1);
  25.             $cat_amount2 = count($count_cat2);
  26.             $cat_amount3 = count($count_cat3);
  27.             //echo $catamount;
  28.             //cat1 cat2 and cat3 filtering
  29.             $i=0;
  30.             for($i;$i<$cat_amount1;$i++){
  31.             $keys_cat1[$i] = preg_replace('/\s*/', '', $keys_cat1[$i]);
  32.             ?>
  33.               <button class="button" data-filter="<?php echo $keys_cat1[$i];?>"><?php echo $keys_cat1[$i];?></button>
  34.             <?php
  35.             }
  36.             echo "</div></div><br/><div class=\"ui-group\"><div class=\"button-group js-radio-button-group\" data-filter-group=\"cat2\">";
  37.             $i=0;
  38.             for($i;$i<$cat_amount2;$i++){
  39.             $keys_cat2[$i] = preg_replace('/\s*/', '', $keys_cat2[$i]);
  40.             ?>
  41.               <button class="button" data-filter="<?php echo $keys_cat2[$i];?>"><?php echo $keys_cat2[$i];?></button>
  42.             <?php
  43.             }
  44.             echo "</div></div><br/><div class=\"ui-group\"><div class=\"button-group js-radio-button-group\" data-filter-group=\"cat2\">";
  45.             $i=0;
  46.             for($i;$i<$cat_amount3;$i++){
  47.             $keys_cat3[$i] = preg_replace('/\s*/', '', $keys_cat3[$i]);
  48.             ?>
  49.               <button class="button" data-filter="<?php echo $keys_cat3[$i];?>"><?php echo $keys_cat3[$i];?></button>
  50.             <?php
  51.             }
  52.             ?>  
  53.             </div></div>
  54.             </div>
  55.             <p><button id="shuffle">Shuffle</button></p>
  56.         <div id="categories"><!--doesn't exist-->
  57.             <?php
  58.             $i=0;
  59.             for($i;$i<$search_amount;$i++){
  60.                 // strip out all whitespace
  61.                 $product_category1[$i] = preg_replace('/\s*/', '', $product_category1[$i]);
  62.                 $product_category2[$i] = preg_replace('/\s*/', '', $product_category2[$i]);
  63.                 $product_category3[$i] = preg_replace('/\s*/', '', $product_category3[$i]);
  64.                 // convert the string to all lowercase
  65.                 $product_category1[$i] = strtolower($product_category1[$i]);
  66.                 $product_category2[$i] = strtolower($product_category2[$i]);
  67.                 $product_category3[$i] = strtolower($product_category3[$i]);
  68.                 //convert title to link
  69.                 $product_link = preg_replace('/[\s_]/', '-', $product_name[$i]);
  70.             ?>
  71.             <a class="item <?php echo $product_category1[$i]?> <?php echo $product_category2[$i]?> <?php echo $product_category3[$i]?>" href="http://localhost/easesign/p/<?php echo $product_link?>" title="<?php echo $product_name[$i]?>">
  72.                 <img src="http://localhost/easesign/images/<?php echo $product_image1[$i]?>.jpg"width="150px" height="150px"alt="<?php echo $product_name[$i]?>"/>
  73.                 <h6><?php echo $product_name[$i]?></h6>
  74.                 <span class="price">$<?php echo $product_price[$i]?></span>
  75.                 <i class="retail_price">Retail Value <del>$<?php echo $product_price[$i]+30;?></del></i>
  76.                 <br class="clear">
  77.             </a>
  78.             <?php
  79.             }
  80.             //from list id get category names (max of ?), order by newest, most popular
  81.             ?>
  82.  
  83.         </div>
  84. <script type="text/javascript">
  85. $( function() {
  86.   // init Isotope
  87.   var $container = $('#categories').isotope({
  88.     itemSelector: '.item'
  89.   });
  90.  
  91.   // store filter for each group
  92.   var filters = {};
  93.  
  94.   $('#filters').on( 'click', '.button', function() {
  95.     var $this = $(this);
  96.     // get group key
  97.     var $buttonGroup = $this.parents('.button-group');
  98.     var filterGroup = $buttonGroup.attr('data-filter-group');
  99.     // set filter for group
  100.     filters[ filterGroup ] = $this.attr('data-filter');
  101.     // combine filters
  102.     var filterValue = '';
  103.     for ( var prop in filters ) {
  104.       filterValue += filters[ prop ];
  105.     }
  106.     // set filter for Isotope
  107.     $container.isotope({ filter: filterValue });
  108.   });
  109.  
  110.   // change is-checked class on buttons
  111.   $('.button-group').each( function( i, buttonGroup ) {
  112.     var $buttonGroup = $( buttonGroup );
  113.     $buttonGroup.on( 'click', 'button', function() {
  114.       $buttonGroup.find('.is-checked').removeClass('is-checked');
  115.       $( this ).addClass('is-checked');
  116.     });
  117.   });
  118.  
  119. });
  120.  
  121. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement