Example #1
0
function smn_expire_specials()
{
    $specials_query = smn_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
    if (smn_db_num_rows($specials_query)) {
        while ($specials = smn_db_fetch_array($specials_query)) {
            smn_set_specials_status($specials['specials_id'], '0');
        }
    }
}
Example #2
0
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
require 'includes/application_top.php';
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (smn_not_null($action)) {
    switch ($action) {
        case 'setflag':
            smn_set_specials_status($_GET['id'], $_GET['flag']);
            smn_redirect(smn_href_link(FILENAME_SPECIALS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $_GET['id'], 'NONSSL'));
            break;
        case 'insert':
            $products_id = smn_db_prepare_input($_POST['products_id']);
            $products_price = smn_db_prepare_input($_POST['products_price']);
            $specials_price = smn_db_prepare_input($_POST['specials_price']);
            $day = smn_db_prepare_input($_POST['day']);
            $month = smn_db_prepare_input($_POST['month']);
            $year = smn_db_prepare_input($_POST['year']);
            if (substr($specials_price, -1) == '%') {
                $new_special_insert_query = smn_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "' and store_id = '" . $store_id . "'");
                $new_special_insert = smn_db_fetch_array($new_special_insert_query);
                $products_price = $new_special_insert['products_price'];
                $specials_price = $products_price - $specials_price / 100 * $products_price;
            }