jaymz77 Posted December 15, 2007 Posted December 15, 2007 I was wondering if anybody knows of a contibution that I could put on the product_info page that would be a form the customer could fill out and submit to request more information? I am building a site for RV's and we do not post our pricing so we would lke to have the customer fill out a short form, Name, phone number etc.. to request stuff like price and any other questio they might have. I wish I was a better php'r cause I am sure forms are not that bad, the only "tough part" would be to grab info from a field and automaticly input that into the form. here is our current site for a example, www.rnrrv.com. Thanks in advance. James ps I have searched up and donw the contributions and the forum with no luck :(
Guest Posted December 15, 2007 Posted December 15, 2007 u should take a look at the contact_us.php to get a rough idea of wat a contact form looks like in php. then copy and paste the code you need to the page you need it on.
jaymz77 Posted December 15, 2007 Author Posted December 15, 2007 I did kinda try that but with no luck :( but i did manage to find a contribution and it will work but I have come accross a new delema... I am using "Product Extra Fields" and love it but I cannot seem to get the fields I added to show in the new contribution.. If I post the code would someone help out?
jaymz77 Posted December 15, 2007 Author Posted December 15, 2007 Well here is the code.. I would surly appreciate anyones help :) product_info.php, // START: Extra Fields Contribution v2.0i with fix list($products_id_clean) = split('{', $product_info['products_id']); $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value ,pef.products_extra_fields_status as status FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=".$products_id_clean." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) // show only enabled extra field continue; echo '<tr> <td> <table border="0" width="50%" cellspacing="0" cellpadding="2px"><tr> <td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>'; echo '<font size="1" color="#666666">' .$extra_fields['value'].'<BR></font> </tr> </table> </td> </tr>'; } // END: Extra Fields Contribution This the file that loads the info, <?php /* $Id: request-product-info.php,v 1.0 by Jack_mcs @ [email protected] osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_REQUEST_PRODUCT_INFO); if (isset($HTTP_GET_VARS['productList'])) $productList = unserialize($HTTP_GET_VARS['productList']); else if (isset($HTTP_GET_VARS['products_id'])) $productList[] = $HTTP_GET_VARS['products_id']; else if (isset($_POST['productList'])) $productList = unserialize($_POST['productList']); if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) { $name = tep_db_prepare_input($HTTP_POST_VARS['name']); $phone = tep_db_prepare_input($HTTP_POST_VARS['phone']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']); $home = tep_db_prepare_input($HTTP_POST_VARS['home_address']); $comment = tep_db_prepare_input($HTTP_POST_VARS['comments']); $pID = tep_db_prepare_input($HTTP_POST_VARS['pID']); $error = false; if (! tep_not_null($name)) { $messageStack->add('request_info', ENTRY_NAME_ERROR); $error = true; } if (! tep_not_null($phone)) { $messageStack->add('request_info', ENTRY_PHONE_ERROR); $error = true; } if (! tep_not_null($home)) { $messageStack->add('request_info', ENTRY_HOME_ERROR); $error = true; } if (! tep_validate_email($email_address)) { $messageStack->add('request_info', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); $error = true; } if ($error == false) { $products = TEXT_PRODUCT_COLUMNS; for ($i = 0; $i < count($productList); ++$i) { $product_info_query = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$productList[$i] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); $products .= $product_info['products_id'] . "\t" . $product_info['products_name'] . "\n"; } $msg = sprintf(EMAIL_MESSAGE, $name, $products, $name, $phone, $email_address, $home, $comment); tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $msg, $name, $email_address); tep_redirect(tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, 'action=success')); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_REQUEST_PRODUCT_INFO)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('request_info', tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php if ($messageStack->size('request_info') > 0) { ?> <tr> <td><?php echo $messageStack->output('request_info'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) { ?> <tr> <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_SUCCESS; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } else { ?> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo ENTRY_NAME; ?></td> </tr> <tr> <td class="main"><?php echo tep_draw_input_field('name'); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_PHONE; ?></td> </tr> <tr> <td class="main"><?php echo tep_draw_input_field('phone'); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_EMAIL; ?></td> </tr> <tr> <td class="main"><?php echo tep_draw_input_field('email'); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_HOME_ADDRESS; ?></td> </tr> <tr> <td><table border="1" width="40%"> <tr> <td class="main"><?php echo tep_draw_textarea_field('home_address', 'soft', 2, 5); ?></td> </tr> </table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCT_INFO; ?></td> </tr> <?php for ($i = 0; $i < count($productList); ++$i) { $product_info_query = tep_db_query("select pd.products_name, pd.products_description, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$productList[$i] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); ?> <tr> <td><table border="1" cellpadding="0"> <tr> <td class="main" width="15%" style="font-weight: bold;" valign="top"><?php echo TEXT_PRODUCT_NAME; ?></td> <td class="main"><?php echo $product_info['products_name']; ?></td> </tr> <tr> <td class="main" style="font-weight: bold;" valign="top"><?php echo TEXT_PRODUCT_DESC; ?></td> <td class="main"><?php echo $product_info['products_description']; ?></td> </tr> <tr> <td class="main" style="font-weight: bold;" valign="top"><?php echo TEXT_PRODUCT_PRICE; ?></td> <td class="main"><?php echo $extra_fields['name']; ?></td> </tr> </table></td> </tr> <tr><td height="10"></td></tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_COMMENTS; ?></td> </tr> <tr> <td><table border="1" width="100%"> <tr> <td><?php echo tep_draw_textarea_field('comments', 'soft', 200, 10); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1') . tep_draw_hidden_field('productList', serialize($productList)); ?> </td> <td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.