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

Zen Cart 源代码 featured.php




下载文件

文件名: featured.php
文件类型: PHP文件
文件大小: 3.04 KiB
MD5: 0f49b00fe9c733ed905290bf3a704a7c

featured.php - 关闭高亮
  1. <?php
  2. /**
  3.  * featured-products functions
  4.  *
  5.  * @package functions
  6.  * @copyright Copyright 2003-2011 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: featured.php 18695 2011-05-04 05:24:19Z drbyte $
  10.  */
  11.  
  12. ////
  13. // Set the status of a featured product
  14.   function zen_set_featured_status($featured_id, $status) {
  15.     global $db;
  16.     $sql = "update " . TABLE_FEATURED . "
  17.            set status = '" . (int)$status . "', date_status_change = now()
  18.            where featured_id = '" . (int)$featured_id . "'";
  19.  
  20.     return $db->Execute($sql);
  21.    }
  22.  
  23. ////
  24. // Auto expire products on featured
  25.   function zen_expire_featured() {
  26.     global $db;
  27.  
  28.     $date_range = time();
  29.     $zc_featured_date = date('Ymd', $date_range);
  30.  
  31.     $featured_query = "select featured_id
  32.                       from " . TABLE_FEATURED . "
  33.                       where status = '1'
  34.                       and ((" . $zc_featured_date . " >= expires_date and expires_date != '0001-01-01')
  35.                       or (" . $zc_featured_date . " < featured_date_available and featured_date_available != '0001-01-01'))";
  36.  
  37.     $featured = $db->Execute($featured_query);
  38.  
  39.     if ($featured->RecordCount() > 0) {
  40.       while (!$featured->EOF) {
  41.         zen_set_featured_status($featured->fields['featured_id'], '0');
  42.         $featured->MoveNext();
  43.       }
  44.     }
  45.   }
  46.  
  47. ////
  48. // Auto start products on featured
  49.   function zen_start_featured() {
  50.     global $db;
  51.  
  52.     $date_range = time();
  53.     $zc_featured_date = date('Ymd', $date_range);
  54.  
  55.     $featured_query = "select featured_id
  56.                       from " . TABLE_FEATURED . "
  57.                       where status = '0'
  58.                       and (((featured_date_available <= " . $zc_featured_date . " and featured_date_available != '0001-01-01') and (expires_date > " . $zc_featured_date . "))
  59.                       or ((featured_date_available <= " . $zc_featured_date . " and featured_date_available != '0001-01-01') and (expires_date = '0001-01-01'))
  60.                       or (featured_date_available = '0001-01-01' and expires_date > " . $zc_featured_date . "))
  61.                       ";
  62.  
  63.     $featured = $db->Execute($featured_query);
  64.  
  65.     if ($featured->RecordCount() > 0) {
  66.       while (!$featured->EOF) {
  67.         zen_set_featured_status($featured->fields['featured_id'], '1');
  68.         $featured->MoveNext();
  69.       }
  70.     }
  71.  
  72. // turn off featured if not active yet
  73.     $featured_query = "select featured_id
  74.                       from " . TABLE_FEATURED . "
  75.                       where status = '1'
  76.                       and (" . $zc_featured_date . " < featured_date_available and featured_date_available != '0001-01-01')
  77.                       ";
  78.  
  79.     $featured = $db->Execute($featured_query);
  80.  
  81.     if ($featured->RecordCount() > 0) {
  82.       while (!$featured->EOF) {
  83.         zen_set_featured_status($featured->fields['featured_id'], '0');
  84.         $featured->MoveNext();
  85.       }
  86.     }
  87.  
  88.   }
  89. ?>