|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 require('includes/application_top.php'); 00011 00012 require(DIR_WS_CLASSES . 'currencies.php'); 00013 $currencies = new currencies(); 00014 00015 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 00016 00017 if (zen_not_null($action)) { 00018 switch ($action) { 00019 case 'setflag': 00020 if (isset($_POST['flag']) && ($_POST['flag'] == 1 || $_POST['flag'] == 0)) 00021 { 00022 zen_set_specials_status($_GET['id'], $_POST['flag']); 00023 // reset products_price_sorter for searches etc. 00024 $update_price = $db->Execute("select products_id from " . TABLE_SPECIALS . " where specials_id = '" . (int)$_GET['id'] . "'"); 00025 zen_update_products_price_sorter($update_price->fields['products_id']); 00026 zen_redirect(zen_href_link(FILENAME_SPECIALS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $_GET['id'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''), 'NONSSL')); 00027 } 00028 break; 00029 case 'insert': 00030 if ($_POST['products_id'] < 1) { 00031 $messageStack->add_session(ERROR_NOTHING_SELECTED, 'caution'); 00032 } else { 00033 $products_id = zen_db_prepare_input($_POST['products_id']); 00034 $products_price = zen_db_prepare_input($_POST['products_price']); 00035 00036 $tmp_value = zen_db_prepare_input($_POST['specials_price']); 00037 $specials_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value; 00038 00039 if (substr($specials_price, -1) == '%') { 00040 $new_special_insert = $db->Execute("select products_id, products_price, products_priced_by_attribute 00041 from " . TABLE_PRODUCTS . " 00042 where products_id = '" . (int)$products_id . "'"); 00043 00044 // check if priced by attribute 00045 if ($new_special_insert->fields['products_priced_by_attribute'] == '1') { 00046 $products_price = zen_get_products_base_price($products_id); 00047 } else { 00048 $products_price = $new_special_insert->fields['products_price']; 00049 } 00050 00051 $specials_price = ($products_price - (($specials_price / 100) * $products_price)); 00052 } 00053 00054 $specials_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start'])); 00055 $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end'])); 00056 00057 $products_id = zen_db_prepare_input($_POST['products_id']); 00058 $db->Execute("insert into " . TABLE_SPECIALS . " 00059 (products_id, specials_new_products_price, specials_date_added, expires_date, status, specials_date_available) 00060 values ('" . (int)$products_id . "', 00061 '" . zen_db_input($specials_price) . "', 00062 now(), 00063 '" . zen_db_input($expires_date) . "', '1', '" . zen_db_input($specials_date_available) . "')"); 00064 00065 $new_special = $db->Execute("select specials_id from " . TABLE_SPECIALS . " where products_id='" . (int)$products_id . "'"); 00066 00067 // reset products_price_sorter for searches etc. 00068 zen_update_products_price_sorter((int)$products_id); 00069 00070 } // nothing selected 00071 if ($_GET['go_back'] == 'ON'){ 00072 zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_id . '¤t_category_id=' . $_GET['current_category_id'])); 00073 } else { 00074 zen_redirect(zen_href_link(FILENAME_SPECIALS, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $new_special->fields['specials_id'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))); 00075 } 00076 break; 00077 case 'update': 00078 $specials_id = zen_db_prepare_input($_POST['specials_id']); 00079 00080 if ($_POST['products_priced_by_attribute'] == '1') { 00081 $products_price = zen_get_products_base_price($_POST['update_products_id']); 00082 } else { 00083 $products_price = zen_db_prepare_input($_POST['products_price']); 00084 } 00085 00086 $tmp_value = zen_db_prepare_input($_POST['specials_price']); 00087 $specials_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value; 00088 00089 if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price)); 00090 00091 $specials_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start'])); 00092 $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end'])); 00093 00094 $db->Execute("update " . TABLE_SPECIALS . " 00095 set specials_new_products_price = '" . zen_db_input($specials_price) . "', 00096 specials_last_modified = now(), 00097 expires_date = '" . zen_db_input($expires_date) . "', 00098 specials_date_available = '" . zen_db_input($specials_date_available) . "' 00099 where specials_id = '" . (int)$specials_id . "'"); 00100 00101 // reset products_price_sorter for searches etc. 00102 $update_price = $db->Execute("select products_id from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'"); 00103 zen_update_products_price_sorter($update_price->fields['products_id']); 00104 00105 zen_redirect(zen_href_link(FILENAME_SPECIALS, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $specials_id . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))); 00106 break; 00107 case 'deleteconfirm': 00108 // demo active test 00109 if (zen_admin_demo()) { 00110 $_GET['action']= ''; 00111 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 00112 zen_redirect(zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))); 00113 } 00114 $specials_id = zen_db_prepare_input($_POST['sID']); 00115 00116 // reset products_price_sorter for searches etc. 00117 $update_price = $db->Execute("select products_id from " . TABLE_SPECIALS . " where specials_id = '" . $specials_id . "'"); 00118 $update_price_id = $update_price->fields['products_id']; 00119 00120 $db->Execute("delete from " . TABLE_SPECIALS . " 00121 where specials_id = '" . (int)$specials_id . "'"); 00122 00123 zen_update_products_price_sorter($update_price_id); 00124 00125 zen_redirect(zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))); 00126 break; 00127 case 'pre_add_confirmation': 00128 // check for blank or existing special 00129 $skip_special = false; 00130 if (empty($_POST['pre_add_products_id'])) { 00131 $skip_special = true; 00132 $messageStack->add_session(WARNING_SPECIALS_PRE_ADD_EMPTY, 'caution'); 00133 } 00134 00135 if ($skip_special == false) { 00136 $sql = "select products_id, products_model from " . TABLE_PRODUCTS . " where products_id='" . (int)$_POST['pre_add_products_id'] . "'"; 00137 $check_special = $db->Execute($sql); 00138 if ($check_special->RecordCount() < 1 || substr($check_special->fields['products_model'], 0, 4) == 'GIFT') { 00139 $skip_special = true; 00140 $messageStack->add_session(WARNING_SPECIALS_PRE_ADD_BAD_PRODUCTS_ID, 'caution'); 00141 } 00142 } 00143 00144 if ($skip_special == false) { 00145 $sql = "select specials_id from " . TABLE_SPECIALS . " where products_id='" . (int)$_POST['pre_add_products_id'] . "'"; 00146 $check_special = $db->Execute($sql); 00147 if ($check_special->RecordCount() > 0) { 00148 $skip_special = true; 00149 $messageStack->add_session(WARNING_SPECIALS_PRE_ADD_DUPLICATE, 'caution'); 00150 } 00151 } 00152 00153 if ($skip_special == true) { 00154 zen_redirect(zen_href_link(FILENAME_SPECIALS, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . ($check_special->fields['specials_id'] > 0 ? 'sID=' . $check_special->fields['specials_id'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))); 00155 } 00156 // add empty special 00157 00158 $specials_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start'])); 00159 $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end'])); 00160 00161 $products_id = zen_db_prepare_input($_POST['pre_add_products_id']); 00162 $db->Execute("insert into " . TABLE_SPECIALS . " 00163 (products_id, specials_new_products_price, specials_date_added, expires_date, status, specials_date_available) 00164 values ('" . (int)$products_id . "', 00165 '" . zen_db_input($specials_price) . "', 00166 now(), 00167 '" . zen_db_input($expires_date) . "', '1', '" . zen_db_input($specials_date_available) . "')"); 00168 00169 $new_special = $db->Execute("select specials_id from " . TABLE_SPECIALS . " where products_id='" . (int)$products_id . "'"); 00170 00171 $messageStack->add_session(SUCCESS_SPECIALS_PRE_ADD, 'success'); 00172 zen_redirect(zen_href_link(FILENAME_SPECIALS, 'action=edit' . '&sID=' . $new_special->fields['specials_id'] . '&manual=1')); 00173 break; 00174 } 00175 } 00176 ?> 00177 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00178 <html <?php echo HTML_PARAMS; ?>> 00179 <head> 00180 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00181 <title><?php echo TITLE; ?></title> 00182 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00183 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00184 <script language="javascript" src="includes/menu.js"></script> 00185 <script language="javascript" src="includes/general.js"></script> 00186 <?php 00187 if ( ($action == 'new') || ($action == 'edit') ) { 00188 ?> 00189 <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css"> 00190 <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script> 00191 <?php 00192 } 00193 ?> 00194 <script type="text/javascript"> 00195 <!-- 00196 function init() 00197 { 00198 cssjsmenu('navbar'); 00199 if (document.getElementById) 00200 { 00201 var kill = document.getElementById('hoverJS'); 00202 kill.disabled = true; 00203 } 00204 } 00205 // --> 00206 </script> 00207 </head> 00208 <body onLoad="init()"> 00209 <div id="spiffycalendar" class="text"></div> 00210 <!-- header //--> 00211 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 00212 <!-- header_eof //--> 00213 00214 <!-- body //--> 00215 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00216 <tr> 00217 <!-- body_text //--> 00218 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00219 00220 <tr> 00221 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00222 <tr><?php echo zen_draw_form('search', FILENAME_SPECIALS, '', 'get'); ?> 00223 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00224 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 00225 <td class="smallText" align="right"> 00226 <?php 00227 // show reset search 00228 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 00229 echo '<a href="' . zen_href_link(FILENAME_SPECIALS) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a> '; 00230 } 00231 echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id(); 00232 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 00233 $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); 00234 echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords; 00235 } 00236 ?> 00237 </td> 00238 </form></tr> 00239 <tr> 00240 <td colspan="3" class="main"><?php echo TEXT_STATUS_WARNING; ?></td> 00241 </tr> 00242 </table></td> 00243 </tr> 00244 <?php 00245 if (empty($action)) { 00246 ?> 00247 <td align="center"><?php echo '<a href="' . zen_href_link(FILENAME_SPECIALS, ((isset($_GET['page']) && $_GET['page'] > 0) ? 'page=' . $_GET['page'] . '&' : '') . 'action=new') . '">' . zen_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td> 00248 <?php 00249 } 00250 ?> 00251 <?php 00252 if ( ($action == 'new') || ($action == 'edit') ) { 00253 $form_action = 'insert'; 00254 if ( ($action == 'edit') && isset($_GET['sID']) ) { 00255 $form_action = 'update'; 00256 00257 $product = $db->Execute("select p.products_id, pd.products_name, p.products_price, p.products_priced_by_attribute, 00258 s.specials_new_products_price, s.expires_date, s.specials_date_available 00259 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . 00260 TABLE_SPECIALS . " s 00261 where p.products_id = pd.products_id 00262 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 00263 and p.products_id = s.products_id 00264 and s.specials_id = '" . (int)$_GET['sID'] . "'"); 00265 00266 $sInfo = new objectInfo($product->fields); 00267 00268 if ($sInfo->products_priced_by_attribute == '1') { 00269 $sInfo->products_price = zen_get_products_base_price($product->fields['products_id']); 00270 } 00271 00272 } else { 00273 $sInfo = new objectInfo(array()); 00274 00275 // create an array of products on special, which will be excluded from the pull down menu of products 00276 // (when creating a new product on special) 00277 $specials_array = array(); 00278 $specials = $db->Execute("select p.products_id, p.products_model 00279 from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s 00280 where s.products_id = p.products_id"); 00281 00282 while (!$specials->EOF) { 00283 $specials_array[] = $specials->fields['products_id']; 00284 $specials->MoveNext(); 00285 } 00286 00287 // never include Gift Vouchers for specials 00288 $gift_vouchers = $db->Execute("select distinct p.products_id, p.products_model 00289 from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s 00290 where p.products_model rlike '" . "GIFT" . "'"); 00291 00292 while (!$gift_vouchers->EOF) { 00293 if(substr($gift_vouchers->fields['products_model'], 0, 4) == 'GIFT') { 00294 $specials_array[] = $gift_vouchers->fields['products_id']; 00295 } 00296 $gift_vouchers->MoveNext(); 00297 } 00298 00299 // do not include things that cannot go in the cart 00300 $not_for_cart = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCT_TYPES . " pt on p.products_type= pt.type_id where pt.allow_add_to_cart = 'N'"); 00301 00302 while (!$not_for_cart->EOF) { 00303 $specials_array[] = $not_for_cart->fields['products_id']; 00304 $not_for_cart->MoveNext(); 00305 } 00306 } 00307 ?> 00308 <script language="javascript"> 00309 var StartDate = new ctlSpiffyCalendarBox("StartDate", "new_special", "start", "btnDate1","<?php echo (($sInfo->specials_date_available == '0001-01-01') ? '' : zen_date_short($sInfo->specials_date_available)); ?>",scBTNMODE_CUSTOMBLUE); 00310 var EndDate = new ctlSpiffyCalendarBox("EndDate", "new_special", "end", "btnDate2","<?php echo (($sInfo->expires_date == '0001-01-01') ? '' : zen_date_short($sInfo->expires_date)); ?>",scBTNMODE_CUSTOMBLUE); 00311 </script> 00312 <tr><?php echo zen_draw_form("new_special", FILENAME_SPECIALS, zen_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action . '&go_back=' . $_GET['go_back']); ?><?php if ($form_action == 'update') echo zen_draw_hidden_field('specials_id', $_GET['sID']); ?> 00313 <td><br><table border="0" cellspacing="0" cellpadding="2"> 00314 <tr> 00315 <td class="main"><?php echo TEXT_SPECIALS_PRODUCT; ?> </td> 00316 <td class="main"><?php echo (isset($sInfo->products_name)) ? $sInfo->products_name . ' <small>(' . $currencies->format($sInfo->products_price) . ')</small>' : zen_draw_products_pull_down('products_id', 'size="15" style="font-size:12px"', $specials_array, true, $_GET['add_products_id'], true); echo zen_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?></td> 00317 </tr> 00318 <tr> 00319 <td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?> </td> 00320 <td class="main"><?php echo zen_draw_input_field('specials_price', (isset($sInfo->specials_new_products_price) ? $sInfo->specials_new_products_price : '')); echo zen_draw_hidden_field('products_priced_by_attribute', $sInfo->products_priced_by_attribute); echo zen_draw_hidden_field('update_products_id', $sInfo->products_id); ?></td> 00321 </tr> 00322 00323 <tr> 00324 <td class="main"><?php echo TEXT_SPECIALS_AVAILABLE_DATE; ?> </td> 00325 <td class="main"><script language="javascript">StartDate.writeControl(); StartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td> 00326 </tr> 00327 <tr> 00328 <td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> </td> 00329 <td class="main"><script language="javascript">EndDate.writeControl(); EndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td> 00330 </tr> 00331 00332 </table></td> 00333 </tr> 00334 <tr> 00335 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00336 <tr> 00337 <td class="main"><br><?php echo TEXT_SPECIALS_PRICE_TIP; ?></td> 00338 <td class="main" align="right" valign="top"><br><?php echo (($form_action == 'insert') ? zen_image_submit('button_insert.gif', IMAGE_INSERT) : zen_image_submit('button_update.gif', IMAGE_UPDATE)) . ((int)$_GET['manual'] == 0 ? ' <a href="' . ($_GET['go_back'] == 'ON' ? zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['add_products_id'] . '¤t_category_id=' . $_GET['current_category_id']) : zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . ((isset($_GET['sID']) and $_GET['sID'] != '') ? '&sID=' . $_GET['sID'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>' : ''); ?></td> 00339 </tr> 00340 </table></td> 00341 </form></tr> 00342 <?php 00343 } else { 00344 ?> 00345 <tr> 00346 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00347 <tr> 00348 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00349 <tr class="dataTableHeadingRow"> 00350 <td class="dataTableHeadingContent" align="right"><?php echo 'ID#'; ?> </td> 00351 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td> 00352 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> 00353 <td colspan="2" class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRODUCTS_PRICE; ?></td> 00354 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_AVAILABLE_DATE; ?></td> 00355 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_EXPIRES_DATE; ?></td> 00356 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td> 00357 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 00358 </tr> 00359 <?php 00360 // create search filter 00361 $search = ''; 00362 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 00363 $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); 00364 $search = " and (pd.products_name like '%" . $keywords . "%' or pd.products_description like '%" . $keywords . "%' or p.products_model like '%" . $keywords . "%')"; 00365 } 00366 00367 // order of display 00368 $order_by = " order by pd.products_name "; 00369 $specials_query_raw = "select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_priced_by_attribute, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status, s.specials_date_available from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p.products_id = s.products_id" . $search . $order_by; 00370 00371 // Split Page 00372 // reset page when page is unknown 00373 if (($_GET['page'] == '1' or $_GET['page'] == '') and $_GET['sID'] != '') { 00374 $old_page = $_GET['page']; 00375 $check_page = $db->Execute($specials_query_raw); 00376 if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) { 00377 $check_count=1; 00378 while (!$check_page->EOF) { 00379 if ($check_page->fields['specials_id'] == $_GET['sID']) { 00380 break; 00381 } 00382 $check_count++; 00383 $check_page->MoveNext(); 00384 } 00385 $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0); 00386 $page = $_GET['page']; 00387 if ($old_page != $_GET['page']) { 00388 // do nothing 00389 } 00390 } else { 00391 $_GET['page'] = 1; 00392 } 00393 } 00394 00395 // create split page control 00396 $specials_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $specials_query_raw, $specials_query_numrows); 00397 $specials = $db->Execute($specials_query_raw); 00398 while (!$specials->EOF) { 00399 if ((!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $specials->fields['specials_id']))) && !isset($sInfo)) { 00400 $products = $db->Execute("select products_image 00401 from " . TABLE_PRODUCTS . " 00402 where products_id = '" . (int)$specials->fields['products_id'] . "'"); 00403 00404 $sInfo_array = array_merge($specials->fields, $products->fields); 00405 $sInfo = new objectInfo($sInfo_array); 00406 } 00407 00408 if (isset($sInfo) && is_object($sInfo) && ($specials->fields['specials_id'] == $sInfo->specials_id)) { 00409 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '\'">' . "\n"; 00410 } else { 00411 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $specials->fields['specials_id'] . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '\'">' . "\n"; 00412 } 00413 00414 if ($specials->fields['products_priced_by_attribute'] == '1') { 00415 $specials_current_price = zen_get_products_base_price($specials->fields['products_id']); 00416 } else { 00417 $specials_current_price = $specials->fields['products_price']; 00418 } 00419 00420 $sale_price = zen_get_products_special_price($specials->fields['products_id'], false); 00421 00422 ?> 00423 <td class="dataTableContent" align="right"><?php echo $specials->fields['products_id']; ?> </td> 00424 <td class="dataTableContent"><?php echo $specials->fields['products_name']; ?></td> 00425 <td class="dataTableContent" align="left"><?php echo $specials->fields['products_model']; ?> </td> 00426 <td colspan="2" class="dataTableContent" align="right"><?php echo zen_get_products_display_price($specials->fields['products_id']); ?></td> 00427 <td class="dataTableContent" align="center"><?php echo (($specials->fields['specials_date_available'] != '0001-01-01' and $specials->fields['specials_date_available'] !='') ? zen_date_short($specials->fields['specials_date_available']) : TEXT_NONE); ?></td> 00428 <td class="dataTableContent" align="center"><?php echo (($specials->fields['expires_date'] != '0001-01-01' and $specials->fields['expires_date'] !='') ? zen_date_short($specials->fields['expires_date']) : TEXT_NONE); ?></td> 00429 <td class="dataTableContent" align="center"> 00430 <?php 00431 if ($specials->fields['status'] == '1') { 00432 echo zen_draw_form('setflag_products', FILENAME_SPECIALS, 'action=setflag&id=' . $specials->fields['specials_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''));?> 00433 <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_green_on.gif" title="<?php echo IMAGE_ICON_STATUS_ON; ?>" /> 00434 <input type="hidden" name="flag" value="0" /> 00435 </form> 00436 <?php 00437 } else { 00438 echo zen_draw_form('setflag_products', FILENAME_SPECIALS, 'action=setflag&id=' . $specials->fields['specials_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''));?> 00439 <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_red_on.gif" title="<?php echo IMAGE_ICON_STATUS_OFF; ?>" /> 00440 <input type="hidden" name="flag" value="1" /> 00441 </form> 00442 <?php 00443 } 00444 ?> 00445 </td> 00446 <td class="dataTableContent" align="right"> 00447 <?php echo '<a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $specials->fields['specials_id'] . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?> 00448 <?php echo '<a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $specials->fields['specials_id'] . '&action=delete' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?> 00449 <?php if (isset($sInfo) && is_object($sInfo) && ($specials->fields['specials_id'] == $sInfo->specials_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_SPECIALS, zen_get_all_get_params(array('sID')) . 'sID=' . $specials->fields['specials_id'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> 00450 </td> 00451 </tr> 00452 <?php 00453 $specials->MoveNext(); 00454 } 00455 ?> 00456 <tr> 00457 <td colspan="8"><table border="0" width="100%" cellpadding="0"cellspacing="2"> 00458 <tr> 00459 <td class="smallText" valign="top"><?php echo $specials_split->display_count($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td> 00460 <td class="smallText" align="right"><?php echo $specials_split->display_links($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params( array( 'page', 'sID' ))); ?></td> 00461 </tr> 00462 <?php 00463 if (empty($action)) { 00464 ?> 00465 <tr> 00466 <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_SPECIALS, ((isset($_GET['page']) && $_GET['page'] > 0) ? 'page=' . $_GET['page'] . '&' : '') . 'action=new') . '">' . zen_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td> 00467 </tr> 00468 <?php 00469 } 00470 ?> 00471 </table></td> 00472 </tr> 00473 </table></td> 00474 <?php 00475 $heading = array(); 00476 $contents = array(); 00477 00478 switch ($action) { 00479 case 'delete': 00480 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SPECIALS . '</b>'); 00481 00482 $contents = array('form' => zen_draw_form('specials', FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&action=deleteconfirm' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . zen_draw_hidden_field('sID', $sInfo->specials_id)); 00483 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); 00484 $contents[] = array('text' => '<br><b>' . $sInfo->products_name . '</b>'); 00485 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00486 break; 00487 case 'pre_add': 00488 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_PRE_ADD_SPECIALS . '</b>'); 00489 $contents = array('form' => zen_draw_form('specials', FILENAME_SPECIALS, 'action=pre_add_confirmation' . ((isset($_GET['page']) && $_GET['page'] > 0) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))); 00490 $contents[] = array('text' => TEXT_INFO_PRE_ADD_INTRO); 00491 $contents[] = array('text' => '<br />' . TEXT_PRE_ADD_PRODUCTS_ID . '<br>' . zen_draw_input_field('pre_add_products_id', '', zen_set_field_length(TABLE_SPECIALS, 'products_id'))); 00492 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . ' <a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00493 break; 00494 default: 00495 if (is_object($sInfo)) { 00496 $heading[] = array('text' => '<b>' . $sInfo->products_name . '</b>'); 00497 00498 if ($sInfo->products_priced_by_attribute == '1') { 00499 $specials_current_price = zen_get_products_base_price($sInfo->products_id); 00500 } else { 00501 $specials_current_price = $sInfo->products_price; 00502 } 00503 00504 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=delete' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 00505 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=edit&products_filter=' . $sInfo->products_id) . '">' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '</a>'); 00506 $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->specials_date_added)); 00507 $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($sInfo->specials_last_modified)); 00508 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_info_image($sInfo->products_image, $sInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)); 00509 $contents[] = array('text' => '<br>' . TEXT_INFO_ORIGINAL_PRICE . ' ' . $currencies->format($specials_current_price)); 00510 $contents[] = array('text' => '' . TEXT_INFO_NEW_PRICE . ' ' . $currencies->format($sInfo->specials_new_products_price)); 00511 $contents[] = array('text' => '' . TEXT_INFO_DISPLAY_PRICE . ' ' . zen_get_products_display_price($sInfo->products_id)); 00512 00513 $contents[] = array('text' => '<br>' . TEXT_INFO_AVAILABLE_DATE . ' <b>' . (($sInfo->specials_date_available != '0001-01-01' and $sInfo->specials_date_available !='') ? zen_date_short($sInfo->specials_date_available) : TEXT_NONE) . '</b>'); 00514 $contents[] = array('text' => '<br>' . TEXT_INFO_EXPIRES_DATE . ' <b>' . (($sInfo->expires_date != '0001-01-01' and $sInfo->expires_date !='') ? zen_date_short($sInfo->expires_date) : TEXT_NONE) . '</b>'); 00515 $contents[] = array('text' => '' . TEXT_INFO_STATUS_CHANGE . ' ' . zen_date_short($sInfo->date_status_change)); 00516 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CATEGORIES, '&action=new_product' . '&cPath=' . zen_get_product_path($sInfo->products_id, 'override') . '&pID=' . $sInfo->products_id . '&product_type=' . zen_get_products_type($sInfo->products_id)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>'); 00517 00518 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_SPECIALS, 'action=pre_add' . ((isset($_GET['page']) && $_GET['page'] > 0) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_select.gif', IMAGE_SELECT) . '<br />' . TEXT_INFO_MANUAL . '</a><br /><br />'); 00519 } else { 00520 $heading[] = array('text' => '<b>' . TEXT_NONE . '</b>'); 00521 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_SPECIALS, 'action=pre_add' . ((isset($_GET['page']) && $_GET['page'] > 0) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_select.gif', IMAGE_SELECT) . '<br />' . TEXT_INFO_MANUAL . '</a><br /><br />'); 00522 } 00523 break; 00524 } 00525 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 00526 echo ' <td width="25%" valign="top">' . "\n"; 00527 00528 $box = new box; 00529 echo $box->infoBox($heading, $contents); 00530 00531 echo ' </td>' . "\n"; 00532 } 00533 } 00534 ?> 00535 </tr> 00536 </table></td> 00537 </tr> 00538 </table></td> 00539 <!-- body_text_eof //--> 00540 </tr> 00541 </table> 00542 <!-- body_eof //--> 00543 00544 <!-- footer //--> 00545 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 00546 <!-- footer_eof //--> 00547 </body> 00548 </html> 00549 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>