function xtc_expire_specials()
{
    $specials_query = xtc_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
    if (xtc_db_num_rows($specials_query)) {
        while ($specials = xtc_db_fetch_array($specials_query)) {
            xtc_set_specials_status($specials['specials_id'], '0');
        }
    }
}
Exemplo n.º 2
0
   Copyright (c) 2003 XT-Commerce
   --------------------------------------------------------------
   based on: 
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(specials.php,v 1.38 2002/05/16); www.oscommerce.com 
   (c) 2003	 nextcommerce (specials.php,v 1.9 2003/08/18); www.nextcommerce.org

   Released under the GNU General Public License 
   --------------------------------------------------------------*/
require 'includes/application_top.php';
require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
$xtPrice = new xtcPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id']);
require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
switch ($_GET['action']) {
    case 'setflag':
        xtc_set_specials_status($_GET['id'], $_GET['flag']);
        xtc_redirect(xtc_href_link(FILENAME_SPECIALS, '', 'NONSSL'));
        break;
    case 'insert':
        // insert a product on special
        if (PRICE_IS_BRUTTO == 'true' && substr($_POST['specials_price'], -1) != '%') {
            //BOF - Dokuman - 2009-08-19 - BUGFIX: #0000264 specials are no longer deactivated when stock check = false
            //$sql="select tr.tax_rate from " . TABLE_TAX_RATES . " tr, " . TABLE_PRODUCTS . " p  where tr.tax_class_id = p. products_tax_class_id  and p.products_id = '". $_POST['products_up_id'] . "' ";
            $sql = "select tr.tax_rate from " . TABLE_TAX_RATES . " tr, " . TABLE_PRODUCTS . " p  where tr.tax_class_id = p. products_tax_class_id  and p.products_id = '" . $_POST['products_id'] . "' ";
            //EOF - Dokuman - 2009-08-19 - BUGFIX: #0000264 specials are no longer deactivated when stock check = false
            $tax_query = xtc_db_query($sql);
            $tax = xtc_db_fetch_array($tax_query);
            $_POST['specials_price'] = $_POST['specials_price'] / ($tax['tax_rate'] + 100) * 100;
        }
        if (substr($_POST['specials_price'], -1) == '%') {
            $new_special_insert_query = xtc_db_query("select products_id,products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int) $_POST['products_id'] . "'");