Randaal Posted October 25, 2013 Share Posted October 25, 2013 I have found a custom module for Cash on delivery payment and I need it twice for having all payment possibilities I need. So i copied it, changed all names from XYZ to XYY - all files and all data in those files so there is no name XYZ in any document, it al contains the new XYY. It works but if I make any changes in the XYZ module in BO of Prestashop it also makes changes in the XYY module like it was the same copy of the previous one. Any idea on how to make it work separately? Thanks Link to comment Share on other sites More sharing options...
El Patron Posted October 25, 2013 Share Posted October 25, 2013 it most likely that here is a database table, you would need to create a new db table for the 2nd module Link to comment Share on other sites More sharing options...
Randaal Posted October 25, 2013 Author Share Posted October 25, 2013 (edited) I don't know almost anything about coding so that doesn't ring a bell to me. Where do I find a database table or how do I create it? Edit: after some research I may have a clue - do you mean MySQL? Edited October 25, 2013 by Randaal (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted October 25, 2013 Share Posted October 25, 2013 I don't know almost anything about coding so that doesn't ring a bell to me. Where do I find a database table or how do I create it? Edit: after some research I may have a clue - do you mean MySQL? yes, mysql.. Link to comment Share on other sites More sharing options...
Randaal Posted October 25, 2013 Author Share Posted October 25, 2013 OK, so I logged into my database but I have no idea what to edit or add. How do I find out what to create? Link to comment Share on other sites More sharing options...
El Patron Posted October 25, 2013 Share Posted October 25, 2013 in the module, function install..does it init a mysql table? or does it use Configuration::updateValue??? Please know without looking at the module or even knowing what it is... this is all guess work Link to comment Share on other sites More sharing options...
Randaal Posted October 25, 2013 Author Share Posted October 25, 2013 Unfortunately I do not know if it initiates mysql table but here is the already renamed modulehttps://www.dropbox.com/s/yk33wwlxl5bgkt8/cashondeliveryfree.rar Link to comment Share on other sites More sharing options...
El Patron Posted October 25, 2013 Share Posted October 25, 2013 you will need to modify the cloned module to use other mysql and configuration values...not just here but in any file in the module folder. public function install() { if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn') ) return false; if((int)Configuration::get('PS_OS_PREPARATION')) return true; Db::getInstance()->autoExecuteWithNullValues('ps_order_state',$values,'INSERT'); $lastid=Db::getInstance()->Insert_ID(); if($lastid) { Configuration::updateValue('COD_STATE', $lastid, 0, 0 ); $translations=array('cs'=>'V přípravě - dobírka'); $langs=Language::getLanguages(); foreach($langs as $lang) { $name=isset($translations[$lang['iso_code']])?$translations[$lang['iso_code']]:'In preparation - COD'; $values=array( 'id_order_state'=>$lastid, 'id_lang'=>$lang['id_lang'], 'name'=>pSQL($name), 'template'=>pSQL($this->name), ); Db::getInstance()->AutoExecute('ps_order_state_lang',$values,'INSERT'); } } } Link to comment Share on other sites More sharing options...
Randaal Posted October 25, 2013 Author Share Posted October 25, 2013 Well OK, so I've found the part of code you've listed here... Between your replies I am trying to find all informations on how to solve this but nothing seems to help me to find out what exactly I should change. I can't see anything that would suggest the used name or what part I should edit :-( Link to comment Share on other sites More sharing options...
Randaal Posted October 25, 2013 Author Share Posted October 25, 2013 So I've made a little bit of progress here. I found out that both the previous and the renamed module have separate numbers in my database. Is that something obvious or am I closer to solution? I've read an article on how to write own modules so that I can digest as much knowledge as I can and I feel a bit wiser but still cannot make this thing work. Any help is greatly appreciated Link to comment Share on other sites More sharing options...
Randaal Posted October 29, 2013 Author Share Posted October 29, 2013 Help still needed, so if someone could help me with solving the problem, please do so. Thanks in advance Link to comment Share on other sites More sharing options...
Randaal Posted November 5, 2013 Author Share Posted November 5, 2013 Solved :-) Thank you El Patron for your time. Your replies helped me to explain my friend what I need to do and he was able to help thanks to your advise! Link to comment Share on other sites More sharing options...
Recommended Posts