[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 源代码 salemaker.php

Zen Cart 源代码 salemaker.php




下载文件

文件名: salemaker.php
文件类型: PHP文件
文件大小: 3.2 KiB
MD5: 6c6b3e9d16bf7195ae165101d139ce7e

salemaker.php - 关闭高亮
  1. <?php
  2. /**
  3.  * salemaker 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: salemaker.php 15974 2010-04-17 00:29:17Z ajeh $
  10.  */
  11.  
  12. ////
  13. // Set the status of a salemaker sale
  14.   function zen_set_salemaker_status($sale_id, $status) {
  15.     global $db;
  16.     $sql = "update " . TABLE_SALEMAKER_SALES . "
  17.            set sale_status = '" . (int)$status . "', sale_date_status_change = now()
  18.            where sale_id = '" . (int)$sale_id . "'";
  19.  
  20.     return $db->Execute($sql);
  21.    }
  22.  
  23. ////
  24. // Auto expire salemaker sales
  25.   function zen_expire_salemaker() {
  26.     global $db;
  27.  
  28.     $date_range = time();
  29.     $zc_sale_date = date('Ymd', $date_range);
  30.  
  31.     $salemaker_query = "select sale_id
  32.                       from " . TABLE_SALEMAKER_SALES . "
  33.                       where sale_status = '1'
  34.                       and ((" . $zc_sale_date . " >= sale_date_end and sale_date_end != '0001-01-01')
  35.                       or (" . $zc_sale_date . " < sale_date_start and sale_date_start != '0001-01-01'))";
  36.  
  37.     $salemaker = $db->Execute($salemaker_query);
  38.  
  39.     if ($salemaker->RecordCount() > 0) {
  40.       while (!$salemaker->EOF) {
  41.         zen_set_salemaker_status($salemaker->fields['sale_id'], '0');
  42.         zen_update_salemaker_product_prices($salemaker->fields['sale_id']);
  43.         $salemaker->MoveNext();
  44.       }
  45.     }
  46.   }
  47.  
  48. ////
  49. // Auto start salemaker sales
  50.   function zen_start_salemaker() {
  51.     global $db;
  52.  
  53.     $date_range = time();
  54.     $zc_sale_date = date('Ymd', $date_range);
  55.  
  56.     $salemaker_query = "select sale_id
  57.                       from " . TABLE_SALEMAKER_SALES . "
  58.                       where sale_status = '0'
  59.                       and (((sale_date_start <= " . $zc_sale_date . " and sale_date_start != '0001-01-01') and (sale_date_end > " . $zc_sale_date . "))
  60.                       or ((sale_date_start <= " . $zc_sale_date . " and sale_date_start != '0001-01-01') and (sale_date_end = '0001-01-01'))
  61.                       or (sale_date_start = '0001-01-01' and sale_date_end > " . $zc_sale_date . "))
  62.                       ";
  63.  
  64.     $salemaker = $db->Execute($salemaker_query);
  65.  
  66.     if ($salemaker->RecordCount() > 0) {
  67.       while (!$salemaker->EOF) {
  68.         zen_set_salemaker_status($salemaker->fields['sale_id'], '1');
  69.         zen_update_salemaker_product_prices($salemaker->fields['sale_id']);
  70.         $salemaker->MoveNext();
  71.       }
  72.     }
  73.  
  74. // turn off salemaker sales if not active yet
  75.     $salemaker_query = "select sale_id
  76.                       from " . TABLE_SALEMAKER_SALES . "
  77.                       where sale_status = '1'
  78.                       and (" . $zc_sale_date . " < sale_date_start and sale_date_start != '0001-01-01')
  79.                       ";
  80.  
  81.     $salemaker = $db->Execute($salemaker_query);
  82.  
  83.     if ($salemaker->RecordCount() > 0) {
  84.       while (!$salemaker->EOF) {
  85.         zen_set_salemaker_status($salemaker->fields['sale_id'], '0');
  86.         zen_update_salemaker_product_prices($salemaker->fields['sale_id']);
  87.         $salemaker->MoveNext();
  88.       }
  89.     }
  90.   }
  91. ?>