Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Add To Button And On Click Open Form In Modal Window Rate Topic   - - - - -

 
  • eweig
  • Member
  • Trial users
  • Join Date: 30-Jan 18
  • 39 posts

Posted 08 February 2019 - 01:01 AM #1

I have added a form to cs-cart that captures some user data and emails it back to me.

 

Now I want to add a button that opens a modal window with the form I created inside.  I added the following button, but what goes on the "but_onclick" to open the modal window with my form?

{include file="buttons/button.tpl" but_name="" but_text="Enter Extra Data" but_onclick="" but_role="button" but_meta="cm-process-items btn"}


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 18798 posts

Posted 08 February 2019 - 06:02 AM #2

Try something like

{include file="common/popupbox.tpl" id="my_form" link_meta="ty-btn__primary" href="pages.view?page_id=123" link_text=__('my_form_button_text') text=__('my_form_header')}

replace 123  with the page ID (can be found in the admin panel) and add "my_form_button_text" and "my_form_header" language variables

 

(!) Not tested


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • eweig
  • Member
  • Trial users
  • Join Date: 30-Jan 18
  • 39 posts

Posted 08 February 2019 - 03:47 PM #3

Thank you, this helped.   Initially, your code didn't work, but it needed the action.   I used act="general".

 

So my working code is:

{include file="common/popupbox.tpl" act="general" id="my_form" link_meta="ty-btn__primary" href="pages.view?page_id=123" link_text=__('my_form_button_text') text=__('my_form_header')}

Your reponse helped me isolate the issue.  I hope this helps someone having the same issue.



 
  • eweig
  • Member
  • Trial users
  • Join Date: 30-Jan 18
  • 39 posts

Posted 08 February 2019 - 05:26 PM #4

Another question.

 

The form opens up in the modal window, but when I hit submit it redirects to a thank you page.  How could I change it to give me the thank you message inside the modal window after form is submitted?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 18798 posts

Posted 11 February 2019 - 05:53 AM #5

Thank you, this helped.   Initially, your code didn't work, but it needed the action.   I used act="general".

 

So my working code is:

{include file="common/popupbox.tpl" act="general" id="my_form" link_meta="ty-btn__primary" href="pages.view?page_id=123" link_text=__('my_form_button_text') text=__('my_form_header')}

Your reponse helped me isolate the issue.  I hope this helps someone having the same issue.

 

Act is not required since it is not used in the popupbox.tpl template. At least in the default theme

 

 

Another question.

 

The form opens up in the modal window, but when I hit submit it redirects to a thank you page.  How could I change it to give me the thank you message inside the modal window after form is submitted?

 

More complex changes are required in this case. You should post form with ajax and put thank you message to notification


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.