[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * salemaker functions 4 * 5 * @package functions 6 * @copyright Copyright 2003-2006 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 4135 2006-08-14 04:25:02Z drbyte $ 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 $salemaker_query = "select sale_id 29 from " . TABLE_SALEMAKER_SALES . " 30 where sale_status = '1' 31 and ((now() >= sale_date_end and sale_date_end != '0001-01-01') 32 or (now() < sale_date_start and sale_date_start != '0001-01-01'))"; 33 34 $salemaker = $db->Execute($salemaker_query); 35 36 if ($salemaker->RecordCount() > 0) { 37 while (!$salemaker->EOF) { 38 zen_set_salemaker_status($salemaker->fields['sale_id'], '0'); 39 zen_update_salemaker_product_prices($salemaker->fields['sale_id']); 40 $salemaker->MoveNext(); 41 } 42 } 43 } 44 45 //// 46 // Auto start salemaker sales 47 function zen_start_salemaker() { 48 global $db; 49 50 $salemaker_query = "select sale_id 51 from " . TABLE_SALEMAKER_SALES . " 52 where sale_status = '0' 53 and (((sale_date_start <= now() and sale_date_start != '0001-01-01') and (sale_date_end >= now())) 54 or ((sale_date_start <= now() and sale_date_start != '0001-01-01') and (sale_date_end = '0001-01-01')) 55 or (sale_date_start = '0001-01-01' and sale_date_end >= now())) 56 "; 57 58 $salemaker = $db->Execute($salemaker_query); 59 60 if ($salemaker->RecordCount() > 0) { 61 while (!$salemaker->EOF) { 62 zen_set_salemaker_status($salemaker->fields['sale_id'], '1'); 63 zen_update_salemaker_product_prices($salemaker->fields['sale_id']); 64 $salemaker->MoveNext(); 65 } 66 } 67 68 // turn off salemaker sales if not active yet 69 $salemaker_query = "select sale_id 70 from " . TABLE_SALEMAKER_SALES . " 71 where sale_status = '1' 72 and (now() < sale_date_start and sale_date_start != '0001-01-01') 73 "; 74 75 $salemaker = $db->Execute($salemaker_query); 76 77 if ($salemaker->RecordCount() > 0) { 78 while (!$salemaker->EOF) { 79 zen_set_salemaker_status($salemaker->fields['sale_id'], '0'); 80 zen_update_salemaker_product_prices($salemaker->fields['sale_id']); 81 $salemaker->MoveNext(); 82 } 83 } 84 } 85 ?>
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 |
![]() |