langziyang Posted September 2, 2017 Share Posted September 2, 2017 in ps1.7,how to code hookDisplayAdminProductsExtra? this is mine: public function hookDisplayAdminProductsExtra($params) { if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { $id_product = (int)Tools::getValue('id_product'); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'etmustpaid` a LEFT JOIN `' . _DB_PREFIX_ . 'etmustpaid_content` ec ON(a.`id_etmustpaid`=ec.`id_etmustpaid`) WHERE a.`id_product`=' . (int)$id_product); $contents = array(); foreach ($result as $key => $content) { $contents[$content['id_lang']] = $content['content']; } $this->context->smarty->assign(array( 'etmust_paid_product_content' => $contents, 'languages' => Language::getLanguages(true), 'default_language' => (int)Configuration::get('PS_LANG_DEFAULT'), )); return $this->display(__FILE__, 'views/templates/hook/displayAdminProductsExtra.tpl'); } } and this is result: Link to comment Share on other sites More sharing options...
vekia Posted September 2, 2017 Share Posted September 2, 2017 hello what's the problem? i see the module on list of available modules. if you will hit this button: https://i.imgur.com/JLcOWVZ.png you should see the contents from views/templates/hook/displayAdminProductsExtra.tpl Link to comment Share on other sites More sharing options...
langziyang Posted September 5, 2017 Author Share Posted September 5, 2017 hello what's the problem? i see the module on list of available modules. if you will hit this button: https://i.imgur.com/JLcOWVZ.png you should see the contents from views/templates/hook/displayAdminProductsExtra.tpl but,i want display multilang input like this: only is version is ps 1.7 Link to comment Share on other sites More sharing options...
vekia Posted September 6, 2017 Share Posted September 6, 2017 so create such code in your .tpl file or use form helper to build such form: http://doc.prestashop.com/display/PS16/Using+the+Helper+classes (it's for prestashop 1.6 but it is applicable also in 1.7) Link to comment Share on other sites More sharing options...
langziyang Posted September 9, 2017 Author Share Posted September 9, 2017 so create such code in your .tpl file or use form helper to build such form: http://doc.prestashop.com/display/PS16/Using+the+Helper+classes (it's for prestashop 1.6 but it is applicable also in 1.7) you mean code on public function hookDisplayProductExtraContent($params){}? can not do anything on this hook; this is my code: public function hookDisplayProductExtraContent($params) { var_dump('Can do?'); $this->context->smarty->assign(array('id_product' => $params['id_product'])); $helper = new HelperForm(); return $helper->generateForm(array( 'form' => array( 'legend' => array( 'title' => $this->getTranslator()->trans('Sssss'), ), 'input' => array( array( 'type' => 'textarea', 'label' => $this->getTranslator()->trans('test'), 'name' => 'etmust_paid_product_content', ), ), ), )); //return $this->context->smarty->fetch('module:etmustpaid/views/templates/hook/displayProductTabContent.tpl'); /* if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { $id_product = (int)Tools::getValue('id_product'); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'etmustpaid` a LEFT JOIN `' . _DB_PREFIX_ . 'etmustpaid_content` ec ON(a.`id_etmustpaid`=ec.`id_etmustpaid`) WHERE a.`id_product`=' . (int)$id_product); $contents = array(); foreach ($result as $key => $content) { $contents[$content['id_lang']] = $content['content']; } $this->context->smarty->assign(array( 'etmust_paid_product_content' => $contents, 'languages' => Language::getLanguages(true), 'default_language' => (int)Configuration::get('PS_LANG_DEFAULT'), )); return $this->display(__FILE__, 'views/templates/hook/displayAdminProductsExtra.tpl'); } */ } i use more way,buy the page give me always like this: 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