Ejemplo n.º 1
0
function tep_expire_specials()
{
    $specials_query = tep_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
    if (tep_db_num_rows($specials_query)) {
        while ($specials = tep_db_fetch_array($specials_query)) {
            tep_set_specials_status($specials['specials_id'], '0');
        }
    }
}
Ejemplo n.º 2
0
function tep_expire_specials()
{
    $OSCOM_Db = Registry::get('Db');
    $Qspecials = $OSCOM_Db->query('select specials_id from :table_specials where status = 1 and now() >= expires_date and expires_date > 0');
    if ($Qspecials->fetch() !== false) {
        do {
            tep_set_specials_status($Qspecials->valueInt('specials_id'), 0);
        } while ($Qspecials->fetch());
    }
}
Ejemplo n.º 3
0
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
$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;
            }
Ejemplo n.º 4
0
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2014 osCommerce

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (tep_not_null($action)) {
    switch ($action) {
        case 'setflag':
            tep_set_specials_status($_GET['id'], $_GET['flag']);
            tep_redirect(tep_href_link(FILENAME_SPECIALS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $_GET['id']));
            break;
        case 'insert':
            $products_id = tep_db_prepare_input($_POST['products_id']);
            $products_price = tep_db_prepare_input($_POST['products_price']);
            $specials_price = tep_db_prepare_input($_POST['specials_price']);
            $expdate = tep_db_prepare_input($_POST['expdate']);
            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($expdate)) {
Ejemplo n.º 5
0
    if (tep_db_field_exists(TABLE_SPECIALS_TYPES, $field)) {
        $type_info_query = tep_db_query("select " . tep_db_input($field) . " as field from " . TABLE_SPECIALS_TYPES . " where specials_types_id = '" . (int) $specials_types_id . "' and language_id = '" . (int) $language_id . "'");
        $type_info = tep_db_fetch_array($type_info_query);
        return $type_info['field'];
    } else {
        return false;
    }
}
if (tep_not_null($action)) {
    switch ($action) {
        case 'setflag':
            $new_status = (int) $HTTP_GET_VARS['flag'];
            if (isset($HTTP_GET_VARS['tID'])) {
                tep_db_query("update " . TABLE_SPECIALS_TYPES . " set specials_types_status = '" . $new_status . "', last_modified = now(), specials_last_modified = now() where specials_types_id = '" . (int) $HTTP_GET_VARS['tID'] . "'");
            } elseif (isset($HTTP_GET_VARS['sID'])) {
                tep_set_specials_status($HTTP_GET_VARS['sID'], $new_status);
            }
            tep_redirect(tep_href_link(FILENAME_SPECIALS, tep_get_all_get_params(array('action', 'flag'))));
            break;
        case 'update':
        case 'insert':
            $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
            $specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
            $specials_price = str_replace(',', '.', $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 ($action == 'update') {
                $specials_id = tep_db_prepare_input($HTTP_POST_VARS['specials_id']);
            } else {
                $max_id_query = tep_db_query("select max(specials_id) as max_id from " . TABLE_SPECIALS . "");