Sean Raviolli Posted March 17, 2013 Share Posted March 17, 2013 Hello Everyone, I'm working on a Presashop store for my online auto parts business. My eBay store is located at: http://goo.gl/ghNEK I want a module (free or paid) to simulate that 'compatibility' part of the mentioned website. Any inights are appreciated. PS: I tried using tags for the thing, but it seems that they are not searchable / configurable. I want something like make/model/year. Thanks! Link to comment Share on other sites More sharing options...
PrestaCoder.com Posted March 17, 2013 Share Posted March 17, 2013 Hi, Did you had a look at layered navigation module? http://www.prestashop.com/blog/en/why-use-faceted-navigation/ It is a default module within Prestashop. As far as for the paid modules, please have a look here: http://addons.prestashop.com/en/40-search-filters-prestashop-modules Link to comment Share on other sites More sharing options...
Presta Ecommerce Posted March 17, 2013 Share Posted March 17, 2013 Hello, Functionality you request can be accomplished with layered navigation module. 1 Link to comment Share on other sites More sharing options...
Sean Raviolli Posted March 18, 2013 Author Share Posted March 18, 2013 Thanks guys, It solved my problem. Mentioning this: http://doc.prestashop.com/display/PS15/Implementing+layered+navigation+in+a+theme Link to comment Share on other sites More sharing options...
mfractal Posted May 31, 2013 Share Posted May 31, 2013 i'd love to hear how you implemented the "by brand / model / year" filtering. Layered navigation does not display categories so building a Audi -> A3 -> 2006 heierarchy of categories for example does not help (since it won't be displayed as a layered navigation option. Link to comment Share on other sites More sharing options...
vekia Posted June 1, 2013 Share Posted June 1, 2013 but you can use Audi / A3 and year as an attributes :-) 1 Link to comment Share on other sites More sharing options...
mfractal Posted June 1, 2013 Share Posted June 1, 2013 @vekia, but layered nav doesn't filter by categories. you're supposed to pick a cagetory and only then it filters by attributes. I'ts kind of counter intuitive Link to comment Share on other sites More sharing options...
Sean Raviolli Posted August 17, 2013 Author Share Posted August 17, 2013 Fixed it finally by a simple script I wrote. http://partsgalaxy.com Link to comment Share on other sites More sharing options...
vekia Posted August 17, 2013 Share Posted August 17, 2013 thanks for information, i checked your website, very nice idea with these dropboxes and submiting form. I've noticed that i've got some problems, sometimes i've got 404 error in ajax query Link to comment Share on other sites More sharing options...
fuskoz Posted August 17, 2013 Share Posted August 17, 2013 I'm also very interested in what you have accomplished Anoush Ravan. I'm not good in programming. Do you mind sharing your knowledge? Thank you in advance. Link to comment Share on other sites More sharing options...
Sean Raviolli Posted August 17, 2013 Author Share Posted August 17, 2013 thanks for information, i checked your website, very nice idea with these dropboxes and submiting form. I've noticed that i've got some problems, sometimes i've got 404 error in ajax query Can you post steps necessary to replicate the problem? Link to comment Share on other sites More sharing options...
Sean Raviolli Posted August 17, 2013 Author Share Posted August 17, 2013 I'm also very interested in what you have accomplished Anoush Ravan. I'm not good in programming. Do you mind sharing your knowledge? Thank you in advance. Yes. Basically, I added a file to handle AJAX requests in blocklayered module: <?php include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); // What mode are we running $myMode = (int)Tools::getValue('mode'); // params $myMake = (int)Tools::getValue('make'); $myModel = (int)Tools::getValue('model'); if ($myMode){ switch ($myMode){ case 4: echo json_encode(getMakes()); break; // Models case 5: echo json_encode(getModels($myMake)); break; // Years: case 6: echo json_encode(getYears($myMake, $myModel)); break; } } return true; /* functions */ // Get all makes by cross joining products table function getMakes(){ $makes = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT al.id_attribute, al.name FROM ps_attribute_group ag JOIN ps_attribute a ON (a.id_attribute_group = ag.id_attribute_group) JOIN ps_attribute_lang al ON (al.id_attribute = a.id_attribute) WHERE ag.id_attribute_group = 4 AND id_lang = 1 ORDER BY al.name DESC '); // No makes is an error if (!$makes) return NULL; return $makes; } // Grab all models based on this make, from products. function getModels($myMake){ if(!is_int($myMake)) return NULL; $models = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT DISTINCT(al.name), al.id_attribute FROM ps_layered_product_attribute lpa1 JOIN ps_layered_product_attribute lpa2 ON (lpa1.id_product = lpa2.id_product) JOIN ps_attribute_lang al ON (lpa2.id_attribute = al.id_attribute ) WHERE lpa1.id_attribute = '.$myMake.' AND lpa2.id_attribute_group = 5 ORDER BY al.name DESC '); // empty if (!$models) return NULL; return $models; } // Grab all the years from this make + model selection function getYears($myMake, $myModel){ if(!is_int($myMake) OR ! is_int($myModel)) return NULL; $years = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT DISTINCT(al.name), al.id_attribute FROM ps_layered_product_attribute lpa1 JOIN ps_layered_product_attribute lpa2 ON (lpa1.id_product = lpa2.id_product) JOIN ps_layered_product_attribute lpa3 ON (lpa2.id_product = lpa3.id_product) JOIN ps_attribute_lang al ON (lpa3.id_attribute = al.id_attribute ) WHERE lpa1.id_attribute = '.$myMake. ' AND lpa1.id_attribute_group =4 AND lpa2.id_attribute = '.$myModel.' AND lpa2.id_attribute_group = 5 AND lpa3.id_attribute_group = 6 ORDER BY al.name DESC '); if(!$years) return NULL; return $years; } Link to comment Share on other sites More sharing options...
Sean Raviolli Posted August 17, 2013 Author Share Posted August 17, 2013 (edited) And this to GENERATE those requests. i modified my blockcategories from my theme, but should be applicable to default module as well: {$showMMY = !($page_name == 'category' || $page_name == 'product')} <!-- straight up JS to make MMY working. --> {if $showMMY } {literal} <script type='text/javascript'> $(document).ready(function() { // make sure we are on the same page if ( $('ul.mmy-selector').length > 0 ){ // Change page's name $('#top-categ').find('span').text('Make, Model, Year Search'); // load the makes initially. $.ajax({ url: '/modules/blocklayered/blocklayered-ajax-r.php', data: {mode: 4}, type: "POST", dataType: "JSON", success: function (makes){$.each (makes, function (){ // Append the option bar $('#make-selector') .append($("<option></option>") .attr("value",this.id_attribute) .text(this.name)); }); $('#make-selector').parent().find('.mmy-loader').hide(); }, }); // Bind event to this one's change attr and fill up the models $(document).on('change', '#make-selector', function(){ $('#model-selector').parent().find('.mmy-loader').show(); // Send another AJAX request with mode 5 (model) and key 4 (make) $.ajax({ url: '/modules/blocklayered/blocklayered-ajax-r.php', data: {mode: 5, make: $('#make-selector').val()}, type: "POST", dataType: "JSON", success: function (models){ // remove previous options rather than nullifier $('#model-selector') .find('option') .remove() .end() .append('<option disabled="disabled" selected="selected">Select...</option>'); $.each (models, function (){ // Append the option bar $('#model-selector') .append($("<option></option>") .attr("value",this.id_attribute) .text(this.name)); }); $('#model-selector').parent().find('.mmy-loader').hide(); }, }); }); // Bind event to model change. pick up years and we're ready to go $(document).on('change', '#model-selector', function(){ $('#year-selector').parent().find('.mmy-loader').show(); // Send another AJAX request with mode 5 (model) and key 4 (make) $.ajax({ url: '/modules/blocklayered/blocklayered-ajax-r.php', data: {mode: 6, make: $('#make-selector').val(), model: $('#model-selector').val()}, type: "POST", dataType: "JSON", success: function (years){ // remove previous options rather than nullifier $('#year-selector') .find('option') .remove() .end() .append('<option disabled="disabled" selected="selected">Select...</option>'); $.each (years, function (){ // Append the option bar $('#year-selector') .append($("<option></option>") .attr("value",this.id_attribute) .text(this.name)); }); $('#year-selector').parent().find('.mmy-loader').hide(); }, }); }); // Bind event to the button $(document).on('click', '#mmy-go', function(){ if ($("#make-selector ")[0].selectedIndex <= 0) { $("#make-selector").prev().css({color:'red'}); return false; } if ($("#model-selector ")[0].selectedIndex <= 0) { $("#model-selector").prev().css({color:'red'}); return false; } if ($("#year-selector ")[0].selectedIndex <= 0) { $("#year-selector").prev().css({color:'red'}); return false; } // Down here everything is fine, we can simply go var searchString = $('#make-selector option:selected').text() + ' ' + $('#model-selector option:selected').text() + ' ' + $('#year-selector option:selected').text() ; // paste it into the search box $('#search_query_top').val(searchString); // hit submit $('#search_query_top').next().click(); }); // End ready and if } }); </script> {/literal} {/if} <!-- Block categories module --> <div id="categories_block_left" class="demo-container block"> <div class="tptn-vertical-mega-menu"> {if $showMMY } <!-- Do the triple level select boxes and a submit button for MMY search --> <ul id="mega-1" class="menu right mmy-selector"> <li> <a href="#"> <label for="make-selector">Make: </label> <select name="make-selector" id="make-selector"> <option disabled="disabled">Select...</option> </select> <img src="{$img_ps_dir}mmy-loader.gif" class="middle mmy-loader" alt="" id="stores_loader" /> </a> </li> <li> <a href="#"> <label for="model-selector">Model: </label> <select name="model-selector" id="model-selector"> <option disabled="disabled">Select Make.</option> </select> <img src="{$img_ps_dir}mmy-loader.gif" class="middle mmy-loader" alt="" id="stores_loader" style="display: none; !important;" /> </a> </a> </li> <li> <a href="#"> <label for="year-selector">Year: </label> <select name="year-selector" id="year-selector"> <option disabled="disabled">Select Make.</option> </select> <img src="{$img_ps_dir}mmy-loader.gif" class="middle mmy-loader" alt="" id="stores_loader" style="display: none; !important;" /> </a> </a> </li> <li> <a href="#"> <button id="mmy-go"> Find my Part</button> </a> </li> </ul> {else} <ul id="mega-1" class="menu right"> {foreach from=$blockCategTree.children item=child name=blockCategTree} {if $smarty.foreach.blockCategTree.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child} {/if} {/foreach} </ul> {/if} </div> </div> <!-- /Block categories module --> Edited August 2, 2020 by Sean Raviolli (see edit history) 1 Link to comment Share on other sites More sharing options...
vekia Posted August 17, 2013 Share Posted August 17, 2013 @Anoush Ravan i tested it once again, on my cable internet connection, now everythig is okay i suppose that problem was with my poor connection i will try once again, and if the problem will occur - i will describe whole process 1 Link to comment Share on other sites More sharing options...
orlovskyy Posted July 28, 2015 Share Posted July 28, 2015 Hello, What is the name that you are added on block layered? Thanks Link to comment Share on other sites More sharing options...
dandumit Posted April 21, 2018 Share Posted April 21, 2018 Anoush Ravan - from where did you got the database for those filters ? Link to comment Share on other sites More sharing options...
Open Presta Posted September 7 Share Posted September 7 see this : https://www.myprestastore.com/downloads/autoparts-module-prestashop/ Link to comment Share on other sites More sharing options...
Nickz Posted September 7 Share Posted September 7 5 hours ago, Open Presta said: see this : https://www.myprestastore.com/downloads/autoparts-module-prestashop/ He asked for it 2018 I don't think that he still needs it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now