Execute($sql); } //// // Auto expire products on special function zen_expire_specials() { global $db; $specials_query = "select specials_id, products_id from " . TABLE_SPECIALS . " where status = '1' and ((now() >= expires_date and expires_date != '0001-01-01') or (now() < specials_date_available and specials_date_available != '0001-01-01'))"; $specials = $db->Execute($specials_query); if ($specials->RecordCount() > 0) { while (!$specials->EOF) { zen_set_specials_status($specials->fields['specials_id'], '0'); zen_update_products_price_sorter($specials->fields['products_id']); $specials->MoveNext(); } } } //// // Auto start products on special function zen_start_specials() { global $db; // turn on special if active $specials_query = "select specials_id, products_id from " . TABLE_SPECIALS . " where status = '0' and (((specials_date_available <= now() and specials_date_available != '0001-01-01') and (expires_date >= now())) or ((specials_date_available <= now() and specials_date_available != '0001-01-01') and (expires_date = '0001-01-01')) or (specials_date_available = '0001-01-01' and expires_date >= now())) "; $specials = $db->Execute($specials_query); if ($specials->RecordCount() > 0) { while (!$specials->EOF) { zen_set_specials_status($specials->fields['specials_id'], '1'); zen_update_products_price_sorter($specials->fields['products_id']); $specials->MoveNext(); } } // turn off special if not active yet $specials_query = "select specials_id, products_id from " . TABLE_SPECIALS . " where status = '1' and (now() < specials_date_available and specials_date_available != '0001-01-01') "; $specials = $db->Execute($specials_query); if ($specials->RecordCount() > 0) { while (!$specials->EOF) { zen_set_specials_status($specials->fields['specials_id'], '0'); zen_update_products_price_sorter($specials->fields['products_id']); $specials->MoveNext(); } } } ?>