- Posts: 7
COMMUNITY FORUM
[SOLVED] Front-End Add Item Form Problem
- Indrit
-
Topic Author
- Offline
- New Member
I have a multilingual site (Greek / English) and i have a problem regarding the front-end K2 add item form. Let's say that i am Greek language and i am adding a new item from front-end form. Clicking on the Save button it insert the item on the DB (no problem with that) but when the page is reloded it change me the language from Greek to English and shows me the English version of the form which is a little bit "creepy" because i don't want my user to get the English version without their desire!
E.G: This is the url before submiting for the first time: index.php/el/component/k2/add?tmpl=component
and this is the url after submition for the first time:
index.php/en/?option=com_k2&view=item&task=edit&cid=52&tmpl=component&Itemid=0
I have to mention that i click "Add new item" from the User module in front-end and the form it is open in a new window. I have set the default front-end language to Greek but the back-end default language is English, is here the problem ?! Any workaround solution i can deal with ?!
P.S: Also i have changes the itemform.php under both of template ( default and custom one i have created which is actually linked to this form) but i see the changes only after i have submited for the first time the item (i mean after clicking Save for first time). Does exist another "itemform.php" that is shown when i add new item from the front-end ?!
Thank you in advance!
Indrit...//
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
First of all your add new item should not open to a new window but in a modal box. I need you to check for any differences between the original itemform.php file located in the components/com_k2/templates/default/ and the one you have changed in templates/your_template/html/com_k2/default folder.
If you are using an older than 2.6.7 version of K2 you should update. Also, if you are using Joomla! 3.2.1 you should update to K2 2.6.8 SVN version located here: getk2.org/assets/get/ for compatibility reasons.
Please Log in or Create an account to join the conversation.
- Indrit
-
Topic Author
- Offline
- New Member
- Posts: 7
Thank you for you really quick response. I really appreciate it!
I just did the update of the K2 (my Jomla! Version is the last one 3.2.1 stable) and all the changes i had made are now restored and this is not good because i need to work again on them but never mind, i can manage it ;)
1- The fact that the Add new item didn't open in a modal mode was because i changed the class from modal to smth alse and i placed also a target="_blank" attribute to the <a> tag. I did that because the modal mode is not responsive (at least i think so, maybe i'm wrong and here is the time to learn it) and i want my add new item form could be responsive. What's ur suggestion about if i dont want to use the modal mode ?!
2- Regarding the differences (that doesn't exist any more after the update) but before that the files where the exactly the same because i did a copy of the default ant paste it to the custom. I have to mention here that i was using the old way of template overrides method, which means that i had my custom template under the /components/com_k2/templates and not the other way. Question: whats the best way to override a template, by duplicate it in the /components/com_k2/templates or in the path u suggested ?!
Looking forward to your reply!
Indrit...//
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
1) You could try the following css additions through your template's css file for the modal to be responsive.
#sbox-window {width:100% !important; max-width:990px; height:auto !important;}
#sbox-window iframe {width:100%;}
2) The best way you can do a template override is described here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
Please Log in or Create an account to join the conversation.
- Indrit
-
Topic Author
- Offline
- New Member
- Posts: 7
1- It's not that much effective this method but anyway. Can u tell me what's the problem of not using the modal mode fow this form and opening it in another window ?! If i change the function that this form us as url (it has to have one, right ?! ) and put the value of the language as staitc (el only for greek because i will dont need english language at all) will this occure any problem and where is this function placed ?!
2- If you can tell me also which are the core files that change everytime an updated version is installed ?! (i can search about that info i think in your site but it will takes me time which i dont have actually so if u provide me this info i will really appreciate it)
3- Thank you for you time :)
Best regards,
Indrit...//
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
2) I think that it is best if you just read the link I sent you (getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates) in order to understand how the template overrides work and what is it that you need to put in your template folder in order not to lose it. A similar thing can be applied for the k2 modules. It won't take you time and you will gain a lot.
Please Log in or Create an account to join the conversation.
- Indrit
-
Topic Author
- Offline
- New Member
- Posts: 7
You mention that i can override module too right. I am trying to override the K2 User module but i am not having the result i would like (i mean it;s not working at all).
I created a folder in templates/my-template/html/mod_k2_user and i pasted there all the files that were under the /modules/com_k2_user. However the changes i have made to the templates/my-template/html/mod_k2_user are not being displayed in the front-end. Am i doing smth wrong ?!
Have a nice evening,
Indrit...//
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
You have to copy only the files that are in the tmpl folder in your template, not all of the mod_k2_user contents.
Please Log in or Create an account to join the conversation.
- Indrit
-
Topic Author
- Offline
- New Member
- Posts: 7
Thank you for your critical information!
But, i have smth last to ask :P
If i edit the k2.css file under the components/com_k2/css will the changes disapear after an update ?! Can i override the k2.css file under the html/com_k2 ?! And where is the link that call k2.css file placed ?!
Thank you so much again and keep the good work on!
Indrit...//
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
That way you can keep all the modification you will make without the pressure of being lost when you make an update.
Please Log in or Create an account to join the conversation.
- Indrit
-
Topic Author
- Offline
- New Member
- Posts: 7
I am still facing the same problem with the modal window. I mean, after clicking the "save" button at Add New Item form it redirect me to the English version of the k2. It happens only with the modal window and the rest of the site is still in Greek language as it should be.
Any workaround solution it would be nice!
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Maybe it will help.
Please Log in or Create an account to join the conversation.
- Indrit
-
Topic Author
- Offline
- New Member
- Posts: 7
Everything is ok. I found the solution by changing a bit the PHP code :)
Thank you guys for your support!
Please Log in or Create an account to join the conversation.
- Robert_ITMan
-
- Offline
- New Member
- Posts: 10
www.ourfingertips.ca - websites developed and managed @ ourfingertips
Let me help you make the most of the technology at our fingertips
Please Log in or Create an account to join the conversation.
- Robert_ITMan
-
- Offline
- New Member
- Posts: 10
Indrit wrote: Everything is ok. I found the solution by changing a bit the PHP code :)
Indrit - please share what you edited in which PHP file(s).
www.ourfingertips.ca - websites developed and managed @ ourfingertips
Let me help you make the most of the technology at our fingertips
Please Log in or Create an account to join the conversation.