';
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$productsstable = $oostable['products'];
$products_descriptionstable = $oostable['products_description'];
$query = "SELECT p.products_id, pd.products_name, p.products_price
FROM $productsstable p,
$products_descriptionstable pd
WHERE p.products_status >= '1' AND
p.products_id = pd.products_id AND
pd.products_languages_id = '" . intval($_SESSION['language_id']) . "'
ORDER BY products_name";
$result = $dbconn->Execute($query);
while ($products = $result->fields) {
if (!oos_in_array($products['products_id'], $exclude)) {
$select_string .= '';
}
// Move that ADOdb pointer!
$result->MoveNext();
}
$select_string .= '';
return $select_string;
}
function oos_set_featured_status($featured_id, $status) {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
if ($status == '1') {
$featuredtable = $oostable['featured'];
return $dbconn->Execute("UPDATE $featuredtable SET status = '1', expires_date = NULL, date_status_change = now() WHERE featured_id = '" . intval($featured_id) . "'");
} elseif ($status == '0') {
$featuredtable = $oostable['featured'];
return $dbconn->Execute("UPDATE $featuredtable SET status = '0', date_status_change = now() WHERE featured_id = '" . intval($featured_id) . "'");
} else {
return -1;
}
}
$language = $_SESSION['language'];
require 'includes/classes/class_currencies.php';
$currencies = new currencies();
$nPage = (!isset($_GET['page']) || !is_numeric($_GET['page'])) ? 1 : intval($_GET['page']);
$action = (isset($_GET['action']) ? $_GET['action'] : '');
if (!empty($action)) {
switch ($action) {
case 'setflag':
oos_set_featured_status($_GET['id'], $_GET['flag']);
oos_redirect_admin(oos_href_link_admin($aContents['featured'], ''));
break;
case 'insert':
$expires_date = oos_db_prepare_input($_POST['expires_date']);
$featuredtable = $oostable['featured'];
$dbconn->Execute("INSERT INTO $featuredtable (products_id, featured_date_added, expires_date, status) VALUES ('" . intval($_POST['products_id']) . "', now(), '" . oos_db_input($expires_date) . "', '1')");
oos_redirect_admin(oos_href_link_admin($aContents['featured'], 'page=' . $nPage));
break;
case 'update':
$expires_date = oos_db_prepare_input($_POST['expires_date']);
$featuredtable = $oostable['featured'];
$dbconn->Execute("UPDATE $featuredtable SET featured_last_modified = now(), expires_date = '" . oos_db_input($expires_date) . "' WHERE featured_id = '" . intval($_POST['featured_id']) . "'");
oos_redirect_admin(oos_href_link_admin($aContents['featured'], 'page=' . $nPage . '&fID=' . $featured_id));
break;
case 'deleteconfirm':
$featured_id = oos_db_prepare_input($_GET['fID']);
$featuredtable = $oostable['featured'];
$dbconn->Execute("DELETE FROM $featuredtable WHERE featured_id = '" . oos_db_input($featured_id) . "'");
oos_redirect_admin(oos_href_link_admin($aContents['featured'], 'page=' . $nPage));
break;
}
}
require 'includes/header.php';
?>
' . HEADER_TITLE_TOP . ''; ?>
' . BOX_HEADING_CATALOG . ''; ?>
GetRow($query);
$sInfo = new objectInfo($product);
} elseif ( ($action == 'new') && isset($_GET['pID']) ) {
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$sql = "SELECT p.products_id, p.products_image, pd.products_name
FROM $productstable p,
$products_descriptiontable pd
WHERE p.products_id = pd.products_id AND
pd.products_languages_id = '" . intval($_SESSION['language_id']) . "' AND
p.products_id = '" . intval($_GET['pID']) . "'";
$product = $dbconn->GetRow($sql);
$sInfo = new objectInfo($product);
} else {
$sInfo = new objectInfo(array());
// create an array of featured products, which will be excluded from the pull down menu of products
// (when creating a new featured product)
$featured_array = array();
$featuredtable = $oostable['featured'];
$productstable = $oostable['products'];
$featured_result = $dbconn->Execute("SELECT p.products_id FROM $productstable p, $featuredtable f WHERE f.products_id = p.products_id");
while ($featured = $featured_result->fields) {
$featured_array[] = $featured['products_id'];
// Move that ADOdb pointer!
$featured_result->MoveNext();
}
}
?>
' . BUTTON_CANCEL . ''; ?>
Execute($featured_result_raw);
while ($featured = $featured_result->fields) {
if ( (!isset($_GET['fID']) || ($_GET['fID'] == $featured['featured_id'])) && !isset($sInfo) ) {
$products_result = $dbconn->Execute("SELECT products_image FROM " . $oostable['products'] . " WHERE products_id = '" . $featured['products_id'] . "'");
$products = $products_result->fields;
$sInfo_array = array_merge($featured, $products);
$sInfo = new objectInfo($sInfo_array);
}
if (isset($sInfo) && is_object($sInfo) && ($featured['featured_id'] == $sInfo->featured_id) ) {
echo '