tdr170 Posted January 28, 2016 Share Posted January 28, 2016 (edited) So I have a theme I created and I want to add some additional folders like the mail/en folder, I have modified the contact.html to include Name & Phone numer. Additionally I have modified the contactcontroller.php inside the controllers/front folder. I added a mails/en/contact.html and contact.txt with the code to be filled by the controller. I added controllers/front/contactcontroller.php that has the modified code. I also added the fields to the contact-form.tpl file in the themes folder. Additionally I added a modules folder with additional modules I find very useful such as Newsletter, Giftcard, Slide Captcha & html box. This is all from a working shop and all the code works perfect and allows customer/non-customers to add a name & phone number to the contact page in the front when sending an email to us. So I added those folders zipped it all, when I install the theme everything is fine works perfectly. The Front Office is Perfect, the additional modules are in the modules folder however the Controller and the Mail are not uploaded to thier folders. Is this just not possible does the import only add to the themes and modules folders, or am I missing some detail. Thanks. Edited January 28, 2016 by tdr170 (see edit history) Link to comment Share on other sites More sharing options...
endriu107 Posted January 29, 2016 Share Posted January 29, 2016 Controller and the Mail are not uploaded to thier folders. Hi, if I understand you have zip with: -themes -modules -controller -mails am I correct? Link to comment Share on other sites More sharing options...
tdr170 Posted January 30, 2016 Author Share Posted January 30, 2016 That is correct I want to update one mail and the contact controller with the theme as I added Name & Phone to the contact form. Because the contact form is part of the theme the extra fields are displayed in the contact form but the controller and email are not updated to except the new info. This works in my 1.6.1.4 test site that I created the theme with but not the 1.6.1.4 demo site I created to test the theme. After importing the theme I checked both all 3 files none are updated. I suspect it has something to do with the config.xml file for the theme but have no idea how to update for the extra folders or if it is even possible. Its like this Themes/msrp-responsive modules/all I added mails/en/contact.html & contact.txt controllers/front/contactcontroller.php Link to comment Share on other sites More sharing options...
endriu107 Posted January 30, 2016 Share Posted January 30, 2016 I think it should be: Zip file: -Themes --msrp-responsive ---mails/en/contact.html & contact.txt -Modules --module_name ---override ----controllers/front/contactcontroller.php Link to comment Share on other sites More sharing options...
tdr170 Posted January 30, 2016 Author Share Posted January 30, 2016 Not sure I get what your saying but here another way to look at it if you export a theme and include modules such as the slidecaptcha and htmlbox I have on the site I created the theme with when you unzip the files this is the structure. Unzipped theme folder structure. So I figured if I added the other folder it would upload them when I imported the theme, but it does not. Unzipped theme folder structure with added folders. Now even if I don't add the modules during theme export I can still add the modules folder and it will upload the modules. Link to comment Share on other sites More sharing options...
endriu107 Posted January 30, 2016 Share Posted January 30, 2016 Folder mail should be in theme folder, and override should be in some module folder, because only module can override file. Link to comment Share on other sites More sharing options...
tdr170 Posted January 30, 2016 Author Share Posted January 30, 2016 The mails are in the root not in the themes folder and there is no override just an updated controller file. If you look in a theme folder there is no mails folder and as for overrides you can override just about any file. an example of this is when I used to use the old captcha (jumbled words) I had a contactcontroller override and that was in the root override folder. Link to comment Share on other sites More sharing options...
endriu107 Posted January 30, 2016 Share Posted January 30, 2016 root folder should contains only themes and modules folders. Any other files should be in those two folders. Mails should be in themes folder and override files should be in module, you cant do this other way. Link to comment Share on other sites More sharing options...
tdr170 Posted January 30, 2016 Author Share Posted January 30, 2016 Mails can not go in the themes folder they will not be used by Prestashops send mail function as it calls for /mails/yourlanguage I'm sorry but overrides must go in the overrides folder, never heard of putting overrides inside modules or modules folder. Also I am not sure why you keep bringing up overrides as I do not have any overrides, not trying to override anything. I do appreciate your time however I do not think we are thinking in the same direction. Link to comment Share on other sites More sharing options...
endriu107 Posted January 30, 2016 Share Posted January 30, 2016 I think you don't know how override works. If you want override mails you should put override files to theme directory like default-bootstrap/mails/en/, if you want override controllers you should put files to override/controllers/ If you want put override controller file to wright direction you should do this like other modules do, when module is installed file from module/modulename/override/controllers/front go to public_html/override/controllers/front and this is wright way to do this. You can see it for example in onepagecheckout module. If you put to zip root directory folders like controllers or mail, themes installator didnt know what to do with them. Link to comment Share on other sites More sharing options...
tdr170 Posted January 30, 2016 Author Share Posted January 30, 2016 OK I am no expert when it comes to overrides but I do know they go in the overrides folder. So I guess you slap me in the ass and call me honey LOL, as a test I put the mails in the theme directory and updated the contact-form.tpl to include the Name & Phone # fields. Sent myself a mail and sure enough the mail came through with the Name and Phone fields they were not populated as the contactcontroller does not have the updates to fill these fields. I checked and double checked the contact.html file in the root mails folder to make sure I was seeing what I was seeing. I then changed the mail in the themes directory by removing the shadow border sent another mail and it was correct file from themes folder. I had no idea this would work and never read one discussion about it so what do I say now but THANKS. So now I took the contactcontroller and placed it in the overrides changed the head to below not sure I had to do this but it what I have seen in the past. Deleted the class-index.php from the cache folder. Changed this: <?php class ContactControllerCore extends FrontController { To this: <?php class ContactController extends ContactControllerCore { Sent another mail and this time all the fields were populated with name and phone # so all is working. Now how do I get the override file to the overrides folder with the theme, I will test while I wait for a response. Will an included override folder be seen or disregarded. Link to comment Share on other sites More sharing options...
tdr170 Posted January 31, 2016 Author Share Posted January 31, 2016 OK my friend I have figured this out or at least I think I did. So as you said I added the mails to the theme I added the name and phone # the contact form. Now what I did was use Prestahops module generator and created a generic module, listed it in Front office features Gave it a module name of mailcontroller and display name as Mail Controller added some info Adds the function to contact form to collect customer name & phone # Gave the option to confirm uninstall and the message Uninstall will remove the ability to collect name & phone # from contact form Said no to database tables Created the module I then added the overrides folder with the contact controller Loaded the module went to back office and installed, it took me to a configuration page with no real cofiguration. But good for now so now I looked in the root overide/controllers/front and there it was the contactcontroller overide. So now I do not need a config page in BO so I looked at the mailcontroller.php created with the module and set configuration to 0 but on install still got the configuration page. Now I took another look at the file and just removed all the code for the configuration page, now when you install you get no config page just the disable button along with the usual menu drop down. The overide is loaded and the contact form works perfect and populates the contact mail with name and phone # Another nice thing about doing it this way and not just loading the overide to the overide folder is mo need to delete the class-index.php. Does this sound as if I have this figured out to you or is there some additional info you can offer. Now I will export the the theme with the Mail Controller module installed this way the config.xml file with the theme will install by default. I have to thank you again even though I was stuborn and just kinda did not get it it was your help that got this done. Your talk obout overides in modules is what got me thinking about just creating a modu,e to the load the contactcontroller overide. I actually learned alot and am very greatful you took the time to write back. So once again THANK YOU!!! . 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