[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 specials.php

Zen Cart 源代码 specials.php




下载文件

文件名: specials.php
文件类型: PHP文件
文件大小: 3.33 KiB
MD5: 22f2382002f5728c12931c90a339ce29

specials.php - 关闭高亮
  1. <?php
  2. /**
  3.  * product-specials functions
  4.  *
  5.  * @package functions
  6.  * @copyright Copyright 2003-2010 Zen Cart Development Team
  7.  * @copyright Portions Copyright 2003 osCommerce
  8.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9.  * @version $Id: specials.php 15974 2010-04-17 00:29:17Z ajeh $
  10.  */
  11.  
  12. ////
  13. // Set the status of a product on special
  14.   function zen_set_specials_status($specials_id, $status) {
  15.     global $db;
  16.     $sql = "update " . TABLE_SPECIALS . "
  17.            set status = '" . $status . "', date_status_change = now()
  18.            where specials_id = '" . (int)$specials_id . "'";
  19.  
  20.     return $db->Execute($sql);
  21.    }
  22.  
  23. ////
  24. // Auto expire products on special
  25.   function zen_expire_specials() {
  26.     global $db;
  27.  
  28.     $date_range = time();
  29.     $zc_specials_date = date('Ymd', $date_range);
  30.  
  31.     $specials_query = "select specials_id, products_id
  32.                       from " . TABLE_SPECIALS . "
  33.                       where status = '1'
  34.                       and ((" . $zc_specials_date . " >= expires_date and expires_date != '0001-01-01')
  35.                       or (" . $zc_specials_date . " < specials_date_available and specials_date_available != '0001-01-01'))";
  36.  
  37.     $specials = $db->Execute($specials_query);
  38.  
  39.     if ($specials->RecordCount() > 0) {
  40.       while (!$specials->EOF) {
  41.         zen_set_specials_status($specials->fields['specials_id'], '0');
  42.         zen_update_products_price_sorter($specials->fields['products_id']);
  43.         $specials->MoveNext();
  44.       }
  45.     }
  46.   }
  47.  
  48. ////
  49. // Auto start products on special
  50.   function zen_start_specials() {
  51.     global $db;
  52.  
  53.     $date_range = time();
  54.     $zc_specials_date = date('Ymd', $date_range);
  55.  
  56. // turn on special if active
  57.     $specials_query = "select specials_id, products_id
  58.                       from " . TABLE_SPECIALS . "
  59.                       where status = '0'
  60.                       and (((specials_date_available <= " . $zc_specials_date . " and specials_date_available != '0001-01-01') and (expires_date > " . $zc_specials_date . "))
  61.                       or ((specials_date_available <= " . $zc_specials_date . " and specials_date_available != '0001-01-01') and (expires_date = '0001-01-01'))
  62.                       or (specials_date_available = '0001-01-01' and expires_date > " . $zc_specials_date . "))
  63.                       ";
  64.  
  65.     $specials = $db->Execute($specials_query);
  66.  
  67.     if ($specials->RecordCount() > 0) {
  68.       while (!$specials->EOF) {
  69.         zen_set_specials_status($specials->fields['specials_id'], '1');
  70.         zen_update_products_price_sorter($specials->fields['products_id']);
  71.         $specials->MoveNext();
  72.       }
  73.     }
  74.  
  75. // turn off special if not active yet
  76.     $specials_query = "select specials_id, products_id
  77.                       from " . TABLE_SPECIALS . "
  78.                       where status = '1'
  79.                       and (" . $zc_specials_date . " < specials_date_available and specials_date_available != '0001-01-01')
  80.                       ";
  81.  
  82.     $specials = $db->Execute($specials_query);
  83.  
  84.     if ($specials->RecordCount() > 0) {
  85.       while (!$specials->EOF) {
  86.         zen_set_specials_status($specials->fields['specials_id'], '0');
  87.         zen_update_products_price_sorter($specials->fields['products_id']);
  88.         $specials->MoveNext();
  89.       }
  90.     }
  91.   }
  92. ?>