| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
HTML Form within Description | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
HTML Form within Description
Hi...
I have a product on a site (not finished) that needs a php form put in. I have put the form into the detailed description of the item...easy enough, right? Here is the link to view the form. I tell the form to post to the php handler, but when you hit submit...it just takes you to your cart. Weird. I know that I have the error and success pages put in the correct place. Oh and the email does not send, either. Can someone review my code and tell me what I am doing wrong? Is there a possibility that I cannot even do this in Xcart? Here is the HTML form, within the detailed description: Code:
And here is the PHP handler...put in the proper place. Code:
I would really really appreciate the help. I am kind of new to this and I have been working on it all day!
__________________
bracediscountstore.com xgart gold 4.0.12 fancy categories 4.0.12 |
|||||||
#2
|
|||||||
|
|||||||
Alright...I figured out what it is. The 'add to cart' button on the product detail page uses the "submit" action. The fix that worked for me was kind of a workaround on the 'add to cart button'. I did this by disabling certain functions based on the weight of the product. Obviously, a quote doesn't weigh anything, so disabling a function would happen by wrapping conditional 'if' tags around functions:
Code:
Since the quote has a weight of less than 0.05, it will not show "Insert Any Function" You Can See it in action Here In brief here are the steps. -Create The Form -Put the form into your detailed description -Create your php handler -Create a 'form sent' page (optional) -Create a 'form error' page (optional) -In customer/main/product.tpl, Disable functions you don't want by wrapping 'if' statements around those functions, as shown above You also want to modify customer/main/products.tpl to remove the 'enter your price' label and make it redirect you to the product info page. Don't forget to edit $lbl_enter_your_price to say "get a quote" or something similar. Or you can just create a new label. I know that a lot of people have wanted a mod like this, so I am working on a how-to right now.
__________________
bracediscountstore.com xgart gold 4.0.12 fancy categories 4.0.12 |
|||||||
#3
|
|||||||
|
|||||||
Step 1: Create The Form
Here is a sample, with email, firstname, lastname, quantity desired, and 3 checkbox fields: (don't forget to change your form location!) Code:
Now Put that Form in your detailed description. Next, we will create the php form handler...be sure to change all of te email addresses and website locations: (credits for this are in the code) Code:
Now create your sent.html and error.html pages and upload them into the correct location. Now we will disable the functions we don't want on the product page in customer/main/product.tpl. For example, since I don't want the entire quantity section, i would replace this- Code:
with this: (in line 2 I added {if $product.weight gt "0.05"} and I closed the code block with {/if}) Code:
REMEMBER!!! Your product weight must be less than 0.05 for this to work. This way...your 'quote' product has a zero weight, taking out the things you don't want, while leaving the products with a weight of 0.05 or more to have all of the things that you take out with the 'if' statements. Using the previous step, take out all of the other parts that you don't want to show for the 'quote' product. Be sure to put an 'if' statement around the 'add to cart' button, or else you won't be able to use the submit button in your form. NEXT- we are going to modify the category product listing page in customer/main/products.tpl so that we get a 'receive a quote now' message instead of 'Enter Your Price' since the price is $0. We will also make this link to the product details instead of adding it to your cart. Open customer/main/products.tpl and change this: Code:
to this: Code:
I believe that that is it! I know that this will not work for everyone's application, but it works like a charm for me. Yay...my first custom mod tutorial completed! -Steveo
__________________
bracediscountstore.com xgart gold 4.0.12 fancy categories 4.0.12 |
|||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|