Execute("select products_id from " . TABLE_SPECIALS . " where specials_id = '" . $_GET['id'] . "'"); zen_update_products_price_sorter($update_price->fields['products_id']); zen_redirect(zen_href_link(FILENAME_SPECIALS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $_GET['id'], 'NONSSL')); break; case 'insert': if ($_POST['products_id'] < 1) { $messageStack->add_session(ERROR_NOTHING_SELECTED, 'caution'); } else { $products_id = zen_db_prepare_input($_POST['products_id']); $products_price = zen_db_prepare_input($_POST['products_price']); $tmp_value = zen_db_prepare_input($_POST['specials_price']); $specials_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value; if (substr($specials_price, -1) == '%') { $new_special_insert = $db->Execute("select products_id, products_price, products_priced_by_attribute from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); // check if priced by attribute if ($new_special_insert->fields['products_priced_by_attribute'] == '1') { $products_price = zen_get_products_base_price($products_id); } else { $products_price = $new_special_insert->fields['products_price']; } $specials_price = ($products_price - (($specials_price / 100) * $products_price)); } $specials_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start'])); $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end'])); $products_id = zen_db_prepare_input($_POST['products_id']); $db->Execute("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status, specials_date_available) values ('" . (int)$products_id . "', '" . zen_db_input($specials_price) . "', now(), '" . zen_db_input($expires_date) . "', '1', '" . zen_db_input($specials_date_available) . "')"); $new_special = $db->Execute("select specials_id from " . TABLE_SPECIALS . " where products_id='" . (int)$products_id . "'"); // reset products_price_sorter for searches etc. zen_update_products_price_sorter((int)$products_id); } // nothing selected if ($_GET['go_back'] == 'ON'){ zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_id)); } else { zen_redirect(zen_href_link(FILENAME_SPECIALS, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $new_special->fields['specials_id'])); } break; case 'update': $specials_id = zen_db_prepare_input($_POST['specials_id']); if ($_POST['products_priced_by_attribute'] == '1') { $products_price = zen_get_products_base_price($_POST['update_products_id']); } else { $products_price = zen_db_prepare_input($_POST['products_price']); } $tmp_value = zen_db_prepare_input($_POST['specials_price']); $specials_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value; if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price)); $specials_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start'])); $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end'])); $db->Execute("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . zen_db_input($specials_price) . "', specials_last_modified = now(), expires_date = '" . zen_db_input($expires_date) . "', specials_date_available = '" . zen_db_input($specials_date_available) . "' where specials_id = '" . (int)$specials_id . "'"); // reset products_price_sorter for searches etc. $update_price = $db->Execute("select products_id from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'"); zen_update_products_price_sorter($update_price->fields['products_id']); zen_redirect(zen_href_link(FILENAME_SPECIALS, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . 'sID=' . $specials_id)); break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action']= ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'])); } $specials_id = zen_db_prepare_input($_GET['sID']); // reset products_price_sorter for searches etc. $update_price = $db->Execute("select products_id from " . TABLE_SPECIALS . " where specials_id = '" . $specials_id . "'"); $update_price_id = $update_price->fields['products_id']; $db->Execute("delete from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'"); zen_update_products_price_sorter($update_price_id); zen_redirect(zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'])); break; case 'pre_add_confirmation': // check for blank or existing special $skip_special = false; if (empty($_POST['pre_add_products_id'])) { $skip_special = true; $messageStack->add_session(WARNING_SPECIALS_PRE_ADD_EMPTY, 'caution'); } if ($skip_special == false) { $sql = "select products_id from " . TABLE_PRODUCTS . " where products_id='" . (int)$_POST['pre_add_products_id'] . "'"; $check_special = $db->Execute($sql); if ($check_special->RecordCount() < 1) { $skip_special = true; $messageStack->add_session(WARNING_SPECIALS_PRE_ADD_BAD_PRODUCTS_ID, 'caution'); } } if ($skip_special == false) { $sql = "select specials_id from " . TABLE_SPECIALS . " where products_id='" . (int)$_POST['pre_add_products_id'] . "'"; $check_special = $db->Execute($sql); if ($check_special->RecordCount() > 0) { $skip_special = true; $messageStack->add_session(WARNING_SPECIALS_PRE_ADD_DUPLICATE, 'caution'); } } if ($skip_special == true) { zen_redirect(zen_href_link(FILENAME_SPECIALS, ((isset($_GET['page']) && $_GET['page'] > 0) ? 'page=' . $_GET['page'] : ''))); } // add empty special $specials_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start'])); $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end'])); $products_id = zen_db_prepare_input($_POST['pre_add_products_id']); $db->Execute("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status, specials_date_available) values ('" . (int)$products_id . "', '" . zen_db_input($specials_price) . "', now(), '" . zen_db_input($expires_date) . "', '0', '" . zen_db_input($specials_date_available) . "')"); $new_special = $db->Execute("select specials_id from " . TABLE_SPECIALS . " where products_id='" . (int)$products_id . "'"); $messageStack->add_session(SUCCESS_SPECIALS_PRE_ADD, 'success'); zen_redirect(zen_href_link(FILENAME_SPECIALS, 'action=edit' . '&sID=' . $new_special->fields['specials_id'])); break; } } ?> > <?php echo TITLE; ?>
Execute("select p.products_id, pd.products_name, p.products_price, p.products_priced_by_attribute, s.specials_new_products_price, s.expires_date, s.specials_date_available from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$_GET['sID'] . "'"); $sInfo = new objectInfo($product->fields); if ($sInfo->products_priced_by_attribute == '1') { $sInfo->products_price = zen_get_products_base_price($product->fields['products_id']); } } else { $sInfo = new objectInfo(array()); // create an array of products on special, which will be excluded from the pull down menu of products // (when creating a new product on special) $specials_array = array(); $specials = $db->Execute("select p.products_id, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id"); while (!$specials->EOF) { $specials_array[] = $specials->fields['products_id']; $specials->MoveNext(); } // never include Gift Vouchers for specials $gift_vouchers = $db->Execute("select distinct p.products_id, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where p.products_model rlike '" . "GIFT" . "'"); while (!$gift_vouchers->EOF) { if(substr($gift_vouchers->fields['products_model'], 0, 4) == 'GIFT') { $specials_array[] = $gift_vouchers->fields['products_id']; } $gift_vouchers->MoveNext(); } // do not include things that cannot go in the cart $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'"); while (!$not_for_cart->EOF) { $specials_array[] = $not_for_cart->fields['products_id']; $not_for_cart->MoveNext(); } } ?> method="post">
' . zen_image_button('button_reset.gif', IMAGE_RESET) . '  '; } echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id(); if (isset($_GET['search']) && zen_not_null($_GET['search'])) { $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); echo '
' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords; } ?>
0) ? 'page=' . $_GET['page'] . '&' : '') . 'action=new') . '">' . zen_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . ''; ?>

  products_name)) ? $sInfo->products_name . ' (' . $currencies->format($sInfo->products_price) . ')' : zen_draw_products_pull_down('products_id', 'size="5" style="font-size:10px"', $specials_array, true, $_GET['add_products_id'], true); echo zen_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?>
  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); ?>
 
 


' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''; ?>
'' . TEXT_INFO_HEADING_DELETE_SPECIALS . ''); $contents = array('form' => zen_draw_form('specials', FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '
' . $sInfo->products_name . ''); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'pre_add': $heading[] = array('text' => '' . TEXT_INFO_HEADING_PRE_ADD_SPECIALS . ''); $contents = array('form' => zen_draw_form('specials', FILENAME_SPECIALS, 'action=pre_add_confirmation')); $contents[] = array('text' => TEXT_INFO_PRE_ADD_INTRO); $contents[] = array('text' => '
' . TEXT_PRE_ADD_PRODUCTS_ID . '
' . zen_draw_input_field('pre_add_products_id', '', zen_set_field_length(TABLE_SPECIALS, 'products_id'))); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (is_object($sInfo)) { $heading[] = array('text' => '' . $sInfo->products_name . ''); if ($sInfo->products_priced_by_attribute == '1') { $specials_current_price = zen_get_products_base_price($sInfo->products_id); } else { $specials_current_price = $sInfo->products_price; } $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ''); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . ''); $contents[] = array('text' => '
' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->specials_date_added)); $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($sInfo->specials_last_modified)); $contents[] = array('align' => 'center', 'text' => '
' . zen_info_image($sInfo->products_image, $sInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)); $contents[] = array('text' => '
' . TEXT_INFO_ORIGINAL_PRICE . ' ' . $currencies->format($specials_current_price)); $contents[] = array('text' => '' . TEXT_INFO_NEW_PRICE . ' ' . $currencies->format($sInfo->specials_new_products_price)); $contents[] = array('text' => '' . TEXT_INFO_DISPLAY_PRICE . ' ' . zen_get_products_display_price($sInfo->products_id)); $contents[] = array('text' => '
' . TEXT_INFO_AVAILABLE_DATE . ' ' . (($specials->fields['specials_date_available'] != '0001-01-01' and $specials->fields['specials_date_available'] !='') ? zen_date_short($specials->fields['specials_date_available']) : TEXT_NONE) . ''); $contents[] = array('text' => '
' . TEXT_INFO_EXPIRES_DATE . ' ' . (($specials->fields['expires_date'] != '0001-01-01' and $specials->fields['expires_date'] !='') ? zen_date_short($specials->fields['expires_date']) : TEXT_NONE) . ''); $contents[] = array('text' => '' . TEXT_INFO_STATUS_CHANGE . ' ' . zen_date_short($sInfo->date_status_change)); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '
' . TEXT_PRODUCT_EDIT . '
'); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_select.gif', IMAGE_SELECT) . '
' . TEXT_INFO_MANUAL . '


'); } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo ' ' . "\n"; } } ?>
Execute($specials_query_raw); if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) { $check_count=1; while (!$check_page->EOF) { if ($check_page->fields['specials_id'] == $_GET['sID']) { break; } $check_count++; $check_page->MoveNext(); } $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0); $page = $_GET['page']; if ($old_page != $_GET['page']) { // do nothing } } else { $_GET['page'] = 1; } } // create split page control $specials_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $specials_query_raw, $specials_query_numrows); $specials = $db->Execute($specials_query_raw); while (!$specials->EOF) { if ((!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $specials->fields['specials_id']))) && !isset($sInfo)) { $products = $db->Execute("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$specials->fields['products_id'] . "'"); $sInfo_array = array_merge($specials->fields, $products->fields); $sInfo = new objectInfo($sInfo_array); } if (isset($sInfo) && is_object($sInfo) && ($specials->fields['specials_id'] == $sInfo->specials_id)) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } if ($specials->fields['products_priced_by_attribute'] == '1') { $specials_current_price = zen_get_products_base_price($specials->fields['products_id']); } else { $specials_current_price = $specials->fields['products_price']; } $sale_price = zen_get_products_special_price($specials->fields['products_id'], false); ?> MoveNext(); } ?>
    
fields['products_id']; ?>  fields['products_name']; ?> fields['products_model']; ?>  fields['products_id']); ?> fields['specials_date_available'] != '0001-01-01' and $specials->fields['specials_date_available'] !='') ? zen_date_short($specials->fields['specials_date_available']) : TEXT_NONE); ?> fields['expires_date'] != '0001-01-01' and $specials->fields['expires_date'] !='') ? zen_date_short($specials->fields['expires_date']) : TEXT_NONE); ?> fields['status'] == '1') { echo '' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . ''; } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . ''; } ?> fields['specials_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . ''; ?> fields['specials_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . ''; ?> fields['specials_id'] == $sInfo->specials_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?>
display_count($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?> display_links($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?>
0) ? 'page=' . $_GET['page'] . '&' : '') . 'action=new') . '">' . zen_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . ''; ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '