Fuel4mind Posted August 3, 2014 Share Posted August 3, 2014 Hi , i would like to develop a module that would help the user filter the products by the available features So , for example , if i have a product " Hard disk Samsung " , with the features 7200RPM , Samsung , 500GB and 8 MB Cache , i would like these features to appear on the left side. This would apply for all the available products in the database , so if i would click the feature " samsung " it would retrieve all the available Samsung products. Could someone give me a little guidance to how i could achieve this ? Any help would be greatly appreciated. I'm pretty sure there are already modules availble to achieve this , but i would like to develop my own module if possible. I'm sorry if i posted in the wrong section. Link to comment Share on other sites More sharing options...
NemoPS Posted August 4, 2014 Share Posted August 4, 2014 Prestashop already comes with this feature The module is called Layered Navigation 1 Link to comment Share on other sites More sharing options...
Fuel4mind Posted August 14, 2014 Author Share Posted August 14, 2014 Hello again , i'm trying to display the result of a sql querry in a tpl file , but i get the error Parse error: syntax error, unexpected ''results'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in D:\XAMPP\htdocs\prestashop\modules\mymodule\mymodule.php on line 72 i followed the tutorial from here http://doc.prestashop.com/display/PS16/Creating+a+PrestaShop+Module mymodule.php public function hookDisplayLeftColumn($params) { $result = Db::getInstance()->executeS('SELECT * FROM ps_category where id_category = 1 '); if(!$result) return "error"; $results = array(); foreach ($result as $results){ array_push($results, array( 'id_category' => $results['id_category'] )); } $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display') 'results' => $results ) ); return $this->display(__FILE__, 'mymodule.tpl'); } public function hookDisplayRightColumn($params) { return $this->hookDisplayLeftColumn($params); } public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/mymodule.css', 'all'); } mymodule.tpl <!-- Block mymodule --> <div id="mymodule_block_home" class="block"> <h4>Configurator</h4> <div class="block_content"> <p>Hello, {if isset($my_module_name) && $my_module_name} {$my_module_name} {else} World {/if} ! </p> <ul> <li><a href="{$my_module_link}" title="">Click Me!</a></li> </ul> </div> </div> <!-- /Block mymodule --> display.php <?php class mymoduledisplayModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); $this->setTemplate('display.tpl'); } } display.tpl asdf what i am trying to do is print the results of $results variable (which should contain the querry result) into display.tpl using Smarty display.tpl {results} but i get the error message that i posted above. Any help would be greatly appreciated I didn't create a new topic , i hope this is good practice on the forum Link to comment Share on other sites More sharing options...
NemoPS Posted August 15, 2014 Share Posted August 15, 2014 Missing comma here, after the second element $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display') 'results' => $results ) ); Link to comment Share on other sites More sharing options...
Recommended Posts