+ Reply to Thread
Results 1 to 12 of 12

Thread: Simple Contact form with ReCaptcha

  1. #1
    Client
    Join Date
    Sep 2005
    Posts
    118
    Squirrelcart version
    not specified!

    Simple Contact form with ReCaptcha

    Latest web site enhancement - a simple Contact Form using SC's built-in Recaptcha functionality. Most of this code was ripped out of sc_account.func.php and account_form.tpl.php - so kudo's to the SC folks for making this so easy. The only major drawback is that you must make a change to pre_storefront.php in order to get this to work (more on that later).

    Click here to see what it looks like.

    There are 3 files (which can be downloaded in ZIP from here):
    • contact_form.php.txt - this is the PHP code that you'll insert into a Content page that you create via the control panel - be sure to put the editor in Source Mode.
    • contact_form.tpl.php - this is the template - place it in you theme template directory for example: /squirrelcart/themes/squirrelcart
    • header_contact_us.png - a simple little graphic to use or create your own - this should go in your theme images directory: /squirrelcart/themes/squirrelcart/images

    Changes to pre_storefront.php - first, make a backup copy of this file. Then, using your fav PHP editor, search for sc_page - you should find some code that looks like:
    Code:
    } elseif (is_numeric($_GET['sc_page'])) {
    	
    	// show a Content record as it's own page, via Links record with "Link To" set to "Content"
    	$SC_content['sc_page'] = sc_page_content($_GET['sc_page']);
    Change the 2 $_GET's to $_REQUEST so you have something that looks like:
    Code:
    } elseif (is_numeric($_REQUEST['sc_page'])) {
    	
    	// show a Content record as it's own page, via Links record with "Link To" set to "Content"
    	$SC_content['sc_page'] = sc_page_content($_REQUEST['sc_page']);
    Save and re-upload the pre_storefront.php file to your web server.

    You must enable ReCaptcha on your storefront settings, however, as I'm not about to touch the CP for modifications, you cannot turn just this function on/off for the Contact form like you can with Account/Password/Payment.

    The email, by default is sent to the customer service address specified in your Store settings.

    Usual disclaimers apply; I've tested this on my web site, and it seems to work fine. Your mileage may vary. Void where prohibited by law.
    Enjoy.

  2. #2
    Client
    Join Date
    Nov 2004
    Location
    England
    Posts
    230
    Squirrelcart version
    v2.6.1

    Thanks

    Firstly, thanks very much for posting this.

    It seems to work only I don't seem to get the emails. I have changed the address in the store settings but to no avail.

    Have checked spam folders, etc.

    Any ideas?

  3. #3
    Client
    Join Date
    Sep 2005
    Posts
    118
    Squirrelcart version
    not specified!
    Unfortunately, not a lot of error handling for the 'email()' function - I've converted over to using the sc_email() function provided by the cart - it does a few more things and some additional checks - so maybe it will resolve your problem (in theory, if you can get email from the cart now, you should be able to get email from the contact form).

    There's a new zip file uploaded with the change to the original location.

  4. #4
    Client
    Join Date
    Nov 2004
    Location
    England
    Posts
    230
    Squirrelcart version
    v2.6.1

    Thanks

    Thanks Scott

    Works a treat.
    Thanks for taking the time to post it. I'm sure many people will make use of it.

  5. #5
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    FYI - we are planning a contact module soon. The template names used for this *may* conflict with that module.

  6. #6
    Client
    Join Date
    Sep 2005
    Posts
    118
    Squirrelcart version
    not specified!
    I think you'd be better off with some sort of general purpose 'form' module - so that I could design my own simple form to use on a content page. The form data supplied would get dumped into MySql along with maybe an email message (html format) that had a copy of the information.

    With this, you could also provide a couple of simple templates, such as a contact template.

    The first pass might not be overly complex - just text, text field, maybe checkboxes and/or radio buttons - possibly tie everything into rules so that you can easily create field dependencies.

  7. #7
    Client
    Join Date
    Jan 2007
    Posts
    12
    Squirrelcart version
    not specified!
    Scott,
    I think you hit the nail on the head with that one. I am in the process of creating some custom forms for one of my customers to be included in the frame work and a nice easy frae work would make this much easier. It is still doable...but anything that makes the work flow easier is a happy thing.

    Thanks Jamie for all you do.

    Dawg

  8. #8
    Client
    Join Date
    Feb 2010
    Posts
    19
    Squirrelcart version
    not specified!
    Sorry for bumping this older thread, but I really want a working contact form on my site

    Can anyone reupload the original file? Would be greatly appreciated, since this seems exactly like what I need.

  9. #9
    Client
    Join Date
    Nov 2007
    Posts
    56
    Squirrelcart version
    v3.0.0

    Also looking for contact form....

    Jamie?

    Anybody?

    Is there a contact form for SC 3.2.0?

    Barb

  10. #10
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    We are releasing a contact module alongside the next release of Squirrelcart, which should hopefully be available in a few weeks.

  11. #11
    Client
    Join Date
    Apr 2008
    Posts
    6
    Squirrelcart version
    not specified!
    ANY news on this?
    Quote Originally Posted by Jamie View Post
    We are releasing a contact module alongside the next release of Squirrelcart, which should hopefully be available in a few weeks.
    I really need a contact form.
    Many thanks!
    F'amos

    Developing swell products for swell people... like you!
    www.averyswellidea.com

  12. #12
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    This module is not going to be released until it is finished and v3.3.0 is finished as well. I don't have a release date at this time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts