код кривой более, чем полностью, это очевидно. но самостоятельно не удалось разобраться. почему не работает?
страница:
www.novum.sibopt.ru/11412-camelion-lampa-svetodiod...
кнопка: быстрый заказ (любая))
<?php
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
require('includes/application_top.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
include(DIR_WS_LANGUAGES . 'russian/russian_db_error.php');
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && isset($HTTP_POST_VARS['formid']) && isset($HTTP_POST_VARS['products_id']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) {
$error = false;
$name = vam_db_prepare_input($HTTP_POST_VARS['name']);
$phone_num = vam_db_prepare_input($HTTP_POST_VARS['phone']);
$adress_tomsk = vam_db_prepare_input($HTTP_POST_VARS['adress_tomsk']);
$prod_link = vam_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . vam_db_prepare_input($HTTP_POST_VARS['products_id']));
$enquiry = iconv('cp1251','utf-8','Получен заказ на товар: '). '
' . $prod_link . '
'.iconv('cp1251','utf-8','Контактное лицо (имя): ') . $name . '
'.iconv('cp1251','utf-8','Телефон: ') . $phone_num . '
'. iconv('cp1251','utf-8','Адрес в Томске: ') . $adress_tomsk .'
'. iconv('cp1251','utf-8','Сообщение: ') . vam_db_prepare_input($HTTP_POST_VARS['enquiry']);
$actionRecorder = new actionRecorder('ar_contact_us', (vam_session_is_registered('customer_id') ? $customer_id : null), $name);
if (!$actionRecorder->canPerform()) {
$error = true;
$actionRecorder->record(false);
$messageStack->add('contact', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 5)));
}
$product_info_query = vam_db_query("select p.products_id, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_POST_VARS['products_id'] . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
if ($error == false) {
vam_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, iconv('cp1251','utf-8','Быстрый заказ с интернет-магазина'), $enquiry, $name, STORE_OWNER_EMAIL_ADDRESS);
$actionRecorder->record();
session_start();
$_SESSION['tomsk'] = '1';
vam_redirect(vam_href_link('one_click.php', 'action=success'));
}
}
else{
($HTTP_GET_VARS['products_id']):
$product_info_query = vam_db_query("select p.products_id, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_status = '2' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"); }
if (!vam_db_query($product_info_query)) {
vam_redirect(vam_href_link('http://sibopt.ru'));
} else {
$product_info = vam_db_fetch_array($product_info_query);
}
if ($new_price = vam_get_products_special_price($product_info['products_id'])) {
$products_price = '<del>' . $currencies->display_price($product_info['products_price'], vam_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, vam_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
$products_price = $currencies->display_price($product_info['products_price'], vam_get_tax_rate($product_info['products_tax_class_id']));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Быстрый заказ: <?php echo $product_info['products_name']; ?></title>
<link rel="stylesheet" type="text/css" href="ext/jquery/ui/redmond/jquery-ui-1.8.6.css" />
<script type="text/javascript" src="ext/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="ext/jquery/ui/jquery-ui-1.8.6.min.js"></script>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<style>
html,body{
margin:0;
padding:0;
}
body {
background: #fff url('workimages/bg_foot.jpg') no-repeat right 34px;
color: #000;
font-size: 13px;
text-align:left;
}
h2 {
font-size: 20px;
line-height:34px;
margin-bottom: 0;
font-weight:bold;
color: #333;
padding-top:0px;
padding-bottom: 12px;
margin:0;
}
.contentContainer,.contentText,.contentText table,.contentText table td{background:transparent!important;}
.contentContainer{padding:10px 20px;}
p{color:#524d4e;
font-size:15px;}
input,textarea,.fieldKey{font-size:15px!important;}
.fieldKey{width:180px;}
.fieldValue{width:360px;}
.ovr2{width:100%;
height:110px;
overflow:auto;
margin-bottom:10px;}
.displaytomsk{
width:560px;
padding:10px 20px;
height:400px;
background: #fff url('workimages/bg_foot.jpg') no-repeat right 34px;
position:absolute;
z-index:1800;
}
.displaytomsk#tomsknot{display:none;}
</style>
<script type="text/javascript">
jQuery(function($) {
$('#tdb1').click(function() {
$('#tomsk').hide(); return false;});
$('#tdb2').click(function() {
$('#tomsk').hide();
$('#tomsknot').show(); return false;});
</script>
</head>
<body>
<?php
if(!isset($HTTP_GET_VARS['action']) OR !$_SESSION['tomsk'] == 1)
//выводим блок #tomsk, если заказ не отправлялся, а также - при отсутствии сессии "tomsk"
{ ?>
<div class="displaytomsk" id="tomsk">
<h2>...</h2>
<div style="float: right;">
<?php echo vam_draw_button('Да, я из Томска', 'check', null, 'primary'); ?>
<?php echo vam_draw_button('Нет, я НЕ в Томске', 'info', null, 'disabled'); ?>
</div>
</div>
<div class="displaytomsk" id="tomsknot">
<h2>Быстрый заказ</h2>
<p>пройдите регистрацию.</p>
<p> </p><p> </p>
<div style="float: right;">
<span class="tdbLink"><a id="tblnew" target="_top" href="/create_account.php">Зарегистрироваться</a></span><script type="text/javascript">$("#tblnew").button({icons:{primary:"ui-icon-extlink"}}).addClass("ui-priority-secondary").parent().removeClass("tdbLink");</script>
</div>
</div>
<?php
}?>
<h2>Быстрый заказ</h2>
<?php
if ($messageStack->size('contact') > 0) {
echo $messageStack->output('contact');
}
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
<div class="contentContainer" style="width:560px">
<div class="contentText">
</div>
</div>
<?php
}
else { //иначе (если заказ еще не отправлялся) выводим форму быстрого заказа:
?>
<?php echo vam_draw_form('one_click', vam_href_link('one_click.php', 'action=send'), 'post', '', true); ?>
<div class="contentContainer" style="width:560px">
<div class="contentText">
<?php
if (vam_not_null($product_info['products_name'])) {
?>
<div class="ovr2">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
if (vam_not_null($product_info['products_image'])) {
?>
<tr>
<td class="fieldKey">
<?php
echo '<a target="_top" href="' . vam_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id']) . '"><img src="' . im_resam_min(DIR_WS_IMAGES . $product_info['products_image']) . '" alt="'.$product_info['products_name'].'" width="160" /></a>'; ?>
</td>
<td class="fieldValue">
<?php
echo '<b>' . $products_price . ' <a target="_top" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id']) . '">'.$product_info['products_name'].'</a></b> ' . '<br /><b>Доставка</b>:...</a>'; ?>
<input type="hidden" name="products_id" value="<?php echo $product_info['products_id']; ?>"><input type="hidden" name="products_name" value="<?php echo $product_info['products_name']; ?>"></td></tr>
<?php
}
?>
</table>
</div>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
} else{
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2" style="display:none;">
<?php
}
?> <tr>
<td class="fieldKey">Ваше имя:</td>
<td class="fieldValue"><?php echo vam_draw_input_field('name'); ?></td>
</tr>
<tr>
<td class="fieldKey">Ваш телефон:</td>
<td class="fieldValue"><?php echo vam_draw_input_field('phone'); ?></td>
</tr>
<tr>
<td class="fieldKey">Адрес в Томске:</td>
<td class="fieldValue"><?php echo vam_draw_input_field('adress_tomsk'); ?></td>
</tr>
<tr>
<td class="fieldKey" valign="top">Сообщение:</td>
<td class="fieldValue"><?php echo vam_draw_textarea_field('enquiry', 'soft', 20, 2); ?></td>
</tr>
</table>
</div>
<div class="buttonSet">
<span class="buttonAction"><?php echo vam_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></span>
</div>
<br />
</div>
</form>
<?php
}?>
</body></html>