コード例 #1
0
function vam_expire_specials()
{
    $specials_query = vam_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
    if (vam_db_num_rows($specials_query)) {
        while ($specials = vam_db_fetch_array($specials_query)) {
            vam_set_specials_status($specials['specials_id'], '0');
        }
    }
}
コード例 #2
0
   --------------------------------------------------------------
   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
   (c) 2004	 xt:Commerce (specials.php,v 1.9 2003/08/18); xt-commerce.com

   Released under the GNU General Public License
   --------------------------------------------------------------*/
require 'includes/application_top.php';
require DIR_FS_CATALOG . DIR_WS_CLASSES . 'vam_price.php';
$vamPrice = new vamPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id'], $_SESSION['customer_id']);
require_once DIR_FS_INC . 'vam_get_tax_rate.inc.php';
switch ($_GET['action']) {
    case 'setflag':
        vam_set_specials_status($_GET['id'], $_GET['flag']);
        vam_redirect(vam_href_link(FILENAME_SPECIALS, '', 'NONSSL'));
        break;
    case 'insert':
        // insert a product on special
        if (PRICE_IS_BRUTTO == 'true' && substr($_POST['specials_price'], -1) != '%') {
            $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'] . "' ";
            $tax_query = vam_db_query($sql);
            $tax = vam_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 = vam_db_query("select products_id,products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int) $_POST['products_id'] . "'");
            $new_special_insert = vam_db_fetch_array($new_special_insert_query);
            $_POST['products_price'] = $new_special_insert['products_price'];
            $_POST['specials_price'] = $_POST['products_price'] - $_POST['specials_price'] / 100 * $_POST['products_price'];