[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 products_price_manager.php

Zen Cart 源代码 products_price_manager.php




下载文件

文件名: products_price_manager.php
文件类型: PHP文件
文件大小: 54.44 KiB
MD5: e5a6029195b6018472c0e6f80b38eca2

products_price_manager.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2013 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version GIT: $Id: Author: ajeh  Wed Jun 26 11:54:36 2013 -0400 Modified in v1.5.2 $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   // verify products exist
  13.   $chk_products = $db->Execute("select * from " . TABLE_PRODUCTS . " limit 1");
  14.   if ($chk_products->RecordCount() < 1) {
  15.     $messageStack->add_session(ERROR_DEFINE_PRODUCTS, 'caution');
  16.     zen_redirect(zen_href_link(FILENAME_CATEGORIES));
  17.   }
  18.  
  19.   require(DIR_WS_CLASSES . 'currencies.php');
  20.   $currencies = new currencies();
  21.  
  22.   $products_filter = (isset($_GET['products_filter'])) ? (int)$_GET['products_filter'] : 0;
  23.  
  24.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  25.  
  26.   $current_category_id = (isset($_GET['current_category_id']) ? (int)$_GET['current_category_id'] : 0);
  27.  
  28.   if ($action == 'new_cat') {
  29.     $current_category_id = (isset($_GET['current_category_id']) ? (int)$_GET['current_category_id'] : $current_category_id);
  30.     $sql = "SELECT ptc.*
  31.            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
  32.            LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd
  33.            ON ptc.products_id = pd.products_id
  34.            AND pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  35.            LEFT join " . TABLE_PRODUCTS . " p
  36.            ON p.products_id = pd.products_id
  37.            LEFT JOIN " . TABLE_PRODUCT_TYPES  . " pt
  38.            ON p.products_type = pt.type_id
  39.            WHERE ptc.categories_id='" . $current_category_id . "'
  40.            AND pt.allow_add_to_cart = 'Y'
  41.            ORDER by pd.products_name";
  42.     $new_product_query = $db->Execute($sql);
  43.     $products_filter = (!$new_product_query->EOF) ? $new_product_query->fields['products_id'] : '';
  44.     zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  45.   }
  46.  
  47. // set categories and products if not set
  48.   if ($products_filter == '' and $current_category_id != '') {
  49.     $sql = "SELECT ptc.*
  50.            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
  51.            LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd
  52.            ON ptc.products_id = pd.products_id
  53.            AND pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  54.            LEFT join " . TABLE_PRODUCTS . " p
  55.            ON p.products_id = pd.products_id
  56.            LEFT JOIN " . TABLE_PRODUCT_TYPES  . " pt
  57.            ON p.products_type = pt.type_id
  58.            WHERE ptc.categories_id='" . $current_category_id . "'
  59.            AND pt.allow_add_to_cart = 'Y'
  60.            ORDER by pd.products_name";
  61.     $new_product_query = $db->Execute($sql);
  62.     $products_filter = (!$new_product_query->EOF) ? $new_product_query->fields['products_id'] : '';
  63.     if ($products_filter != '') {
  64.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  65.     }
  66.   } else {
  67.     if ($products_filter == '' and $current_category_id == '') {
  68.       $reset_categories_id = zen_get_category_tree('', '', '0', '', '', true);
  69.       $current_category_id = $reset_categories_id[0]['id'];
  70.       $sql = "SELECT ptc.*
  71.            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
  72.            LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd
  73.            ON ptc.products_id = pd.products_id
  74.            AND pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  75.            LEFT join " . TABLE_PRODUCTS . " p
  76.            ON p.products_id = pd.products_id
  77.            LEFT JOIN " . TABLE_PRODUCT_TYPES  . " pt
  78.            ON p.products_type = pt.type_id
  79.            WHERE ptc.categories_id='" . $current_category_id . "'
  80.            AND pt.allow_add_to_cart = 'Y'
  81.            ORDER by pd.products_name";
  82.       $new_product_query = $db->Execute($sql);
  83.       $products_filter = (!$new_product_query->EOF) ? $new_product_query->fields['products_id'] : '';
  84.       $_GET['products_filter'] = $products_filter;
  85.     }
  86.   }
  87.  
  88.   require(DIR_WS_MODULES . FILENAME_PREV_NEXT);
  89.  
  90.   if ($action == 'delete_special_confirm')
  91.   {
  92.     if (isset($_POST['product_id']))
  93.     {
  94.       $delete_special = $db->Execute("delete from " . TABLE_SPECIALS . " where products_id='" . (int)$_POST['product_id'] . "'");
  95.  
  96.       // reset products_price_sorter for searches etc.
  97.       zen_update_products_price_sorter($products_filter);
  98.  
  99.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  100.     }
  101.   }
  102.  
  103.   if ($action == 'delete_featured_confirm') {
  104.     if (isset($_POST['product_id']))
  105.     {
  106.       $delete_featured = $db->Execute("delete from " . TABLE_FEATURED . " where products_id='" . (int)$_POST['product_id'] . "'");
  107.  
  108.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  109.     }
  110.   }
  111.  
  112.   if ($action == 'add_discount_qty_id') {
  113.     $add_id = $db->Execute("select discount_id from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " where products_id='" . $products_filter . "' order by discount_id desc limit 1");
  114.     $add_cnt = 1;
  115.     $add_id = $add_id->fields['discount_id'];
  116.     while ($add_cnt <= DISCOUNT_QTY_ADD) {
  117.       $db->Execute("insert into " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . "
  118.                    (discount_id, products_id)
  119.                    values ('" . ($add_id + $add_cnt) . "', '" . $products_filter . "')");
  120.       $add_cnt++;
  121.     }
  122.     zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=edit' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  123.   }
  124.  
  125.   if (zen_not_null($action)) {
  126.     switch ($action) {
  127.       case ('update'):
  128.  
  129.         if ($_POST['master_category']) {
  130.           $master_categories_id = $_POST['master_category'];
  131.         } else {
  132.           $master_categories_id = $_POST['master_categories_id'];
  133.         }
  134.  
  135.         $products_date_available = ((zen_db_prepare_input($_POST['product_start']) == '') ? '0001-01-01' : zen_date_raw($_POST['product_start']));
  136.  
  137.         $specials_date_available = ((zen_db_prepare_input($_POST['special_start']) == '') ? '0001-01-01' : zen_date_raw($_POST['special_start']));
  138.         $specials_expires_date = ((zen_db_prepare_input($_POST['special_end']) == '') ? '0001-01-01' : zen_date_raw($_POST['special_end']));
  139.  
  140.         $featured_date_available = ((zen_db_prepare_input($_POST['featured_start']) == '') ? '0001-01-01' : zen_date_raw($_POST['featured_start']));
  141.         $featured_expires_date = ((zen_db_prepare_input($_POST['featured_end']) == '') ? '0001-01-01' : zen_date_raw($_POST['featured_end']));
  142.  
  143.         $tmp_value = zen_db_prepare_input($_POST['products_price_sorter']);
  144.         $products_price_sorter = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
  145.  
  146.         $sql = "update " . TABLE_PRODUCTS . " set
  147.            products_price=:price:,
  148.            products_tax_class_id=:taxClass:,
  149.            products_date_available=:dateAvailable:,
  150.            products_last_modified=now(),
  151.            products_status=:status:,
  152.            products_quantity_order_min=:orderMin:,
  153.            products_quantity_order_units=:orderUnits:,
  154.            products_quantity_order_max=:orderMax:,
  155.            product_is_free=:isFree:,
  156.            product_is_call=:isCall:,
  157.            products_quantity_mixed=:qtyMixed:,
  158.            products_priced_by_attribute=:pricedByAttr:,
  159.            products_discount_type=:discType:,
  160.            products_discount_type_from=:discTypeFrom:,
  161.            products_price_sorter=:discPriceSorter:,
  162.            master_categories_id=:masterCatId:,
  163.            products_mixed_discount_quantity=:discQty:
  164.            where products_id='" . $products_filter . "'";
  165.  
  166.         $sql = $db->bindVars($sql, ':price:', $_POST['products_price'], 'string');
  167.         $sql = $db->bindVars($sql, ':taxClass:', $_POST['products_tax_class_id'], 'integer');
  168.         $sql = $db->bindVars($sql, ':dateAvailable:', $products_date_available, 'string');
  169.         $sql = $db->bindVars($sql, ':status:', $_POST['products_status'], 'integer');
  170.         $sql = $db->bindVars($sql, ':orderMin:', $_POST['products_quantity_order_min'], 'string');
  171.         $sql = $db->bindVars($sql, ':orderUnits:', $_POST['products_quantity_order_units'], 'string');
  172.         $sql = $db->bindVars($sql, ':orderMax:', $_POST['products_quantity_order_max'], 'string');
  173.         $sql = $db->bindVars($sql, ':isFree:', $_POST['product_is_free'], 'integer');
  174.         $sql = $db->bindVars($sql, ':isCall:', $_POST['product_is_call'], 'integer');
  175.         $sql = $db->bindVars($sql, ':qtyMixed:', $_POST['products_quantity_mixed'], 'integer');
  176.         $sql = $db->bindVars($sql, ':pricedByAttr:', $_POST['products_priced_by_attribute'], 'integer');
  177.         $sql = $db->bindVars($sql, ':discType:', $_POST['products_discount_type'], 'integer');
  178.         $sql = $db->bindVars($sql, ':discTypeFrom:', $_POST['products_discount_type_from'], 'integer');
  179.         $sql = $db->bindVars($sql, ':discPriceSorter:', $products_price_sorter, 'string');
  180.         $sql = $db->bindVars($sql, ':masterCatId:', $master_categories_id, 'integer');
  181.         $sql = $db->bindVars($sql, ':discQty:', $_POST['products_mixed_discount_quantity'], 'integer');
  182.  
  183.         $db->Execute($sql);
  184.  
  185.         if ($_POST['specials_id'] != '') {
  186.  
  187.           $specials_id = zen_db_prepare_input($_POST['specials_id']);
  188.  
  189.           if ($_POST['products_priced_by_attribute'] == '1') {
  190.             $products_price = zen_get_products_base_price($products_filter);
  191.           } else {
  192.             $products_price = zen_db_prepare_input($_POST['products_price']);
  193.           }
  194.  
  195.           $specials_price = zen_db_prepare_input($_POST['specials_price']);
  196.           if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));
  197.           $db->Execute("update " . TABLE_SPECIALS . " set
  198.              specials_new_products_price='" . zen_db_input($specials_price) . "',
  199.              specials_date_available='" . zen_db_input($specials_date_available) . "',
  200.              specials_last_modified=now(),
  201.              expires_date='" . zen_db_input($specials_expires_date) . "',
  202.              status='" . zen_db_input($_POST['special_status']) . "'
  203.              where products_id='" . $products_filter . "'");
  204.         }
  205.  
  206.         if ($_POST['featured_id'] != '') {
  207.  
  208.         $db->Execute("update " . TABLE_FEATURED . " set
  209.            featured_date_available='" . zen_db_input($featured_date_available) . "',
  210.            expires_date='" . zen_db_input($featured_expires_date) . "',
  211.            featured_last_modified=now(),
  212.            status='" . zen_db_input($_POST['featured_status']) . "'
  213.            where products_id='" . $products_filter . "'");
  214.         }
  215.  
  216.         $db->Execute("delete from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " where products_id='" . $products_filter . "'");
  217.         $i=1;
  218.         $new_id = 0;
  219.         $discount_cnt = 0;
  220.         for ($i=1, $n=sizeof($_POST['discount_qty']); $i<=$n; $i++) {
  221.           if ($_POST['discount_qty'][$i] > 0) {
  222.             $new_id++;
  223.             $db->Execute("insert into " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . "
  224.                          (discount_id, products_id, discount_qty, discount_price)
  225.                          values ('" . $new_id . "', '" . $products_filter . "', '" . zen_db_input($_POST['discount_qty'][$i]) . "', '" . zen_db_input($_POST['discount_price'][$i]) . "')");
  226.             $discount_cnt++;
  227.           } else {
  228.             loop;
  229.           }
  230.         }
  231.  
  232.         if ($discount_cnt <= 0) {
  233.           $db->Execute("update " . TABLE_PRODUCTS . " set products_discount_type='0' where products_id='" . $products_filter . "'");
  234.         }
  235.  
  236.         // reset products_price_sorter for searches etc.
  237.         zen_update_products_price_sorter($products_filter);
  238.         $messageStack->add_session(PRODUCT_UPDATE_SUCCESS, 'success');
  239.  
  240.         zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  241.         break;
  242.       case 'set_products_filter':
  243.         $_GET['products_filter'] = $_POST['products_filter'];
  244.  
  245.         zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_POST['current_category_id']));
  246.         break;
  247.  
  248.       case 'edit':
  249.       // set edit message
  250.       $messageStack->add_session(PRODUCT_WARNING_UPDATE, 'caution');
  251.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=edit_update' . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $current_category_id));
  252.       break;
  253.       case 'cancel':
  254.       // set edit message
  255.       $messageStack->add_session(PRODUCT_WARNING_UPDATE_CANCEL, 'warning');
  256.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $current_category_id));
  257.       break;
  258.     }
  259.   }
  260.  
  261. ?>
  262. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  263. <html <?php echo HTML_PARAMS; ?>>
  264. <head>
  265. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  266. <title><?php echo TITLE; ?></title>
  267. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  268. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  269. <script language="javascript" src="includes/menu.js"></script>
  270. <script language="javascript" src="includes/general.js"></script>
  271. <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
  272. <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
  273.  
  274. <script type="text/javascript">
  275.   <!--
  276.   function init()
  277.   {
  278.     cssjsmenu('navbar');
  279.     if (document.getElementById)
  280.     {
  281.       var kill = document.getElementById('hoverJS');
  282.       kill.disabled = true;
  283.     }
  284.   }
  285.   // -->
  286. </script>
  287. </head>
  288. <body onLoad="init()">
  289. <div id="spiffycalendar" class="text"></div>
  290. <!-- header //-->
  291. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  292. <!-- header_eof //-->
  293.  
  294. <!-- body //-->
  295. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  296.   <tr>
  297. <!-- body_text //-->
  298.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  299.               <tr>
  300.                 <td class="smallText" align="right">
  301. <?php
  302.     echo zen_draw_form('search', FILENAME_CATEGORIES, '', 'get');
  303. // show reset search
  304.     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  305.       echo '<a href="' . zen_href_link(FILENAME_CATEGORIES) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
  306.     }
  307.     echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
  308.     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  309.       $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  310.       echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  311.     }
  312.     echo '</form>';
  313. ?>
  314.                 </td>
  315.               </tr>
  316. <?php
  317. ///////////////////////////////////////////////////////////
  318. // BOF: NEW CODE TO KEEP
  319. ?>
  320.  
  321. <?php
  322.   if ($action != 'edit_update') {
  323.     require(DIR_WS_MODULES . FILENAME_PREV_NEXT_DISPLAY);
  324. ?>
  325.  
  326.       <tr>
  327.       <?php echo zen_draw_form('set_products_filter', FILENAME_PRODUCTS_PRICE_MANAGER, 'action=set_products_filter', 'post'); ?>
  328.       <?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?><?php echo zen_draw_hidden_field('current_category_id', $_GET['current_category_id']); ?>
  329.         <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  330.  
  331. <?php
  332. if ($_GET['products_filter'] != '') {
  333. ?>
  334.           <tr>
  335.             <td class="main" width="200" align="left" valign="top">&nbsp;</td>
  336.             <td colspan="2" class="main"><?php echo TEXT_PRODUCT_TO_VIEW; ?></td>
  337.           </tr>
  338.           <tr>
  339.             <td class="main" width="200" align="center" valign="top">
  340.  
  341. <?php
  342. // FIX HERE
  343.   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
  344.   echo ($display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '');
  345.   echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
  346.   echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
  347.   $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'");
  348.   while (!$not_for_cart->EOF) {
  349.     $not_for_cart_array[] = $not_for_cart->fields['products_id'];
  350.     $not_for_cart->MoveNext();
  351.    }
  352. ?>
  353.             </td>
  354.             <td class="attributes-even" align="center"><?php echo zen_draw_products_pull_down('products_filter', 'size="10"', $not_for_cart->fields, true, $_GET['products_filter'], true, true); ?></td>
  355.             <td class="main" align="center" valign="top">
  356.               <?php
  357.                 echo zen_image_submit('button_display.gif', IMAGE_DISPLAY);
  358.               ?>
  359.             </td>
  360.           </tr>
  361. <?php
  362. } else {
  363.   $not_for_cart = '';
  364. } // $_GET['products_filter'] != ''
  365. ?>
  366.         <tr>
  367.           <td colspan="3">
  368.             <table>
  369.  
  370. <?php
  371. // show when product is linked
  372. if ($products_filter != '' && zen_get_product_is_linked($products_filter) == 'true') {
  373. ?>
  374.               <tr>
  375.                 <td class="main" align="center" valign="bottom">
  376.                   <?php echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;' . TEXT_LEGEND_LINKED . ' ' . zen_get_product_is_linked($products_filter, 'true'); ?>
  377.                 </td>
  378.               </tr>
  379. <?php } ?>
  380.               <tr>
  381.                 <td class="main" align="center" valign="bottom">
  382. <?php
  383.   if ($_GET['products_filter'] != '') {
  384.     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . zen_get_product_path($products_filter) . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_details.gif', IMAGE_DETAILS) . '<br />' . TEXT_PRODUCT_DETAILS . '</a>' . '&nbsp;&nbsp;&nbsp;';
  385.     echo '</td><td class="main" align="center" valign="bottom">';
  386.     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . zen_get_product_path($products_filter) . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>';
  387.     echo '</td><td class="main" align="center" valign="bottom">';
  388.     echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id, 'NONSSL') . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '<br />' . TEXT_ATTRIBUTE_EDIT . '</a>' . '&nbsp;&nbsp;&nbsp;';
  389.   }
  390. ?>
  391.                 </td>
  392.               </tr>
  393. <?php if ($products_filter != '') { ?>
  394.             <tr>
  395.             <td class="smallText" align="center" colspan="3"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, '&products_filter=' . $products_filter) . '">' . IMAGE_PRODUCTS_TO_CATEGORIES . '</a>'; ?></td>
  396.             </tr>
  397. <?php } ?>
  398.             </table>
  399.           </td>
  400.         </tr>
  401.  
  402.         </table></td>
  403.       </form></tr>
  404. <?php } // $action != 'edit_update' ?>
  405. <?php
  406. // EOF: NEW CODE TO KEEP
  407. ///////////////////////////////////////////////////////////
  408. ?>
  409. <?php
  410. // start of attributes display
  411. if ($products_filter == '') {
  412. ?>
  413.       <tr>
  414.         <td colspan="2" class="pageHeading" align="center" valign="middle" height="200"><?php echo HEADING_TITLE_PRODUCT_SELECT; ?></td>
  415.       </tr>
  416. <?php } ?>
  417.  
  418. <?php
  419. // only show if allowed in cart
  420.   if ($zc_products->get_allow_add_to_cart($products_filter) == 'Y') {
  421. ?>
  422.  
  423. <?php
  424. // featured information
  425.       $product = $db->Execute("select p.products_id,
  426.                                      f.featured_id, f.expires_date, f.featured_date_available, f.status
  427.                               from " . TABLE_PRODUCTS . " p, " .
  428.                                         TABLE_FEATURED . " f
  429.                               where p.products_id = f.products_id
  430.                               and f.products_id = '" . (int)$_GET['products_filter'] . "'");
  431.  
  432.       if ($product->RecordCount() > 0) {
  433.         $fInfo = new objectInfo($product->fields);
  434.       } else {
  435.         $fInfo = new stdClass();
  436.       }
  437.  
  438. // specials information
  439.       $product = $db->Execute("select p.products_id,
  440.                                      s.specials_id, s.specials_new_products_price, s.expires_date, s.specials_date_available, s.status
  441.                               from " . TABLE_PRODUCTS . " p, " .
  442.                                         TABLE_SPECIALS . " s
  443.                               where p.products_id = s.products_id
  444.                               and s.products_id = '" . (int)$_GET['products_filter'] . "'");
  445.  
  446.       if ($product->RecordCount() > 0) {
  447.         $sInfo = new objectInfo($product->fields);
  448.       } else {
  449.         $sInfo = new stdClass();
  450.       }
  451.  
  452. // products information
  453.       $product = $db->Execute("select p.products_id, p.products_model,
  454.                                      p.products_price, p.products_date_available,
  455.                                      p.products_tax_class_id,
  456.                                      p.products_quantity_order_min, products_quantity_order_units, p.products_quantity_order_max,
  457.                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.products_priced_by_attribute, p.products_status,
  458.                                      p.products_discount_type, p.products_discount_type_from, p.products_price_sorter,
  459.                                      pd.products_name,
  460.                                      p.master_categories_id, p.products_mixed_discount_quantity
  461.                               from " . TABLE_PRODUCTS . " p, " .
  462.                                         TABLE_PRODUCTS_DESCRIPTION . " pd
  463.                               where p.products_id = '" . (int)$_GET['products_filter'] . "'
  464.                               and p.products_id = pd.products_id
  465.                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
  466.  
  467.       if ($product->RecordCount() > 0) {
  468.         $pInfo = new objectInfo($product->fields);
  469.       } else {
  470.         $pInfo = new stdClass();
  471.       }
  472.  
  473. // set statuses
  474.       if (!isset($pInfo->products_status)) $pInfo->products_status = '1';
  475.         switch ($pInfo->products_status) {
  476.         case '0': $products_in_status = false; $products_out_status = true; break;
  477.         case '1':
  478.         default: $products_in_status = true; $products_out_status = false;
  479.       }
  480.       if (!isset($fInfo->status)) $fInfo->status = '1';
  481.         switch ($fInfo->status) {
  482.         case '0': $featured_in_status = false; $featured_out_status = true; break;
  483.         case '1':
  484.         default: $featured_in_status = true; $featured_out_status = false;
  485.       }
  486.       if (!isset($sInfo->status)) $sInfo->status = '1';
  487.         switch ($sInfo->status) {
  488.         case '0': $special_in_status = false; $special_out_status = true; break;
  489.         case '1':
  490.         default: $special_in_status = true; $special_out_status = false;
  491.       }
  492.  
  493. // Product is Priced by Attributes
  494.     if (!isset($pInfo->products_priced_by_attribute)) $pInfo->products_priced_by_attribute = '0';
  495.     switch ($pInfo->products_priced_by_attribute) {
  496.       case '0': $is_products_priced_by_attribute = false; $not_products_priced_by_attribute = true; break;
  497.       case '1': $is_products_priced_by_attribute = true; $not_products_priced_by_attribute = false; break;
  498.       default: $is_products_priced_by_attribute = false; $not_products_priced_by_attribute = true;
  499.     }
  500. // Product is Free
  501.     if (!isset($pInfo->product_is_free)) $pInfo->product_is_free = '0';
  502.     switch ($pInfo->product_is_free) {
  503.       case '0': $in_product_is_free = false; $out_product_is_free = true; break;
  504.       case '1': $in_product_is_free = true; $out_product_is_free = false; break;
  505.       default: $in_product_is_free = false; $out_product_is_free = true;
  506.     }
  507. // Product is Call for price
  508.     if (!isset($pInfo->product_is_call)) $pInfo->product_is_call = '0';
  509.     switch ($pInfo->product_is_call) {
  510.       case '0': $in_product_is_call = false; $out_product_is_call = true; break;
  511.       case '1': $in_product_is_call = true; $out_product_is_call = false; break;
  512.       default: $in_product_is_call = false; $out_product_is_call = true;
  513.     }
  514. // Products can be purchased with mixed attributes retail
  515.     if (!isset($pInfo->products_quantity_mixed)) $pInfo->products_quantity_mixed = '0';
  516.     switch ($pInfo->products_quantity_mixed) {
  517.       case '0': $in_products_quantity_mixed = false; $out_products_quantity_mixed = true; break;
  518.       case '1': $in_products_quantity_mixed = true; $out_products_quantity_mixed = false; break;
  519.       default: $in_products_quantity_mixed = true; $out_products_quantity_mixed = false;
  520.     }
  521. // Products can be purchased with mixed attributes for discount
  522.     if (!isset($pInfo->products_mixed_discount_quantity)) $pInfo->products_mixed_discount_quantity = '1';
  523.     switch ($pInfo->products_mixed_discount_quantity) {
  524.       case '0': $in_products_mixed_discount_quantity = false; $out_products_mixed_discount_quantity = true; break;
  525.       case '1': $in_products_mixed_discount_quantity = true; $out_products_mixed_discount_quantity = false; break;
  526.       default: $in_products_mixed_discount_quantity = true; $out_products_mixed_discount_quantity = false;
  527.     }
  528.  
  529. // Product is product discount type - None, Percentage, Actual Price, $$ off
  530.   $discount_type_array = array(array('id' => '0', 'text' => DISCOUNT_TYPE_DROPDOWN_0),
  531.                                 array('id' => '1', 'text' => DISCOUNT_TYPE_DROPDOWN_1),
  532.                                 array('id' => '2', 'text' => DISCOUNT_TYPE_DROPDOWN_2),
  533.                                 array('id' => '3', 'text' => DISCOUNT_TYPE_DROPDOWN_3));
  534.  
  535. // Product is product discount type from price or special
  536.   $discount_type_from_array = array(array('id' => '0', 'text' => DISCOUNT_TYPE_FROM_DROPDOWN_0),
  537.                               array('id' => '1', 'text' => DISCOUNT_TYPE_FROM_DROPDOWN_1));
  538.  
  539. // tax class id
  540.     $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
  541.     $tax_class = $db->Execute("select tax_class_id, tax_class_title
  542.                                     from " . TABLE_TAX_CLASS . " order by tax_class_title");
  543.     while (!$tax_class->EOF) {
  544.       $tax_class_array[] = array('id' => $tax_class->fields['tax_class_id'],
  545.                                  'text' => $tax_class->fields['tax_class_title']);
  546.       $tax_class->MoveNext();
  547.     }
  548. ?>
  549. <?php if ($pInfo->products_id != '') { ?>
  550. <script language="javascript">
  551. var ProductStartDate = new ctlSpiffyCalendarBox("ProductStartDate", "new_prices", "product_start", "btnDate1","<?php echo (($pInfo->products_date_available <= '0001-01-01') ? '' : zen_date_short($pInfo->products_date_available)); ?>",scBTNMODE_CUSTOMBLUE);
  552. </script>
  553. <?php } ?>
  554.  
  555. <?php if ($fInfo->products_id != '') { ?>
  556. <script language="javascript">
  557. var FeaturedStartDate = new ctlSpiffyCalendarBox("FeaturedStartDate", "new_prices", "featured_start", "btnDate2","<?php echo (($fInfo->featured_date_available <= '0001-01-01') ? '' : zen_date_short($fInfo->featured_date_available)); ?>",scBTNMODE_CUSTOMBLUE);
  558. var FeaturedEndDate = new ctlSpiffyCalendarBox("FeaturedEndDate", "new_prices", "featured_end", "btnDate3","<?php echo (($fInfo->expires_date <= '0001-01-01') ? '' : zen_date_short($fInfo->expires_date)); ?>",scBTNMODE_CUSTOMBLUE);
  559. </script>
  560. <?php } ?>
  561.  
  562. <?php if ($sInfo->products_id != '') { ?>
  563. <script language="javascript">
  564. var SpecialStartDate = new ctlSpiffyCalendarBox("SpecialStartDate", "new_prices", "special_start", "btnDate4","<?php echo (($sInfo->specials_date_available <= '0001-01-01') ? '' : zen_date_short($sInfo->specials_date_available)); ?>",scBTNMODE_CUSTOMBLUE);
  565. var SpecialEndDate = new ctlSpiffyCalendarBox("SpecialEndDate", "new_prices", "special_end", "btnDate5","<?php echo (($sInfo->expires_date <= '0001-01-01') ? '' : zen_date_short($sInfo->expires_date)); ?>",scBTNMODE_CUSTOMBLUE);
  566. </script>
  567. <?php } ?>
  568.  
  569. <?php
  570. // auto fix bad or missing products master_categories_id
  571.   if (zen_get_product_is_linked($products_filter) == 'false' and $pInfo->master_categories_id != zen_get_products_category_id($products_filter)) {
  572.     $sql = "update " . TABLE_PRODUCTS . " set master_categories_id='" . zen_get_products_category_id($products_filter) . "' where products_id='" . $products_filter . "'";
  573.     $db->Execute($sql);
  574.     $pInfo->master_categories_id = zen_get_products_category_id($products_filter);
  575.   }
  576. ?>
  577.  
  578. <?php
  579.   if ($pInfo->products_id != '') {
  580. ?>
  581.       <tr>
  582.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  583.       </tr>
  584.       <tr>
  585.         <td class="pageHeading"><?php echo TEXT_PRODUCT_INFO . ' #' . $pInfo->products_id . '&nbsp;&nbsp;' . $pInfo->products_name; ?>&nbsp;&nbsp;&nbsp;<?php echo TEXT_PRODUCTS_MODEL . ' ' . $pInfo->products_model; ?></td>
  586.       </tr>
  587.       <tr>
  588.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  589.       </tr>
  590.       <?php if ($action == 'delete_special') { ?>
  591.       <tr>
  592.         <td>
  593.           <table border="0" cellspacing="2" cellpadding="2">
  594.             <tr class="pageHeading">
  595.               <td class="alert" align="center" colspan="2"><?php echo TEXT_SPECIALS_CONFIRM_DELETE; ?></td>
  596.             </tr>
  597.             <tr>
  598.               <td class="main" align="left">
  599.               <?php echo zen_draw_form('delete_special', FILENAME_PRODUCTS_PRICE_MANAGER, 'action=delete_special_confirm&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']); ?>
  600.               <input type="hidden" name="product_id" value="<?php echo $_GET['products_filter']; ?>" />
  601.               <?php echo zen_image_submit('button_delete.gif', IMAGE_REMOVE_SPECIAL); ?>&nbsp;&nbsp;<a href="<?php echo zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']); ?>"><?php echo zen_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>
  602.               </td>
  603.             </tr>
  604.           </table>
  605.       </td>
  606.       </tr>
  607.       <?php } ?>
  608.       <?php if ($action == 'delete_featured') { ?>
  609.       <tr>
  610.         <td>
  611.           <table border="0" cellspacing="2" cellpadding="2">
  612.             <tr class="pageHeading">
  613.               <td class="alert" align="center" colspan="2"><?php echo TEXT_FEATURED_CONFIRM_DELETE; ?></td>
  614.             </tr>
  615.             <tr>
  616.               <td class="main" align="left">
  617.               <?php echo zen_draw_form('delete_special', FILENAME_PRODUCTS_PRICE_MANAGER, 'action=delete_featured_confirm&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']); ?>
  618.               <input type="hidden" name="product_id" value="<?php echo $_GET['products_filter']; ?>" />
  619.               <?php echo zen_image_submit('button_delete.gif', IMAGE_REMOVE_FEATURED); ?>&nbsp;&nbsp;<a href="<?php echo zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']); ?>"><?php echo zen_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>
  620.               </td>
  621.             </tr>
  622.           </table>
  623.       </td>
  624.       </tr>
  625.       <?php } ?>
  626.  
  627.       <?php echo zen_draw_form('new_prices', FILENAME_PRODUCTS_PRICE_MANAGER, zen_get_all_get_params(array('action', 'info', $_GET['products_filter'])) . 'action=' . 'update', 'post'); ?>
  628.       <?php echo zen_draw_hidden_field('products_id', $_GET['products_filter']); echo zen_draw_hidden_field('specials_id', $sInfo->specials_id); echo zen_draw_hidden_field('featured_id', $fInfo->featured_id); echo zen_draw_hidden_field('discounts_list', $discounts_qty); ?>
  629.       <tr>
  630.         <td colspan="4"><table border="0" cellspacing="0" cellpadding="2" align="center" width="100%">
  631.           <tr>
  632.             <td class="pageHeading" align="center" valign="middle">
  633.               <?php echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : ''); ?>
  634.             </td>
  635.           </tr>
  636.           <tr>
  637.             <td class="main" align="center" valign="middle">
  638.             <?php
  639.             if ($action == '' || $action == 'delete_special' || $action == 'delete_featured') {
  640.               echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=edit' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT_PRODUCT) . '</a>' . '<br />' . TEXT_INFO_EDIT_CAUTION;
  641.             } else {
  642.               echo zen_image_submit('button_update.gif', IMAGE_UPDATE_PRICE_CHANGES) . '&nbsp;&nbsp;' . '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=cancel' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>' . '<br />' . TEXT_UPDATE_COMMIT;
  643.             }
  644.             ?>
  645.             </td>
  646.           </tr>
  647.           <tr>
  648.             <td colspan="2"><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  649.           </tr>
  650.         </table></td>
  651.       </tr>
  652.  
  653.       <tr>
  654.         <td><table border="0" cellspacing="0" cellpadding="2">
  655.  
  656. <?php
  657. // show when product is linked
  658. if (zen_get_product_is_linked($products_filter) == 'true') {
  659. ?>
  660.           <tr>
  661.             <td class="main" width="200"><?php echo TEXT_MASTER_CATEGORIES_ID; ?></td>
  662.             <td colspan="4" class="main">
  663.               <?php
  664.                 // echo zen_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id);
  665.                 echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;';
  666.                 echo zen_draw_pull_down_menu('master_category', zen_get_master_categories_pulldown($products_filter), $pInfo->master_categories_id); ?>
  667.             </td>
  668.           </tr>
  669.           <tr>
  670.             <td colspan="5" class="main"><?php echo TEXT_INFO_MASTER_CATEGORIES_ID; ?></td>
  671.           </tr>
  672.           <tr>
  673.             <td colspan="5" class="main" align="center"><?php echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : TEXT_INFO_UPDATE_REMINDER); ?></td>
  674.           </tr>
  675. <?php } // master category linked ?>
  676.  
  677. <?php
  678. if (zen_get_product_is_linked($products_filter) == 'false' and $pInfo->master_categories_id != zen_get_products_category_id($products_filter)) {
  679. ?>
  680.           <tr>
  681.             <td colspan="5" class="main"><span class="alert">
  682.               <?php echo sprintf(TEXT_INFO_MASTER_CATEGORIES_ID_WARNING, $pInfo->master_categories_id, zen_get_products_category_id($products_filter)); ?></span>
  683.               <br /><strong><?php echo sprintf(TEXT_INFO_MASTER_CATEGORIES_ID_UPDATE_TO_CURRENT, $pInfo->master_categories_id, zen_get_products_category_id($products_filter)); ?></strong>
  684.             </td>
  685.          </tr>
  686. <?php } ?>
  687. <?php
  688. echo zen_draw_hidden_field('master_categories_id', $pInfo->master_categories_id);
  689. ?>
  690.  
  691.  
  692.           <tr>
  693.             <td class="main" width="200"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>
  694.             <td colspan="4" class="main"><?php echo zen_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id); ?></td>
  695.           </tr>
  696.           <tr>
  697.             <td class="main" width="200"><?php echo TEXT_PRODUCTS_PRICE_INFO; ?></td>
  698.             <td class="main"><?php echo TEXT_PRICE . '<br />' . zen_draw_input_field('products_price', (isset($pInfo->products_price) ? $pInfo->products_price : '')); ?></td>
  699.             <td class="main"><?php echo TEXT_PRODUCT_AVAILABLE_DATE; ?><br /><script language="javascript">ProductStartDate.writeControl(); ProductStartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  700.             <td colspan="2" class="main"><?php echo zen_draw_radio_field('products_status', '1', $products_in_status) . '&nbsp;' . TEXT_PRODUCT_AVAILABLE . '<br />' . zen_draw_radio_field('products_status', '0', $products_out_status) . '&nbsp;' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td>
  701.           </tr>
  702.  
  703.           <tr>
  704.             <td class="main" width="200">&nbsp;</td>
  705.             <td class="main">
  706.               <?php echo TEXT_PRODUCTS_QUANTITY_MIN_RETAIL; ?><br /><?php echo zen_draw_input_field('products_quantity_order_min', ($pInfo->products_quantity_order_min == 0 ? 1 : $pInfo->products_quantity_order_min), 'size="6"'); ?>
  707.             </td>
  708.             <td class="main">
  709.               <?php echo TEXT_PRODUCTS_QUANTITY_UNITS_RETAIL; ?><br /><?php echo zen_draw_input_field('products_quantity_order_units', ($pInfo->products_quantity_order_units == 0 ? 1 : $pInfo->products_quantity_order_units), 'size="6"'); ?>
  710.             </td>
  711.             <td class="main">
  712.               <?php echo TEXT_PRODUCTS_QUANTITY_MAX_RETAIL; ?><br /><?php echo zen_draw_input_field('products_quantity_order_max', $pInfo->products_quantity_order_max, 'size="6"'); ?>
  713.             </td>
  714.             <td class="main">
  715.               <?php echo TEXT_PRODUCTS_MIXED; ?><br /><?php echo zen_draw_radio_field('products_quantity_mixed', '1', $in_products_quantity_mixed==1) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('products_quantity_mixed', '0', $out_products_quantity_mixed) . '&nbsp;' . TEXT_NO; ?>
  716.             </td>
  717.           </tr>
  718.           <tr>
  719.             <td colspan="3" class="main">&nbsp;</td>
  720.             <td colspan="2" class="main">
  721.               <?php echo TEXT_PRODUCTS_QUANTITY_MAX_RETAIL_EDIT; ?>
  722.             </td>
  723.           </tr>
  724.           <tr>
  725.             <td class="main" width="200">&nbsp;</td>
  726.             <td class="main" valign="top"><?php echo TEXT_PRODUCT_IS_FREE; ?><br /><?php echo zen_draw_radio_field('product_is_free', '1', ($in_product_is_free==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('product_is_free', '0', ($in_product_is_free==0)) . '&nbsp;' . TEXT_NO . ' ' . ($pInfo->product_is_free == 1 ? '<span class="errorText">' . TEXT_PRODUCTS_IS_FREE_EDIT . '</span>' : ''); ?></td>
  727.             <td class="main" valign="top"><?php echo TEXT_PRODUCT_IS_CALL; ?><br /><?php echo zen_draw_radio_field('product_is_call', '1', ($in_product_is_call==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('product_is_call', '0', ($in_product_is_call==0)) . '&nbsp;' . TEXT_NO . ' ' . ($pInfo->product_is_call == 1 ? '<span class="errorText">' . TEXT_PRODUCTS_IS_CALL_EDIT . '</span>' : ''); ?></td>
  728.             <td colspan="2" class="main" valign="top"><?php echo TEXT_PRODUCTS_PRICED_BY_ATTRIBUTES; ?><br /><?php echo zen_draw_radio_field('products_priced_by_attribute', '1', $is_products_priced_by_attribute==1) . '&nbsp;' . TEXT_PRODUCT_IS_PRICED_BY_ATTRIBUTE . '&nbsp;&nbsp;' . zen_draw_radio_field('products_priced_by_attribute', '0', $not_products_priced_by_attribute) . '&nbsp;' . TEXT_PRODUCT_NOT_PRICED_BY_ATTRIBUTE . ' ' . ($pInfo->products_priced_by_attribute == 1 ? '<span class="errorText">' . TEXT_PRODUCTS_PRICED_BY_ATTRIBUTES_EDIT . '</span>' : ''); ?></td>
  729.           </tr>
  730.         </table></td>
  731.       </tr>
  732. <?php
  733.   } else {
  734. // show nothing
  735. ?>
  736.       <tr>
  737.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  738.       </tr>
  739.       <tr>
  740.         <td class="pageHeading"><?php echo TEXT_PRODUCT_INFO_NONE; ?></td>
  741.       </tr>
  742. <?php  } ?>
  743.  
  744.  
  745. <?php
  746.   if ($pInfo->products_id != '') {
  747. ?>
  748. <?php
  749.   if ($sInfo->products_id != '') {
  750. ?>
  751.       <tr>
  752.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  753.           <tr>
  754.             <td class="main" width="200"><?php echo TEXT_SPECIALS_PRODUCT_INFO; ?></td>
  755.             <td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE . '<br />' . zen_draw_input_field('specials_price', (isset($sInfo->specials_new_products_price) ? $sInfo->specials_new_products_price : '')); ?></td>
  756.             <td class="main"><?php echo TEXT_SPECIALS_AVAILABLE_DATE; ?><br /><script language="javascript">SpecialStartDate.writeControl(); SpecialStartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  757.             <td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?><br /><script language="javascript">SpecialEndDate.writeControl(); SpecialEndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  758.             <td class="main"><?php echo TEXT_SPECIALS_PRODUCTS_STATUS; ?><br />
  759.               <?php echo zen_draw_radio_field('special_status', '1', $special_in_status) . '&nbsp;' . TEXT_SPECIALS_PRODUCT_AVAILABLE . '&nbsp;' . zen_draw_radio_field('special_status', '0', $special_out_status) . '&nbsp;' . TEXT_SPECIALS_PRODUCT_NOT_AVAILABLE; ?>
  760.             </td>
  761.             <td class="main" align="center" width="100"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $current_category_id . '&action=delete_special') . '">' .  zen_image_button('button_remove.gif', IMAGE_REMOVE_SPECIAL) . '</a>'; ?></td>
  762.           </tr>
  763. <?php
  764.   if ($sInfo->status == 0) {
  765. ?>
  766.           <tr>
  767.             <td colspan="6"><?php echo '<span class="errorText">' . TEXT_SPECIAL_DISABLED . '</span>'; ?></td>
  768.           </tr>
  769. <?php } ?>
  770.           <tr>
  771.             <td colspan="6" class="main"><br><?php echo TEXT_SPECIALS_PRICE_TIP; ?></td>
  772.           </tr>
  773.         </table></td>
  774.       </tr>
  775. <?php  } else {
  776. ?>
  777.       <tr>
  778.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  779.           <tr>
  780.             <td class="main" width="200"><?php echo TEXT_SPECIALS_PRODUCT_INFO; ?></td>
  781. <?php
  782. // Specials cannot be added to Gift Vouchers
  783.       if(substr($pInfo->products_model, 0, 4) != 'GIFT') {
  784. ?>
  785.             <td class="main" align="center"><?php echo '<a href="' . zen_href_link(FILENAME_SPECIALS, 'add_products_id=' . $_GET['products_filter'] . '&action=new' . '&sID=' . $sInfo->specials_id . '&go_back=ON' . '&current_category_id=' . $current_category_id) . '">' .  zen_image_button('button_install.gif', IMAGE_INSTALL_SPECIAL) . '</a>'; ?></td>
  786. <?php  } else { ?>
  787.             <td class="main" align="center"><?php echo TEXT_SPECIALS_NO_GIFTS; ?></td>
  788. <?php } ?>
  789.           </tr>
  790.         </table></td>
  791.       </tr>
  792. <?php  } ?>
  793.  
  794. <?php
  795.   if ($fInfo->products_id != '') {
  796. ?>
  797.       <tr>
  798.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  799.           <tr>
  800.             <td class="main" width="200"><?php echo TEXT_FEATURED_PRODUCT_INFO; ?></td>
  801.             <td class="main"><?php echo TEXT_FEATURED_AVAILABLE_DATE ; ?><br /><script language="javascript">FeaturedStartDate.writeControl(); FeaturedStartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  802.             <td class="main"><?php echo TEXT_FEATURED_EXPIRES_DATE; ?><br /><script language="javascript">FeaturedEndDate.writeControl(); FeaturedEndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  803.             <td class="main"><?php echo TEXT_FEATURED_PRODUCTS_STATUS; ?><br />
  804.               <?php echo zen_draw_radio_field('featured_status', '1', $featured_in_status) . '&nbsp;' . TEXT_FEATURED_PRODUCT_AVAILABLE . '&nbsp;' . zen_draw_radio_field('featured_status', '0', $featured_out_status) . '&nbsp;' . TEXT_FEATURED_PRODUCT_NOT_AVAILABLE; ?>
  805.             </td>
  806.             <td class="main" align="center" width="100"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $current_category_id . '&action=delete_featured') . '">' .  zen_image_button('button_remove.gif', IMAGE_REMOVE_FEATURED) . '</a>'; ?></td>
  807.           </tr>
  808. <?php
  809.   if ($fInfo->status == 0) {
  810. ?>
  811.           <tr>
  812.             <td colspan="5"><?php echo '<span class="errorText">' . TEXT_FEATURED_DISABLED . '</span>'; ?></td>
  813.           </tr>
  814. <?php } ?>
  815.         </table></td>
  816.       </tr>
  817. <?php  } else { ?>
  818.       <tr>
  819.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  820.           <tr>
  821.             <td class="main" width="200"><?php echo TEXT_FEATURED_PRODUCT_INFO; ?></td>
  822.             <td class="main" align="center"><?php echo '<a href="' . zen_href_link(FILENAME_FEATURED, 'add_products_id=' . $_GET['products_filter'] . '&go_back=ON' . '&action=new' . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_install.gif', IMAGE_INSTALL_FEATURED) . '</a>'; ?></td>
  823.           </tr>
  824.         </table></td>
  825.       </tr>
  826. <?php  } ?>
  827.  
  828.  
  829.       <tr>
  830.         <td><br><table border="4" cellspacing="0" cellpadding="2">
  831. <?php
  832. // fix here
  833. // discount
  834.     $discounts_qty = $db->Execute("select * from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " where products_id='" . $products_filter . "' order by discount_qty");
  835.     $discount_cnt = $discounts_qty->RecordCount();
  836.     $make = 1;
  837.     $i = 0;
  838.     while (!$discounts_qty->EOF) {
  839.       $i++;
  840.       $discount_name[] = array('id' => $i,
  841.                                  'discount_qty' => $discounts_qty->fields['discount_qty'],
  842.                                  'discount_price' => $discounts_qty->fields['discount_price']);
  843.       $discounts_qty->MoveNext();
  844.     }
  845. ?>
  846.  
  847. <?php
  848.   if ($discounts_qty->RecordCount() > 0) {
  849. ?>
  850.  
  851.           <tr>
  852.             <td colspan="5" class="main" valign="top"><?php echo TEXT_PRODUCTS_MIXED_DISCOUNT_QUANTITY; ?>&nbsp;&nbsp;<?php echo zen_draw_radio_field('products_mixed_discount_quantity', '1', $in_products_mixed_discount_quantity==1) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('products_mixed_discount_quantity', '0', $out_products_mixed_discount_quantity) . '&nbsp;' . TEXT_NO; ?></td>
  853.           </tr>
  854.           <tr>
  855.             <td colspan="5" class="main" align="center">
  856.               <?php
  857.                 if ($action != '') {
  858.                   echo TEXT_ADD_ADDITIONAL_DISCOUNT . '<br />';
  859.                   echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id . '&action=add_discount_qty_id') . '">' .  zen_image_button('button_blank_discounts.gif', IMAGE_ADD_BLANK_DISCOUNTS) . '</a>' . '<br />';
  860.                   echo TEXT_BLANKS_INFO;
  861.                 } else {
  862.                   echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : '');
  863.                 }
  864.               ?>
  865.             </td>
  866.           </tr>
  867.           <tr>
  868.             <td colspan="5"><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  869.           </tr>
  870.           <tr>
  871.             <td class="main">
  872.               <?php echo TEXT_DISCOUNT_TYPE_INFO; ?>
  873.             </td>
  874.             <td colspan="2" class="main">
  875.               <?php echo TEXT_DISCOUNT_TYPE . ' ' . zen_draw_pull_down_menu('products_discount_type', $discount_type_array, $pInfo->products_discount_type); ?>
  876.             </td>
  877.             <td colspan="2" class="main">
  878.               <?php echo TEXT_DISCOUNT_TYPE_FROM . ' ' . zen_draw_pull_down_menu('products_discount_type_from', $discount_type_from_array, $pInfo->products_discount_type_from); ?>
  879.             </td>
  880.           </tr>
  881.           <tr>
  882.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_QTY_TITLE; ?></td>
  883.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_QTY; ?></td>
  884.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE; ?></td>
  885. <?php
  886.   if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') {
  887. ?>
  888.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EACH_TAX; ?></td>
  889.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EXTENDED_TAX; ?></td>
  890. <?php } else { ?>
  891.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EACH; ?></td>
  892.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EXTENDED; ?></td>
  893. <?php } ?>
  894.           </tr>
  895. <?php
  896.  
  897.   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
  898.   $display_price = zen_get_products_base_price($_GET['products_filter']);
  899.   $display_specials_price = zen_get_products_special_price($_GET['products_filter'], false);
  900. //  $display_sale_price = zen_get_products_special_price($_GET['products_filter'], false);
  901.  
  902.     for ($i=0, $n=sizeof($discount_name); $i<$n; $i++) {
  903.       switch ($pInfo->products_discount_type) {
  904.         // none
  905.         case '0':
  906.           $discounted_price = 0;
  907.           break;
  908.         // percentage discount
  909.         case '1':
  910.           if ($pInfo->products_discount_type_from == '0') {
  911.             $discounted_price = $display_price - ($display_price * ($discount_name[$i]['discount_price']/100));
  912.           } else {
  913.             if (!$display_specials_price) {
  914.               $discounted_price = $display_price - ($display_price * ($discount_name[$i]['discount_price']/100));
  915.             } else {
  916.               $discounted_price = $display_specials_price - ($display_specials_price * ($discount_name[$i]['discount_price']/100));
  917.             }
  918.           }
  919.  
  920.           break;
  921.         // actual price
  922.         case '2':
  923.           if ($pInfo->products_discount_type_from == '0') {
  924.             $discounted_price = $discount_name[$i]['discount_price'];
  925.           } else {
  926.             $discounted_price = $discount_name[$i]['discount_price'];
  927.           }
  928.           break;
  929.         // amount offprice
  930.         case '3':
  931.           if ($pInfo->products_discount_type_from == '0') {
  932.             $discounted_price = $display_price - $discount_name[$i]['discount_price'];
  933.           } else {
  934.             if (!$display_specials_price) {
  935.               $discounted_price = $display_price - $discount_name[$i]['discount_price'];
  936.             } else {
  937.               $discounted_price = $display_specials_price - $discount_name[$i]['discount_price'];
  938.             }
  939.           }
  940.           break;
  941.       }
  942. ?>
  943.           <tr>
  944.             <td class="main"><?php echo TEXT_PRODUCTS_DISCOUNT . ' ' . $discount_name[$i]['id']; ?></td>
  945.             <td class="main"><?php echo zen_draw_input_field('discount_qty[' . $discount_name[$i]['id'] . ']', $discount_name[$i]['discount_qty']); ?></td>
  946.             <td class="main"><?php echo zen_draw_input_field('discount_price[' . $discount_name[$i]['id'] . ']', $discount_name[$i]['discount_price']); ?></td>
  947. <?php
  948.   if (DISPLAY_PRICE_WITH_TAX == 'true') {
  949. ?>
  950.             <td class="main" align="right"><?php echo $currencies->display_price($discounted_price, '', 1) . ' ' . $currencies->display_price($discounted_price, zen_get_tax_rate(1), 1); ?></td>
  951.             <td class="main" align="right"><?php echo ' x ' . number_format($discount_name[$i]['discount_qty']) . ' = ' . $currencies->display_price($discounted_price, '', $discount_name[$i]['discount_qty']) . ' ' . $currencies->display_price($discounted_price, zen_get_tax_rate(1), $discount_name[$i]['discount_qty']); ?></td>
  952. <?php } else { ?>
  953.             <td class="main" align="right"><?php echo $currencies->display_price($discounted_price, '', 1); ?></td>
  954.             <td class="main" align="right"><?php echo ' x ' . number_format($discount_name[$i]['discount_qty']) . ' = ' . $currencies->display_price($discounted_price, '', $discount_name[$i]['discount_qty']); ?></td>
  955. <?php } ?>
  956.           </tr>
  957. <?php
  958.     }
  959. ?>
  960. <?php
  961.   } else {
  962. ?>
  963.           <tr>
  964.           <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  965.           </tr>
  966.           <tr>
  967.             <td class="main" align="center" width="500">
  968.               <?php
  969.                 if ($action != '') {
  970.                   echo TEXT_ADD_ADDITIONAL_DISCOUNT . '<br />';
  971.                   echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&action=add_discount_qty_id') . '">' .  zen_image_button('button_blank_discounts.gif', IMAGE_ADD_BLANK_DISCOUNTS) . '</a>' . '<br />';
  972.                   echo TEXT_BLANKS_INFO;
  973.                 } else {
  974.                   echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : '') . '<br />';
  975.                   echo TEXT_INFO_NO_DISCOUNTS;
  976.                 }
  977.               ?>
  978.             </td>
  979.           </tr>
  980. <?php
  981.   } // $discounts_qty->RecordCount() > 0
  982. ?>
  983.  
  984.         </table></td>
  985.       </tr>
  986.  
  987.       <tr>
  988.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  989.       </tr>
  990.       <tr>
  991.         <td><table border="0" cellspacing="0" cellpadding="2" align="center">
  992.           <?php if ($action == '') { ?>
  993.           <tr>
  994.             <td class="pageHeading" align="center" valign="middle">
  995.               <?php echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : ''); ?>
  996.             </td>
  997.           </tr>
  998.           <?php } ?>
  999.           <tr>
  1000.             <td class="main" align="center" valign="middle" width="100%">
  1001.             <?php
  1002.             if ($action == '' || $action == 'delete_special' || $action == 'delete_featured') {
  1003.               echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=edit' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT_PRODUCT) . '</a>' . '<br />' . TEXT_INFO_EDIT_CAUTION;
  1004.             } else {
  1005.               echo zen_image_submit('button_update.gif', IMAGE_UPDATE_PRICE_CHANGES) . '&nbsp;&nbsp;' . '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=cancel' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>' . '<br />' . TEXT_UPDATE_COMMIT;
  1006.             }
  1007.             ?>
  1008.             </td>
  1009.           </tr>
  1010.         </table></td>
  1011.       </tr>
  1012.       <tr>
  1013.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  1014.       </tr>
  1015.         </table></td>
  1016.       </tr></form>
  1017. <?php } // no product selected ?>
  1018. <?php } // allow_add_to_cart == 'Y' ?>
  1019.  
  1020.       </tr>
  1021.     </table></td>
  1022. <!-- body_text_eof //-->
  1023.   </tr>
  1024. </table>
  1025. <!-- body_eof //-->
  1026.  
  1027. <!-- footer //-->
  1028. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  1029. <!-- footer_eof //-->
  1030. </body>
  1031. </html>
  1032. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  1033.  


cron