[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * featured-products functions 4 * 5 * @package functions 6 * @copyright Copyright 2003-2005 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 2618 2005-12-20 00:35:47Z 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 = '" . $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 $featured_query = "select featured_id 28 from " . TABLE_FEATURED . " 29 where status = '1' 30 and ((now() >= expires_date and expires_date != '0001-01-01') 31 or (now() < featured_date_available and featured_date_available != '0001-01-01'))"; 32 33 $featured = $db->Execute($featured_query); 34 35 if ($featured->RecordCount() > 0) { 36 while (!$featured->EOF) { 37 zen_set_featured_status($featured->fields['featured_id'], '0'); 38 $featured->MoveNext(); 39 } 40 } 41 } 42 43 //// 44 // Auto start products on featured 45 function zen_start_featured() { 46 global $db; 47 48 $featured_query = "select featured_id 49 from " . TABLE_FEATURED . " 50 where status = '0' 51 and (((featured_date_available <= now() and featured_date_available != '0001-01-01') and (expires_date >= now())) 52 or ((featured_date_available <= now() and featured_date_available != '0001-01-01') and (expires_date = '0001-01-01')) 53 or (featured_date_available = '0001-01-01' and expires_date >= now())) 54 "; 55 56 $featured = $db->Execute($featured_query); 57 58 if ($featured->RecordCount() > 0) { 59 while (!$featured->EOF) { 60 zen_set_featured_status($featured->fields['featured_id'], '1'); 61 $featured->MoveNext(); 62 } 63 } 64 65 // turn off featured if not active yet 66 $featured_query = "select featured_id 67 from " . TABLE_FEATURED . " 68 where status = '1' 69 and (now() < featured_date_available and featured_date_available != '0001-01-01') 70 "; 71 72 $featured = $db->Execute($featured_query); 73 74 if ($featured->RecordCount() > 0) { 75 while (!$featured->EOF) { 76 zen_set_featured_status($featured->fields['featured_id'], '0'); 77 $featured->MoveNext(); 78 } 79 } 80 81 } 82 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |