rassy Posted October 18, 2011 Share Posted October 18, 2011 Hi guys, I would like to extend the blocklayered module by a front-end checkbox "on-sale" which should filter all "on-sale" items.. It would be cool if the original programmer (who is it by the way?) could give me some tipps. Some basic milestones of how to approach this would be really helpfull. How would you guys approach this feature? Thanks for your help Rassy Link to comment Share on other sites More sharing options...
Maxence de Flotte Posted October 18, 2011 Share Posted October 18, 2011 Hi, If I understand correctly you want to add a filter available for order in the block layered? Am I right? In this case, this filter will be quite similar to the "Availability" filter. This one is called "quantity" in the blocklayered code. There is differents parts in the blocklayered to add a new filter. The layout manager This is in the function getContent(). You have to do similar thing to the "quantity" filter. Select filters This is in the function getSelectedFilters(). Filter products This is in the function getProductByFilters(). This is here, where you have to add your SQL request to apply your filter to the whole product collection. Genererate filters displaying (and count product filtered) On the function getFilterBlock() you have to add the request to generate your filter options + there is a php treatment to get your filters options You will have to add the function get[your filter name]FilterSubQuery. This function need to return an array with multiple part of SQL queries. See getQuantityFilterSubQuery. These part query of SQL will be used to apply your filter to the other filters. For example if you select "available for order", only the filters options of product available for order will be visible. This last part is the most difficult, because you have to manage a lot of SQL queries. Do not hesitate to ask me any questions. Best regards, Link to comment Share on other sites More sharing options...
cheganti Posted October 20, 2011 Share Posted October 20, 2011 hi , i am using blocklayered in my shop to filter the products everything is working fine, but the thing is when a user selects a check box and again if he selects another then the previously selected check box should be unselect. is this possible to get my requirement. can anyone help me to do this? Link to comment Share on other sites More sharing options...
Maxence de Flotte Posted October 20, 2011 Share Posted October 20, 2011 Hi Cheganti, I think changing checkbox by radio button could do what you want. For that, you have to edit the template of the module (blocklayered.tpl). For that, you have to replace the option type="checkbox" by type="radio". And play with name attribute. Best regards, Link to comment Share on other sites More sharing options...
rassy Posted October 20, 2011 Author Share Posted October 20, 2011 Hi Max, ok I ran into a problem. How do I make this line here accept the new "on-sale" filter? In debug I can see that the key is "layered_on-sale_on-sale". preg_match('/^(.*)_[0-9|new|used|refurbished|slider]+$/',substr($key, 8, strlen($key) - 8), $res); I've got the previous steps in place... the filter is configured in the db table "layered_category" and is called "on-sale". This is how the filter is configured $conditionArray = array( 'on-sale' => array('name' => $this->l('On Sale'), 'nbr' => 1) ); $filterBlocks[] = array( 'type_lite' => 'on-sale', 'type' => 'on-sale', 'id_key' => 0, 'name' => $this->l('On Sale'), 'values' => $conditionArray); break; 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