Venky967
Members-
Posts
23 -
Joined
-
Last visited
Venky967's Achievements
Newbie (1/14)
1
Reputation
-
Can you please share your code so that I can know where you got wrong
-
After upgrading to 1.7 , Can you see your module inside root/modules folder?
-
In order to create a database table I have a function like this public function installDb() { return (Db::getInstance()->execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'sampletable` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `password` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `TRANSUNION_CONFIGURE_DETAILS_USERNAME` (`username`) ) ENGINE = '._MYSQL_ENGINE_.' CHARACTER SET utf8 COLLATE utf8_general_ci;')); } By doing this ,after my module installation a single table named "sampletable" is created.Now I want multiple tables to be created.How to achieve it? Thank you.
-
Yeah I'm using The same.
-
<?php class YourModule extends Module { //tabs to be created in the backoffice menu protected $tabs = [ [ 'name' => 'Tab Creation', 'className' => 'tabcreation', 'active' => 1, //submenus 'childs' => [ [ 'active' => 1, 'name' => 'Tab1', 'className' => 'tab1', ], ], ], ]; //add a tab in the backoffice menu public function addTab( $tabs, $id_parent = 0 ) { foreach ($tabs as $tab) { $tabModel = new Tab(); $tabModel->module = $this->name; $tabModel->active = $tab['active']; $tabModel->class_name = $tab['className']; $tabModel->id_parent = $id_parent; //tab text in each language foreach (Language::getLanguages(true) as $lang) { $tabModel->name[$lang['id_lang']] = $tab['name']; } $tabModel->add(); //submenus of the tab if (isset($tab['childs']) && is_array($tab['childs'])) { $this->addTab($tab['childs'], Tab::getIdFromClassName($tab['className'])); } } return true; } //remove a tab and its childrens from the backoffice menu public function removeTab($tabs) { foreach ($tabs as $tab) { $id_tab = (int) Tab::getIdFromClassName($tab["className"]); if ($id_tab) { $tabModel = new Tab($id_tab); $tabModel->delete(); } if (isset($tab["childs"]) && is_array($tab["childs"])) { $this->removeTab($tab["childs"]); } } return true; } public function install() { //module installation $success = parent::install(); //if the installation fails, return error if (!$success) { return false; } //create the tabs in the backoffice menu $this->addTab($this->tabs); return true; } public function uninstall(){ $this->removeTab($this->tabs); return parent::uninstall(); } } It will be solved.
-
Display same form even after form submission
Venky967 replied to Venky967's topic in Core developers
My password is in encryption form inside the database.So even after retrieving from the database the value is not displayed. -
Display same form even after form submission
Venky967 replied to Venky967's topic in Core developers
Here what does MYMODULE_ACCOUNT_PASSWORD refers to? -
Display same form even after form submission
Venky967 replied to Venky967's topic in Core developers
public function renderForm() { $helper->tpl_vars = array( fields_value' => $this->getConfigFieldsValues() ); $fields_form = array( 'input' => array( array( 'type' => 'password', 'label' => $this->l('PASSWORD'), 'name' => 'password', 'size' => 50, 'class' => 'fixed-width-xl', 'required' => true, 'desc' => $this->l('Please enter your password.') ) ); return $helper->generateForm(array( $fields_form )); } public function getConfigFieldsValues() { $password = Tools::getValue('password'); /*Getting the input field value */ $fields_values = array( 'password' => $password ); return $fields_values; } I am getting the value of $password variable but it is not getting displayed inside the input field.In other case,if I change the input type from password to text then it is dispalyed So I think there is a problem with type password while displaying. Thank you. -
Display same form even after form submission
Venky967 replied to Venky967's topic in Core developers
That's great Balzo Everything is working fine except the password value.I'm unable to show its value in input text field. Help me in getting the password value. Thanks. -
Display same form even after form submission
Venky967 replied to Venky967's topic in Core developers
Inside my main php file , I wrote the form using renderForm function. Let me elaborate what I have done till now. Example: Inside mymodule.php (my main file) class mymodule extends Module { /*variables assigned*/ public function __construct() { /* some content*/ } public function renderForm() { $helper = new HelperForm(); $fields_form = array( 'form' => array( 'legend' => array( 'title' => $this->l('Page Title'), 'icon' => 'icon-cogs' ), 'description' => $form_desc, 'input' => array( array( 'type' => 'select', 'label' => $this->l('Select An Option'), 'name' => 'optionvalue', 'required' => true, 'options' => array( 'query' => $options, 'id' => 'id_desc', 'name' => 'name' ) ), array( 'type' => 'text', 'label' => $this->l('Username'), 'name' => 'username', 'size' => 50, 'class' => 'fixed-width-xxl', 'required' => true, 'desc' => $this->l('Please enter your username.') ), array( 'type' => 'password', 'label' => $this->l('PASSWORD'), 'name' => 'password', 'size' => 50, 'class' => 'fixed-width-xl', 'required' => true, 'desc' => $this->l('Please enter your password.') ), 'submit' => array( 'name' => 'submit', 'title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'btn btn-default pull-right' ); return $helper->generateForm(array( $fields_form )); } This is what my main file looks like.So after configuring my module it displays the form with Select option,input text field,password and a Save button. NO issues with database insertion.It's working really nice All I need is after submitting the form,the values I have entered must be displayed inside their respective input fields after form gets submitted. I have no idea how to use smarty ,where should we add those files Help me to achieve it. -
How to display a button in Prestashop back office orders page?
Venky967 replied to Venky967's topic in Core developers
Thank you very much for your patience. Can you please help me how to add dynamically the files in ROOT_DIRECTORY/override/ folder by installing my custom module. So what changes should i do in my custom module to get this. -
How to display a button in Prestashop back office orders page?
Venky967 replied to Venky967's topic in Core developers
Thanks Balzo you are right.. But I don't want to alter any files in prestashop root directory. Everthing must be affected dynamically from my custom module. -
How to display a button in Prestashop back office orders page?
Venky967 replied to Venky967's topic in Core developers
Cache is in disabled mode only. Any modifications to be done in main file or controller file? Thanks. -
How to display a button in Prestashop back office orders page?
Venky967 replied to Venky967's topic in Core developers
Thank you Did the same thing you asked but didn't see any changes in the orders page. Things I have done: 1. Copied the file from ADMIN_DIRECTORY/themes/default/template/controllers/orders/helpers/view/ and pasted in my module .../view/ (folder). 2. Created anchor tag next to edit in shipping address block. 3. Reinstalled my module and clicked on orders tab. But found no change. Do we need to call this view.tpl from any function?