Dovrei visualizzare tutti i nomi del campo "products_name" che fa parte della tabella "products_description"
non capisco perchè non funziona..
Codice PHP:
<?php
$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
if (tep_not_null($action)) {
switch ($action) {
case 'setflag':
tep_set_specials_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']);
tep_redirect(tep_href_link(FILENAME_SPECIALS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'sID=' . $HTTP_GET_VARS['id'], 'NONSSL'));
break;
case 'insert':
$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
$products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
$specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
$day = tep_db_prepare_input($HTTP_POST_VARS['day']);
$month = tep_db_prepare_input($HTTP_POST_VARS['month']);
$year = tep_db_prepare_input($HTTP_POST_VARS['year']);
if (substr($specials_price, -1) == '%') {
$new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$new_special_insert = tep_db_fetch_array($new_special_insert_query);
$products_price = $new_special_insert['products_price'];
$specials_price = ($products_price - (($specials_price / 100) * $products_price));
}
$expires_date = '';
if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
$expires_date = $year;
$expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
$expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
}
tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1')");
tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));
break;
case 'update':
$specials_id = tep_db_prepare_input($HTTP_POST_VARS['specials_id']);
$products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
$specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
$day = tep_db_prepare_input($HTTP_POST_VARS['day']);
$month = tep_db_prepare_input($HTTP_POST_VARS['month']);
$year = tep_db_prepare_input($HTTP_POST_VARS['year']);
if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));
$expires_date = '';
if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
$expires_date = $year;
$expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
$expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
}
tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = '" . tep_db_input($expires_date) . "' where specials_id = '" . (int)$specials_id . "'");
tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials_id));
break;
case 'deleteconfirm':
$specials_id = tep_db_prepare_input($HTTP_GET_VARS['sID']);
tep_db_query("delete from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'");
tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));
break;
}
}
?>
<?php
if ( ($action == 'new') || ($action == 'edit') ) {
$form_action = 'insert';
if ( ($action == 'edit') && isset($HTTP_GET_VARS['sID']) ) {
$form_action = 'update';
$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'");
$product = tep_db_fetch_array($product_query);
$sInfo = new objectInfo($product);
} else {
$sInfo = new objectInfo(array());
// create an array of products on special, which will be excluded from the pull down menu of products
// (when creating a new product on special)
$specials_array = array();
$specials_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id");
while ($specials = tep_db_fetch_array($specials_query)) {
$specials_array[] = $specials['products_id'];
}
}
}
?>
<form name="new_special" <?php echo 'action="' . tep_href_link(FILENAME_SPECIALS, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> id="form" action="sendEmail.php" method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('specials_id', $HTTP_GET_VARS['sID']); ?>
<table border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td><font color="#660000" size="2">[b] Nome:[/b]</td>
<td align=""><input type=text name="nome"></td>
</tr>
<tr>
<td><font color="#660000" size="2">[b]Città:[/b]</td>
<td align=""><input type=text name="citta" size="20"></td>
</tr>
<tr>
<td>[b]<font size="2" color="#660000">Alloggio richiesto*:</font></td><td>
<SELECT NAME="alloggio">
<OPTION SELECTED><?php echo (isset($sInfo->products_name)) ? $sInfo->products_name . ' [size="1"](' . $currencies->format($sInfo->products_price) . ')[/size]' : tep_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?></OPTION>
</SELECT>