Advanced search module

ThemeBurn SupportForumsOpenCart ThemesShoppica OpenCart ThemeAdvanced search module

This topic has been marked as resolved.

Hi,

I bought Advanced Search Module in OpenCart.com Store and I have a problem with this module:

Products are in one column together with a description, despite of 3 columns only with photos.

Please see below, it looks that:

http://karambola.pl/index.php?route=product/adsoptions&filter_category_id=0&filter_manufacturer_id=11&filter_groupsoption=13&filter_optionvalue=94

it should looks that:

http://karambola.pl/index.php?route=product/category&path=20_26

firs file in:

\catalog\view\theme\shoppica\template\product

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <h1><?php echo $heading_title; ?></h1>

  <h2><?php echo $text_search; ?></h2>
  <?php if ($products) { ?>
  <div class="product-filter">
    <div class="display"><b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display('grid');"><?php echo $text_grid; ?></a></div>
    <div class="limit"><?php echo $text_limit; ?>
      <select onchange="location = this.value;">
        <?php foreach ($limits as $limits) { ?>
        <?php if ($limits['value'] == $limit) { ?>
        <option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </div>
    <div class="sort"><?php echo $text_sort; ?>
      <select onchange="location = this.value;">
        <?php foreach ($sorts as $sorts) { ?>
        <?php if ($sorts['value'] == $sort . '-' . $order) { ?>
        <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </div>
  </div>
  <div class="product-compare"><a href="<?php echo $compare; ?>" id="compare_total"><?php echo $text_compare; ?></a></div>
  <div class="product-list">
    <?php foreach ($products as $product) { ?>
    <div>
      <?php if ($product['thumb']) { ?>
      <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
      <?php } ?>
      <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
      <div class="description"><?php echo $product['description']; ?></div>
      <?php if ($product['price']) { ?>
      <div class="price">
        <?php if (!$product['special']) { ?>
        <?php echo $product['price']; ?>
        <?php } else { ?>
        <s><?php echo $product['price']; ?></s> <b><?php echo $product['special']; ?></b>
        <?php } ?>
        <?php if ($product['tax']) { ?>
        <br />
        <span><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
        <?php } ?>
      </div>
      <?php } ?>
      <?php if ($product['rating']) { ?>
      <div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
      <?php } ?>
      <div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a></div>
      <div class="wishlist"><a onclick="addToWishList('<?php echo $product['product_id']; ?>');"><?php echo $button_wishlist; ?></a></div>
      <div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>
    </div>
    <?php } ?>
  </div>
  <div class="pagination"><?php echo $pagination; ?></div>
  <?php } else { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <?php }?>
  <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
$('#content input[name=\'filter_name\']').keydown(function(e) {
  if (e.keyCode == 13) {
    $('#button-search').trigger('click');
  }
});

$('#button-search').bind('click', function() {
  url = 'index.php?route=product/search';

  var filter_name = $('#content input[name=\'filter_name\']').attr('value');

  if (filter_name) {
    url += '&filter_name=' + encodeURIComponent(filter_name);
  }

  var filter_category_id = $('#content select[name=\'filter_category_id\']').attr('value');

  if (filter_category_id > 0) {
    url += '&filter_category_id=' + encodeURIComponent(filter_category_id);
  }

  var filter_sub_category = $('#content input[name=\'filter_sub_category\']:checked').attr('value');

  if (filter_sub_category) {
    url += '&filter_sub_category=true';
  }

  var filter_description = $('#content input[name=\'filter_description\']:checked').attr('value');

  if (filter_description) {
    url += '&filter_description=true';
  }

  location = url;
});

function display(view) {
  if (view == 'list') {
    $('.product-grid').attr('class', 'product-list');

    $('.product-list > div').each(function(index, element) {
      html  = '<div class="right">';
      html += '  <div class="cart">' + $(element).find('.cart').html() + '</div>';
      html += '  <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
      html += '  <div class="compare">' + $(element).find('.compare').html() + '</div>';
      html += '</div>';

      html += '<div class="left">';

      var image = $(element).find('.image').html();

      if (image != null) {
        html += '<div class="image">' + image + '</div>';
      }

      var price = $(element).find('.price').html();

      if (price != null) {
        html += '<div class="price">' + price  + '</div>';
      }

      html += '  <div class="name">' + $(element).find('.name').html() + '</div>';
      html += '  <div class="description">' + $(element).find('.description').html() + '</div>';

      var rating = $(element).find('.rating').html();

      if (rating != null) {
        html += '<div class="rating">' + rating + '</div>';
      }

      html += '</div>';

      $(element).html(html);
    });

    $('.display').html('<b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display(\'grid\');"><?php echo $text_grid; ?></a>');

    $.cookie('display', 'list');
  } else {
    $('.product-list').attr('class', 'product-grid');

    $('.product-grid > div').each(function(index, element) {
      html = '';

      var image = $(element).find('.image').html();

      if (image != null) {
        html += '<div class="image">' + image + '</div>';
      }

      html += '<div class="name">' + $(element).find('.name').html() + '</div>';
      html += '<div class="description">' + $(element).find('.description').html() + '</div>';

      var price = $(element).find('.price').html();

      if (price != null) {
        html += '<div class="price">' + price  + '</div>';
      }

      var rating = $(element).find('.rating').html();

      if (rating != null) {
        html += '<div class="rating">' + rating + '</div>';
      }

      html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
      html += '<div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
      html += '<div class="compare">' + $(element).find('.compare').html() + '</div>';

      $(element).html(html);
    });

    $('.display').html('<b><?php echo $text_display; ?></b> <a onclick="display(\'list\');"><?php echo $text_list; ?></a> <b>/</b> <?php echo $text_grid; ?>');

    $.cookie('display', 'grid');
  }
}

view = $.cookie('display');

if (view) {
  display(view);
} else {
  display('list');
}
//--></script>
<?php echo $footer; ?>

second file in:

catalog\view\theme\shoppica\template\module

<div class="box" id="box_search">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
      <table border="0">
         <tr>
          <td colspan="4"><?php echo $entry_search; ?></td>
         </tr>
          <tr>
          <td colspan="4"><?php if ($filter_name) { ?>
      <input style="width: 145px;" type="text" id="filter_name" name="filter_name" value="<?php echo $filter_name; ?>" />
      <?php } else { ?>
      <input style="width: 145px;" type="text" id="filter_name" name="filter_name" value="<?php echo $filter_name; ?>" onclick="this.value = '';" onkeydown="this.style.color = '000000'" style="color: #999;" />
      <?php } ?></td>
        </tr>

          <tr>
          <td colspan="4"><?php echo $entry_category; ?></td>
          </tr>
          <tr>
          <td colspan="4">
              <select style="width: 155px;" name="filter_category_id" id="filter_category_id">
                    <option value="0"><?php echo $text_category; ?></option>
                    <?php foreach ($categories as $category_1) { ?>
                    <?php if ($category_1['category_id'] == $filter_category_id) { ?>
                    <option value="<?php echo $category_1['category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option>
                    <?php } else { ?>
                    <option value="<?php echo $category_1['category_id']; ?>"><?php echo $category_1['name']; ?></option>
                    <?php } ?>
                    <?php foreach ($category_1['children'] as $category_2) { ?>
                    <?php if ($category_2['category_id'] == $filter_category_id) { ?>
                    <option style="padding-left: 20px;" value="<?php echo $category_2['category_id']; ?>" selected="selected"><?php echo $category_2['name']; ?></option>
                    <?php } else { ?>
                    <option style="padding-left: 20px;" value="<?php echo $category_2['category_id']; ?>"><?php echo $category_2['name']; ?></option>
                    <?php } ?>
                    <?php foreach ($category_2['children'] as $category_3) { ?>
                    <?php if ($category_3['category_id'] == $filter_category_id) { ?>
                    <option style="padding-left: 30px;" value="<?php echo $category_3['category_id']; ?>" selected="selected"><?php echo $category_3['name']; ?></option>
                    <?php } else { ?>
                    <option style="padding-left: 30px;" value="<?php echo $category_3['category_id']; ?>"><?php echo $category_3['name']; ?></option>
                    <?php } ?>
                    <?php } ?>
                    <?php } ?>
                    <?php } ?>
                  </select>
          </td>
        </tr>
          <tr>
          <td colspan="4">
              <?php if ($filter_sub_category) { ?>
              <input type="checkbox" name="filter_sub_category" value="1" id="sub_category" checked="checked" />
              <?php } else { ?>
              <input type="checkbox" name="filter_sub_category" value="1" id="sub_category" />
              <?php } ?>
              <label for="sub_category"><?php echo $text_sub_category; ?></label>
        </tr>
          <tr>

        <tr>
          <td colspan="4"><?php echo $entry_manufacture; ?></td>
        </tr>
        <tr>
          <td colspan="4">
          <select style="width: 155px;" id="filter_manufacturer_id">
              <option value=""><?php echo $text_manufacturer; ?></option>
          <?php foreach ($manufacturers as $manufacturer) { ?>
              <?php if ($manufacturer['manufacturer_id'] == $filter_manufacturer_id) { ?>
              <option value="<?php echo $manufacturer['manufacturer_id']; ?>" selected="selected"><?php echo $manufacturer['name'] . ' (' .$manufacturer['products'] . ')'; ?></option>
              <?php } else { ?>
              <option value="<?php echo $manufacturer['manufacturer_id']; ?>"><?php echo $manufacturer['name'] . ' (' .$manufacturer['products'] . ')'; ?></option>

          <?php } ?>
          <?php } ?>
           </select>
          </td>
        </tr>

        <tr>
            <td colspan="4" style="padding-top: 8px;"><?php echo $entry_groups_option; ?></td>
        </tr>
        <tr>
          <td colspan="4">
              <select name="filter_groupsoption" style="width: 155px;" id="filter_groupsoption">
              <option value=""><?php echo $text_groups_option; ?></option>
          <?php foreach ($groupsoption as $option) { ?>
              <?php if ($option['option_id'] == $filter_groupsoption) { ?>
              <option value="<?php echo $option['option_id']; ?>" selected="selected"><?php echo $option['name'] . ' (' . $option['col'] . ')'; ?></option>
              <?php } else { ?>
              <option value="<?php echo $option['option_id']; ?>"><?php echo $option['name'] . ' (' . $option['col'] . ')'; ?></option>

          <?php } ?>
          <?php } ?>
           </select>
          </td>
        </tr>
        <tr>
          <td colspan="4"><?php echo $entry_optionvalue; ?></td>
        </tr>
         <tr>
          <td colspan="4">
          <select name="filter_optionvalue" style="width: 155px;" id="filter_optionvalue">
              <option value=""><?php echo $text_optionvalue; ?></option>
           </select>
          </td>
        </tr>

        <tr>
          <td colspan="4"><?php echo $text_price; ?></td>
        </tr>
        <tr>
          <td align="right"><?php echo $text_pricemin; ?>&nbsp;</td>
          <td><input type="text" size="4" value="<?php echo $filter_pricemin; ?>" id="filter_pricemin" /></td>
    
          <td align="right"><?php echo $text_pricemax; ?>&nbsp;</td>
          <td><input type="text" size="4" value="<?php echo $filter_pricemax; ?>" id="filter_pricemax" /></td>
        </tr>

        <tr>
          <td colspan="4">
                <?php if ($filter_description) { ?>
                    <input type="checkbox" name="filter_description" value="1" id="filter_description" checked="checked" />
                    <?php } else { ?>
                    <input type="checkbox" name="filter_description" value="0" id="filter_description" />
                    <?php } ?>
                    <label for="description"><?php echo $entry_description; ?></label>
          </td>
        </tr>
  <tr>
          <td colspan="4"></td>
        </tr>

        <tr>
            <td align="right" colspan="4">
              <a onclick="contentAdsoptions();" class="button"><span><?php echo $button_search; ?></span></a>

              </td>
        </tr>

      </table>
    </div>
<script language="javascript" type="text/javascript">

          $(document).ready(function () {
             if( $('#box_search #filter_groupsoption').attr('value') !='') {
                 $('select[name=\'filter_optionvalue\']').load('index.php?route=module/adsoptions/optionvalue&groupoption_id=' + $('#box_search #filter_groupsoption').attr('value')+'&filter_optionvalue='+'<?php echo $filter_optionvalue; ?>');
                
               }
          })
</script>
<script language="javascript" type="text/javascript">

          $(document).ready(function () {
           $('select[name=filter_groupsoption]').change(function(){
                  $('select[name=\'filter_optionvalue\']').html("<option value=\"\"><?php echo $text_optionvalue; ?></option>")
                   $('select[name=\'filter_optionvalue\']').load('index.php?route=module/adsoptions/optionvalue&groupoption_id=' + $(this).val());
                })

          })
</script>

<script type="text/javascript"><!--
 $('#box_search input').keydown(function(e) {
  if (e.keyCode == 13) {
    contentAdsoptions();
  }
  });

  function contentAdsoptions() {
  url = 'index.php?route=product/adsoptions';

  var filter_name = $('#box_search #filter_name').attr('value');

  if (filter_name) {
    url += '&filter_name=' + encodeURIComponent(filter_name);
  }

  var filter_category_id = $('#box_search #filter_category_id').attr('value');

  if (filter_category_id) {
    url += '&filter_category_id=' + encodeURIComponent(filter_category_id);
  }

  var filter_sub_category = $('#box_search input[name=\'filter_sub_category\']:checked').attr('value');
  
  if (filter_sub_category) {
    url += '&filter_sub_category=true';
  }

  if ($('#box_search #filter_description').attr('checked')) {
    url += '&filter_description=1';
  }

  if ($('#box_search #model').attr('checked')) {
    url += '&model=1';
  }

       var filter_manufacturer_id = $('#box_search #filter_manufacturer_id').attr('value');

  if (filter_manufacturer_id) {
    url += '&filter_manufacturer_id=' + encodeURIComponent(filter_manufacturer_id);
  }

      var filter_pricemin = $('#box_search #filter_pricemin').attr('value');

  if (filter_pricemin) {
    url += '&filter_pricemin=' + encodeURIComponent(filter_pricemin);
  }

       var filter_pricemax = $('#box_search #filter_pricemax').attr('value');

  if (filter_pricemax) {
    url += '&filter_pricemax=' + encodeURIComponent(filter_pricemax);
  }

       var filter_groupsoption = $('#box_search #filter_groupsoption').attr('value');

  if (filter_groupsoption) {
    url += '&filter_groupsoption=' + encodeURIComponent(filter_groupsoption);
  }

       var filter_optionvalue = $('#box_search #filter_optionvalue').attr('value');

  if (filter_optionvalue) {
    url += '&filter_optionvalue=' + encodeURIComponent(filter_optionvalue);
  }

  location = url;
}
//--></script>

</div>

Can you help me?

  • This reply was modified 4389 days ago by  gurden.
  • This reply was modified 4389 days ago by  gurden.
 gurden
April 23, 2012 at 9:21 pm #8265
You will need to register in order to post topics and read replies in the ThemeBurn.com support forums!
April 24, 2012 at 11:00 am #8292

You’re a genius!

Everything works very good!!

Thanks a lot!!

 gurden
April 24, 2012 at 8:11 pm #8311

Thanks, mate :)

April 26, 2012 at 10:41 am #8340

Can you help me with this module and Shopica 2 ?

 gurden
May 24, 2012 at 9:42 pm #9330

Hi,

The same technique should work with Shoppica 2 too.

Best,
ThemeBurn team

May 28, 2012 at 2:30 pm #9421
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.