Martinez066 Posted October 10, 2014 Share Posted October 10, 2014 Hello I wanted to create a simple module that lets me to check the manufacturer of the product, if it is the same as entered in the module that displays additional information for a given product(for example additional image). The module works on the first page of category, as I walk to the next page module variables $our_text,$our_text1 are empty in module i have: public function getContent() { if(Tools::isSubmit('submit_text')) { Configuration::updateValue( $this->name.'_text_to_show', Tools::getValue('the_text') ); Configuration::updateValue( $this->name.'_text_to_show1', Tools::getValue('the_text1') ); $this->_clearCache('fashion.tpl'); } $this->_generateForm(); return $this->_html; } private function _generateForm() { $textToShow=Configuration::get($this->name.'_text_to_show'); $textToShow1=Configuration::get($this->name.'_text_to_show1'); $this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post">'; $this->_html .= '<div class="margin-form">'; $this->_html .= '<input type="text" name="the_text" value="'.$textToShow.'" ><br>'; $this->_html .= '<input type="text" name="the_text1" value="'.$textToShow1.'" ><br>'; $this->_html .= '<input type="submit" name="submit_text" '; $this->_html .= 'value="'.$this->l('Submit').'" class="button" />'; $this->_html .= '</div>'; $this->_html .= '</form>'; } function hookLeftColumn($params) { global $smarty; if (!$this->isCached('fashion.tpl', $this->getCacheId())) $smarty->assign(array( 'our_text' => Configuration::get('_text_to_show'), 'our_text1' => Configuration::get('_text_to_show1'), )); return $this->display(__FILE__, 'fashion.tpl'); } in product-list.tpl i have {if ($product.manufacturer_name == {$our_text})||($product.manufacturer_name == {$our_text1})} <span id="manufacturer"></span> {/if} I'll be grateful for the help Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2014 Share Posted October 12, 2014 you use block layered navigation? Link to comment Share on other sites More sharing options...
Martinez066 Posted October 13, 2014 Author Share Posted October 13, 2014 Yes, Suggesting that this link http://www.prestashop.com/forums/topic/329040-how-to-pass-smarty-variable-in-other-modules-js-file/ In frontcontroller i added $smarty->assign(array( 'our_text' => Configuration::get('_text_to_show'), 'our_text1' => Configuration::get('_text_to_show1') )); and in header.tpl added var our_text = {$our_text};var our_text1 = {$our_text1}; It working but in firebug i see SyntaxError: syntax error var our_text1 = ; I also noticed that I have two types of links generated category on next pages, most category have link #/page-7 and then module doesnt working before changes in frontcontroller and p=24 then module was working. Friendly urls are checked all time 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