Zen Cart Logo
Forums / General Questions / Custom Email Form in Product Description

Custom Email Form in Product Description

Views: 618

Results 1 to 4 of 4
12 Apr 2015, 3:49 PM
#1
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Custom Email Form in Product Description

I am trying to create a customer-selectable package deal. Basically the customer can configure their own package deal and send it as an email. So basically, I need to have a radio button and text box form within the product description:

<div itemprop="description" id="productDescription" class="productGeneral biggerText"> 
</div>

I have tried few custom email forms; however, since they contain php code above the HTML, when I save all of it in the product description, it shows all the PHP code as well as html, rendering it unusable.

Sample HTML Form that I have tried:

<?php

if($_POST["submit"]) {
    $recipient="[email protected]";
    $subject="Form to email message";
    $sender=$_POST["sender"];
    $senderEmail=$_POST["senderEmail"];
    $message=$_POST["message"];

    $mailBody="Name: $sender\nEmail: $senderEmail\n\n$message";

    mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>");

    $thankYou="<p>Thank you! Your message has been sent.</p>";
}

?><!DOCTYPE html>




    <?=$thankYou ?>

    <form method="post" action="contact.php">
        <label>Name:</label>
        <input name="sender">

        <label>Email address:</label>
        <input name="senderEmail">

        <label>Message:</label>
        <textarea rows="5" cols="20" name="message"></textarea>

        <input type="submit" name="submit">
    </form>
12 Apr 2015, 3:57 PM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,786
Plugin Contributions:
13

Re: Custom Email Form in Product Description

I'm curious as to why you would need to go outside the available processes of ZC to perform this. Even if all the options were up to the customer, couldn't you still use attributes to have them make/select a product?
One of the most hacked items on sites today is the e-mail form.
Perhaps, with a little more information about what you're wanting to do, we can come up with a more secure solution.

12 Apr 2015, 7:42 PM
#3
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Custom Email Form in Product Description

Well...

On my Zencart, I sell some items that cannot be purchased directly through the shopping cart. They basically have to email with the product with their individual needs with that item. Then I talk to them via email or phone afterwards with the specifics and the exact price. This is only for about 5% of the 2000 items I sell. For those items, I have been dealing with a customized 'Ask a Product Question' add-on and it has been working well for individual products.

Now, I have present a package of above products to the customer. To get the idea access, lets just say we are talking about clothing. I sell hats, shirts, pants, and shoes that needs custom specifications. When those are individually sold, I have the add-on customized that they can send me their measurements and then I get back to them with a quote. But for the package deal, I have to present the hats, shirts, pants, and shoes together.

So I need to come up with a product selector. Something similar to this:

So I decided to attack this in 3 steps:

  1. Work on a basic HTML/PHP email form from product info page - (Zencart related, so that's why my op is about this)
  2. Work on a product sector with a custom radio button (broadly HTML/CSS/JQuery related, non Zencart related)
  3. Work on each selection section. (HTML, non Zencart related)
13 Apr 2015, 3:43 AM
#4
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Custom Email Form in Product Description

So far from reading on there, I found out that I can't really have PHP inside category description. So the next choice is add it as a product with attributes? Would I be able to hack the existing attribute div in to something that looks like above?