Keyword

[SOLVED] Front-End Add Item Form Problem

  • Indrit
  • Indrit's Avatar Topic Author
  • Offline
  • New Member
More
10 years 8 months ago #124267 by Indrit
Hello folks,

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
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #124268 by Yiota
Replied by Yiota on topic Re: Front-End Add Item Form Problem
Hello,

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
  • Indrit's Avatar Topic Author
  • Offline
  • New Member
More
10 years 8 months ago #124269 by Indrit
Replied by Indrit on topic Re: Front-End Add Item Form Problem
Hello Yiota,

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.

More
10 years 8 months ago - 10 years 8 months ago #124270 by Lefteris
Replied by Lefteris on topic Re: Front-End Add Item Form Problem
I'm sorry I haven't mentioned a backup in order not to lose your changes.

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

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Indrit
  • Indrit's Avatar Topic Author
  • Offline
  • New Member
More
10 years 8 months ago #124271 by Indrit
Replied by Indrit on topic Re: Front-End Add Item Form Problem
Hey, don't worry about the back-up, acctually it wasn't ur obligation!

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
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #124272 by Yiota
Replied by Yiota on topic Re: Front-End Add Item Form Problem
1) It is not recommended because the modal's functionality is tied to it and once Save or Close you remain in the page you pressed the button. You are not redirected anywhere. However, you can create a menu link pointing to front end editing and keep one for each language. I don't believe that you will have an issue then. Also you will have to remove the class="modal" from all edit/add elements under templates/your_template/html/com_k2/ if you won't be using it after all.

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
  • Indrit's Avatar Topic Author
  • Offline
  • New Member
More
10 years 8 months ago #124273 by Indrit
Replied by Indrit on topic Re: Front-End Add Item Form Problem
Thank you, it was really helpful!

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
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #124274 by Yiota
Replied by Yiota on topic Re: Front-End Add Item Form Problem
The modules have a little different path for the overrides.

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
  • Indrit's Avatar Topic Author
  • Offline
  • New Member
More
10 years 8 months ago #124275 by Indrit
Replied by Indrit on topic Re: Front-End Add Item Form Problem
That's really nice from your part!
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
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #124276 by Yiota
Replied by Yiota on topic Re: Front-End Add Item Form Problem
You can make a copy of the k2.css file from its current location in the component to templates/your_template/css/ folder path.
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.


Powered by Kunena Forum