[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.22 KiB
MD5: bb58eb427f4d82a659e05228e85a1bd7

products_price_manager.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 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 $Id: products_price_manager.php 19294 2011-07-28 18:15:46Z drbyte $
  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'] : (int)$products_filter);
  23.  
  24.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  25.  
  26.   $current_category_id = (isset($_GET['current_category_id']) ? (int)$_GET['current_category_id'] : (int)$current_category_id);
  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->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->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->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.  
  433.       if ($product->RecordCount() > 0) {
  434.         $fInfo = new objectInfo($product->fields);
  435.       }
  436.  
  437. // specials information
  438.       $product = $db->Execute("select p.products_id,
  439.                                      s.specials_id, s.specials_new_products_price, s.expires_date, s.specials_date_available, s.status
  440.                               from " . TABLE_PRODUCTS . " p, " .
  441.                                         TABLE_SPECIALS . " s
  442.                               where p.products_id = s.products_id
  443.                               and s.products_id = '" . (int)$_GET['products_filter'] . "'");
  444.  
  445.       if ($product->RecordCount() > 0) {
  446.         $sInfo = new objectInfo($product->fields);
  447.       }
  448.  
  449. // products information
  450.       $product = $db->Execute("select p.products_id, p.products_model,
  451.                                      p.products_price, p.products_date_available,
  452.                                      p.products_tax_class_id,
  453.                                      p.products_quantity_order_min, products_quantity_order_units, p.products_quantity_order_max,
  454.                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.products_priced_by_attribute, p.products_status,
  455.                                      p.products_discount_type, p.products_discount_type_from, p.products_price_sorter,
  456.                                      pd.products_name,
  457.                                      p.master_categories_id, p.products_mixed_discount_quantity
  458.                               from " . TABLE_PRODUCTS . " p, " .
  459.                                         TABLE_PRODUCTS_DESCRIPTION . " pd
  460.                               where p.products_id = '" . (int)$_GET['products_filter'] . "'
  461.                               and p.products_id = pd.products_id
  462.                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
  463.  
  464.  
  465.       if ($product->RecordCount() > 0) {
  466.         $pInfo = new objectInfo($product->fields);
  467.       }
  468.  
  469. // set statuses
  470.       if (!isset($pInfo->products_status)) $pInfo->products_status = '1';
  471.         switch ($pInfo->products_status) {
  472.         case '0': $products_in_status = false; $products_out_status = true; break;
  473.         case '1':
  474.         default: $products_in_status = true; $products_out_status = false;
  475.       }
  476.       if (!isset($fInfo->status)) $fInfo->status = '1';
  477.         switch ($fInfo->status) {
  478.         case '0': $featured_in_status = false; $featured_out_status = true; break;
  479.         case '1':
  480.         default: $featured_in_status = true; $featured_out_status = false;
  481.       }
  482.       if (!isset($sInfo->status)) $sInfo->status = '1';
  483.         switch ($sInfo->status) {
  484.         case '0': $special_in_status = false; $special_out_status = true; break;
  485.         case '1':
  486.         default: $special_in_status = true; $special_out_status = false;
  487.       }
  488.  
  489. // Product is Priced by Attributes
  490.     if (!isset($pInfo->products_priced_by_attribute)) $pInfo->products_priced_by_attribute = '0';
  491.     switch ($pInfo->products_priced_by_attribute) {
  492.       case '0': $is_products_priced_by_attribute = false; $not_products_priced_by_attribute = true; break;
  493.       case '1': $is_products_priced_by_attribute = true; $not_products_priced_by_attribute = false; break;
  494.       default: $is_products_priced_by_attribute = false; $not_products_priced_by_attribute = true;
  495.     }
  496. // Product is Free
  497.     if (!isset($pInfo->product_is_free)) $pInfo->product_is_free = '0';
  498.     switch ($pInfo->product_is_free) {
  499.       case '0': $in_product_is_free = false; $out_product_is_free = true; break;
  500.       case '1': $in_product_is_free = true; $out_product_is_free = false; break;
  501.       default: $in_product_is_free = false; $out_product_is_free = true;
  502.     }
  503. // Product is Call for price
  504.     if (!isset($pInfo->product_is_call)) $pInfo->product_is_call = '0';
  505.     switch ($pInfo->product_is_call) {
  506.       case '0': $in_product_is_call = false; $out_product_is_call = true; break;
  507.       case '1': $in_product_is_call = true; $out_product_is_call = false; break;
  508.       default: $in_product_is_call = false; $out_product_is_call = true;
  509.     }
  510. // Products can be purchased with mixed attributes retail
  511.     if (!isset($pInfo->products_quantity_mixed)) $pInfo->products_quantity_mixed = '0';
  512.     switch ($pInfo->products_quantity_mixed) {
  513.       case '0': $in_products_quantity_mixed = false; $out_products_quantity_mixed = true; break;
  514.       case '1': $in_products_quantity_mixed = true; $out_products_quantity_mixed = false; break;
  515.       default: $in_products_quantity_mixed = true; $out_products_quantity_mixed = false;
  516.     }
  517. // Products can be purchased with mixed attributes for discount
  518.     if (!isset($pInfo->products_mixed_discount_quantity)) $pInfo->products_mixed_discount_quantity = '1';
  519.     switch ($pInfo->products_mixed_discount_quantity) {
  520.       case '0': $in_products_mixed_discount_quantity = false; $out_products_mixed_discount_quantity = true; break;
  521.       case '1': $in_products_mixed_discount_quantity = true; $out_products_mixed_discount_quantity = false; break;
  522.       default: $in_products_mixed_discount_quantity = true; $out_products_mixed_discount_quantity = false;
  523.     }
  524.  
  525. // Product is product discount type - None, Percentage, Actual Price, $$ off
  526.   $discount_type_array = array(array('id' => '0', 'text' => DISCOUNT_TYPE_DROPDOWN_0),
  527.                                 array('id' => '1', 'text' => DISCOUNT_TYPE_DROPDOWN_1),
  528.                                 array('id' => '2', 'text' => DISCOUNT_TYPE_DROPDOWN_2),
  529.                                 array('id' => '3', 'text' => DISCOUNT_TYPE_DROPDOWN_3));
  530.  
  531. // Product is product discount type from price or special
  532.   $discount_type_from_array = array(array('id' => '0', 'text' => DISCOUNT_TYPE_FROM_DROPDOWN_0),
  533.                               array('id' => '1', 'text' => DISCOUNT_TYPE_FROM_DROPDOWN_1));
  534.  
  535. // tax class id
  536.     $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
  537.     $tax_class = $db->Execute("select tax_class_id, tax_class_title
  538.                                     from " . TABLE_TAX_CLASS . " order by tax_class_title");
  539.     while (!$tax_class->EOF) {
  540.       $tax_class_array[] = array('id' => $tax_class->fields['tax_class_id'],
  541.                                  'text' => $tax_class->fields['tax_class_title']);
  542.       $tax_class->MoveNext();
  543.     }
  544. ?>
  545. <?php if ($pInfo->products_id != '') { ?>
  546. <script language="javascript">
  547. 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);
  548. </script>
  549. <?php } ?>
  550.  
  551. <?php if ($fInfo->products_id != '') { ?>
  552. <script language="javascript">
  553. 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);
  554. 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);
  555. </script>
  556. <?php } ?>
  557.  
  558. <?php if ($sInfo->products_id != '') { ?>
  559. <script language="javascript">
  560. 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);
  561. 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);
  562. </script>
  563. <?php } ?>
  564.  
  565. <?php
  566. // auto fix bad or missing products master_categories_id
  567.   if (zen_get_product_is_linked($products_filter) == 'false' and $pInfo->master_categories_id != zen_get_products_category_id($products_filter)) {
  568.     $sql = "update " . TABLE_PRODUCTS . " set master_categories_id='" . zen_get_products_category_id($products_filter) . "' where products_id='" . $products_filter . "'";
  569.     $db->Execute($sql);
  570.     $pInfo->master_categories_id = zen_get_products_category_id($products_filter);
  571.   }
  572. ?>
  573.  
  574. <?php
  575.   if ($pInfo->products_id != '') {
  576. ?>
  577.       <tr>
  578.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  579.       </tr>
  580.       <tr>
  581.         <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>
  582.       </tr>
  583.       <tr>
  584.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  585.       </tr>
  586.       <?php if ($action == 'delete_special') { ?>
  587.       <tr>
  588.         <td>
  589.           <table border="0" cellspacing="2" cellpadding="2">
  590.             <tr class="pageHeading">
  591.               <td class="alert" align="center" colspan="2"><?php echo TEXT_SPECIALS_CONFIRM_DELETE; ?></td>
  592.             </tr>
  593.             <tr>
  594.               <td class="main" align="left">
  595.               <?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']); ?>
  596.               <input type="hidden" name="product_id" value="<?php echo $_GET['products_filter']; ?>" />
  597.               <?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>
  598.               </td>
  599.             </tr>
  600.           </table>
  601.       </td>
  602.       </tr>
  603.       <?php } ?>
  604.       <?php if ($action == 'delete_featured') { ?>
  605.       <tr>
  606.         <td>
  607.           <table border="0" cellspacing="2" cellpadding="2">
  608.             <tr class="pageHeading">
  609.               <td class="alert" align="center" colspan="2"><?php echo TEXT_FEATURED_CONFIRM_DELETE; ?></td>
  610.             </tr>
  611.             <tr>
  612.               <td class="main" align="left">
  613.               <?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']); ?>
  614.               <input type="hidden" name="product_id" value="<?php echo $_GET['products_filter']; ?>" />
  615.               <?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>
  616.               </td>
  617.             </tr>
  618.           </table>
  619.       </td>
  620.       </tr>
  621.       <?php } ?>
  622.  
  623.       <?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'); ?>
  624.       <?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); ?>
  625.       <tr>
  626.         <td colspan="4"><table border="0" cellspacing="0" cellpadding="2" align="center" width="100%">
  627.           <tr>
  628.             <td class="pageHeading" align="center" valign="middle">
  629.               <?php echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : ''); ?>
  630.             </td>
  631.           </tr>
  632.           <tr>
  633.             <td class="main" align="center" valign="middle">
  634.             <?php
  635.             if ($action == '' || $action == 'delete_special' || $action == 'delete_featured') {
  636.               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;
  637.             } else {
  638.               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;
  639.             }
  640.             ?>
  641.             </td>
  642.           </tr>
  643.           <tr>
  644.             <td colspan="2"><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  645.           </tr>
  646.         </table></td>
  647.       </tr>
  648.  
  649.       <tr>
  650.         <td><table border="0" cellspacing="0" cellpadding="2">
  651.  
  652. <?php
  653. // show when product is linked
  654. if (zen_get_product_is_linked($products_filter) == 'true') {
  655. ?>
  656.           <tr>
  657.             <td class="main" width="200"><?php echo TEXT_MASTER_CATEGORIES_ID; ?></td>
  658.             <td colspan="4" class="main">
  659.               <?php
  660.                 // echo zen_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id);
  661.                 echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;';
  662.                 echo zen_draw_pull_down_menu('master_category', zen_get_master_categories_pulldown($products_filter), $pInfo->master_categories_id); ?>
  663.             </td>
  664.           </tr>
  665.           <tr>
  666.             <td colspan="5" class="main"><?php echo TEXT_INFO_MASTER_CATEGORIES_ID; ?></td>
  667.           </tr>
  668.           <tr>
  669.             <td colspan="5" class="main" align="center"><?php echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : TEXT_INFO_UPDATE_REMINDER); ?></td>
  670.           </tr>
  671. <?php } // master category linked ?>
  672.  
  673. <?php
  674. if (zen_get_product_is_linked($products_filter) == 'false' and $pInfo->master_categories_id != zen_get_products_category_id($products_filter)) {
  675. ?>
  676.           <tr>
  677.             <td colspan="5" class="main"><span class="alert">
  678.               <?php echo sprintf(TEXT_INFO_MASTER_CATEGORIES_ID_WARNING, $pInfo->master_categories_id, zen_get_products_category_id($products_filter)); ?></span>
  679.               <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>
  680.             </td>
  681.          </tr>
  682. <?php } ?>
  683. <?php
  684. echo zen_draw_hidden_field('master_categories_id', $pInfo->master_categories_id);
  685. ?>
  686.  
  687.  
  688.           <tr>
  689.             <td class="main" width="200"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>
  690.             <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>
  691.           </tr>
  692.           <tr>
  693.             <td class="main" width="200"><?php echo TEXT_PRODUCTS_PRICE_INFO; ?></td>
  694.             <td class="main"><?php echo TEXT_PRICE . '<br />' . zen_draw_input_field('products_price', (isset($pInfo->products_price) ? $pInfo->products_price : '')); ?></td>
  695.             <td class="main"><?php echo TEXT_PRODUCT_AVAILABLE_DATE; ?><br /><script language="javascript">ProductStartDate.writeControl(); ProductStartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  696.             <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>
  697.           </tr>
  698.  
  699.           <tr>
  700.             <td class="main" width="200">&nbsp;</td>
  701.             <td class="main">
  702.               <?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"'); ?>
  703.             </td>
  704.             <td class="main">
  705.               <?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"'); ?>
  706.             </td>
  707.             <td class="main">
  708.               <?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"'); ?>
  709.             </td>
  710.             <td class="main">
  711.               <?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; ?>
  712.             </td>
  713.           </tr>
  714.           <tr>
  715.             <td colspan="3" class="main">&nbsp;</td>
  716.             <td colspan="2" class="main">
  717.               <?php echo TEXT_PRODUCTS_QUANTITY_MAX_RETAIL_EDIT; ?>
  718.             </td>
  719.           </tr>
  720.           <tr>
  721.             <td class="main" width="200">&nbsp;</td>
  722.             <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>
  723.             <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>
  724.             <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>
  725.           </tr>
  726.         </table></td>
  727.       </tr>
  728. <?php
  729.   } else {
  730. // show nothing
  731. ?>
  732.       <tr>
  733.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  734.       </tr>
  735.       <tr>
  736.         <td class="pageHeading"><?php echo TEXT_PRODUCT_INFO_NONE; ?></td>
  737.       </tr>
  738. <?php  } ?>
  739.  
  740.  
  741. <?php
  742.   if ($pInfo->products_id != '') {
  743. ?>
  744. <?php
  745.   if ($sInfo->products_id != '') {
  746. ?>
  747.       <tr>
  748.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  749.           <tr>
  750.             <td class="main" width="200"><?php echo TEXT_SPECIALS_PRODUCT_INFO; ?></td>
  751.             <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>
  752.             <td class="main"><?php echo TEXT_SPECIALS_AVAILABLE_DATE; ?><br /><script language="javascript">SpecialStartDate.writeControl(); SpecialStartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  753.             <td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?><br /><script language="javascript">SpecialEndDate.writeControl(); SpecialEndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  754.             <td class="main"><?php echo TEXT_SPECIALS_PRODUCTS_STATUS; ?><br />
  755.               <?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; ?>
  756.             </td>
  757.             <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>
  758.           </tr>
  759. <?php
  760.   if ($sInfo->status == 0) {
  761. ?>
  762.           <tr>
  763.             <td colspan="6"><?php echo '<span class="errorText">' . TEXT_SPECIAL_DISABLED . '</span>'; ?></td>
  764.           </tr>
  765. <?php } ?>
  766.           <tr>
  767.             <td colspan="6" class="main"><br><?php echo TEXT_SPECIALS_PRICE_TIP; ?></td>
  768.           </tr>
  769.         </table></td>
  770.       </tr>
  771. <?php  } else {
  772. ?>
  773.       <tr>
  774.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  775.           <tr>
  776.             <td class="main" width="200"><?php echo TEXT_SPECIALS_PRODUCT_INFO; ?></td>
  777. <?php
  778. // Specials cannot be added to Gift Vouchers
  779.       if(substr($pInfo->products_model, 0, 4) != 'GIFT') {
  780. ?>
  781.             <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>
  782. <?php  } else { ?>
  783.             <td class="main" align="center"><?php echo TEXT_SPECIALS_NO_GIFTS; ?></td>
  784. <?php } ?>
  785.           </tr>
  786.         </table></td>
  787.       </tr>
  788. <?php  } ?>
  789.  
  790. <?php
  791.   if ($fInfo->products_id != '') {
  792. ?>
  793.       <tr>
  794.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  795.           <tr>
  796.             <td class="main" width="200"><?php echo TEXT_FEATURED_PRODUCT_INFO; ?></td>
  797.             <td class="main"><?php echo TEXT_FEATURED_AVAILABLE_DATE ; ?><br /><script language="javascript">FeaturedStartDate.writeControl(); FeaturedStartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  798.             <td class="main"><?php echo TEXT_FEATURED_EXPIRES_DATE; ?><br /><script language="javascript">FeaturedEndDate.writeControl(); FeaturedEndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  799.             <td class="main"><?php echo TEXT_FEATURED_PRODUCTS_STATUS; ?><br />
  800.               <?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; ?>
  801.             </td>
  802.             <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>
  803.           </tr>
  804. <?php
  805.   if ($fInfo->status == 0) {
  806. ?>
  807.           <tr>
  808.             <td colspan="5"><?php echo '<span class="errorText">' . TEXT_FEATURED_DISABLED . '</span>'; ?></td>
  809.           </tr>
  810. <?php } ?>
  811.         </table></td>
  812.       </tr>
  813. <?php  } else { ?>
  814.       <tr>
  815.         <td><br><table border="0" cellspacing="0" cellpadding="2">
  816.           <tr>
  817.             <td class="main" width="200"><?php echo TEXT_FEATURED_PRODUCT_INFO; ?></td>
  818.             <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>
  819.           </tr>
  820.         </table></td>
  821.       </tr>
  822. <?php  } ?>
  823.  
  824.  
  825.       <tr>
  826.         <td><br><table border="4" cellspacing="0" cellpadding="2">
  827. <?php
  828. // fix here
  829. // discount
  830.     $discounts_qty = $db->Execute("select * from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " where products_id='" . $products_filter . "' order by discount_qty");
  831.     $discount_cnt = $discounts_qty->RecordCount();
  832.     $make = 1;
  833.     $i = 0;
  834.     while (!$discounts_qty->EOF) {
  835.       $i++;
  836.       $discount_name[] = array('id' => $i,
  837.                                  'discount_qty' => $discounts_qty->fields['discount_qty'],
  838.                                  'discount_price' => $discounts_qty->fields['discount_price']);
  839.       $discounts_qty->MoveNext();
  840.     }
  841. ?>
  842.  
  843. <?php
  844.   if ($discounts_qty->RecordCount() > 0) {
  845. ?>
  846.  
  847.           <tr>
  848.             <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>
  849.           </tr>
  850.           <tr>
  851.             <td colspan="5" class="main" align="center">
  852.               <?php
  853.                 if ($action != '') {
  854.                   echo TEXT_ADD_ADDITIONAL_DISCOUNT . '<br />';
  855.                   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 />';
  856.                   echo TEXT_BLANKS_INFO;
  857.                 } else {
  858.                   echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : '');
  859.                 }
  860.               ?>
  861.             </td>
  862.           </tr>
  863.           <tr>
  864.             <td colspan="5"><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  865.           </tr>
  866.           <tr>
  867.             <td class="main">
  868.               <?php echo TEXT_DISCOUNT_TYPE_INFO; ?>
  869.             </td>
  870.             <td colspan="2" class="main">
  871.               <?php echo TEXT_DISCOUNT_TYPE . ' ' . zen_draw_pull_down_menu('products_discount_type', $discount_type_array, $pInfo->products_discount_type); ?>
  872.             </td>
  873.             <td colspan="2" class="main">
  874.               <?php echo TEXT_DISCOUNT_TYPE_FROM . ' ' . zen_draw_pull_down_menu('products_discount_type_from', $discount_type_from_array, $pInfo->products_discount_type_from); ?>
  875.             </td>
  876.           </tr>
  877.           <tr>
  878.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_QTY_TITLE; ?></td>
  879.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_QTY; ?></td>
  880.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE; ?></td>
  881. <?php
  882.   if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') {
  883. ?>
  884.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EACH_TAX; ?></td>
  885.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EXTENDED_TAX; ?></td>
  886. <?php } else { ?>
  887.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EACH; ?></td>
  888.             <td class="main" align="center"><?php echo TEXT_PRODUCTS_DISCOUNT_PRICE_EXTENDED; ?></td>
  889. <?php } ?>
  890.           </tr>
  891. <?php
  892.  
  893.   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
  894.   $display_price = zen_get_products_base_price($_GET['products_filter']);
  895.   $display_specials_price = zen_get_products_special_price($_GET['products_filter'], true);
  896. //  $display_sale_price = zen_get_products_special_price($_GET['products_filter'], false);
  897.  
  898.     for ($i=0, $n=sizeof($discount_name); $i<$n; $i++) {
  899.       switch ($pInfo->products_discount_type) {
  900.         // none
  901.         case '0':
  902.           $discounted_price = 0;
  903.           break;
  904.         // percentage discount
  905.         case '1':
  906.           if ($pInfo->products_discount_type_from == '0') {
  907.             $discounted_price = $display_price - ($display_price * ($discount_name[$i]['discount_price']/100));
  908.           } else {
  909.             if (!$display_specials_price) {
  910.               $discounted_price = $display_price - ($display_price * ($discount_name[$i]['discount_price']/100));
  911.             } else {
  912.               $discounted_price = $display_specials_price - ($display_specials_price * ($discount_name[$i]['discount_price']/100));
  913.             }
  914.           }
  915.  
  916.           break;
  917.         // actual price
  918.         case '2':
  919.           if ($pInfo->products_discount_type_from == '0') {
  920.             $discounted_price = $discount_name[$i]['discount_price'];
  921.           } else {
  922.             $discounted_price = $discount_name[$i]['discount_price'];
  923.           }
  924.           break;
  925.         // amount offprice
  926.         case '3':
  927.           if ($pInfo->products_discount_type_from == '0') {
  928.             $discounted_price = $display_price - $discount_name[$i]['discount_price'];
  929.           } else {
  930.             if (!$display_specials_price) {
  931.               $discounted_price = $display_price - $discount_name[$i]['discount_price'];
  932.             } else {
  933.               $discounted_price = $display_specials_price - $discount_name[$i]['discount_price'];
  934.             }
  935.           }
  936.           break;
  937.       }
  938. ?>
  939.           <tr>
  940.             <td class="main"><?php echo TEXT_PRODUCTS_DISCOUNT . ' ' . $discount_name[$i]['id']; ?></td>
  941.             <td class="main"><?php echo zen_draw_input_field('discount_qty[' . $discount_name[$i]['id'] . ']', $discount_name[$i]['discount_qty']); ?></td>
  942.             <td class="main"><?php echo zen_draw_input_field('discount_price[' . $discount_name[$i]['id'] . ']', $discount_name[$i]['discount_price']); ?></td>
  943. <?php
  944.   if (DISPLAY_PRICE_WITH_TAX == 'true') {
  945. ?>
  946.             <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>
  947.             <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>
  948. <?php } else { ?>
  949.             <td class="main" align="right"><?php echo $currencies->display_price($discounted_price, '', 1); ?></td>
  950.             <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>
  951. <?php } ?>
  952.           </tr>
  953. <?php
  954.     }
  955. ?>
  956. <?php
  957.   } else {
  958. ?>
  959.           <tr>
  960.           <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  961.           </tr>
  962.           <tr>
  963.             <td class="main" align="center" width="500">
  964.               <?php
  965.                 if ($action != '') {
  966.                   echo TEXT_ADD_ADDITIONAL_DISCOUNT . '<br />';
  967.                   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 />';
  968.                   echo TEXT_BLANKS_INFO;
  969.                 } else {
  970.                   echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : '') . '<br />';
  971.                   echo TEXT_INFO_NO_DISCOUNTS;
  972.                 }
  973.               ?>
  974.             </td>
  975.           </tr>
  976. <?php
  977.   } // $discounts_qty->RecordCount() > 0
  978. ?>
  979.  
  980.         </table></td>
  981.       </tr>
  982.  
  983.       <tr>
  984.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  985.       </tr>
  986.       <tr>
  987.         <td><table border="0" cellspacing="0" cellpadding="2" align="center">
  988.           <?php if ($action == '') { ?>
  989.           <tr>
  990.             <td class="pageHeading" align="center" valign="middle">
  991.               <?php echo ($action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : ''); ?>
  992.             </td>
  993.           </tr>
  994.           <?php } ?>
  995.           <tr>
  996.             <td class="main" align="center" valign="middle" width="100%">
  997.             <?php
  998.             if ($action == '' || $action == 'delete_special' || $action == 'delete_featured') {
  999.               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;
  1000.             } else {
  1001.               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;
  1002.             }
  1003.             ?>
  1004.             </td>
  1005.           </tr>
  1006.         </table></td>
  1007.       </tr>
  1008.       <tr>
  1009.         <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  1010.       </tr>
  1011.         </table></td>
  1012.       </tr></form>
  1013. <?php } // no product selected ?>
  1014. <?php } // allow_add_to_cart == 'Y' ?>
  1015.  
  1016.       </tr>
  1017.     </table></td>
  1018. <!-- body_text_eof //-->
  1019.   </tr>
  1020. </table>
  1021. <!-- body_eof //-->
  1022.  
  1023. <!-- footer //-->
  1024. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  1025. <!-- footer_eof //-->
  1026. </body>
  1027. </html>
  1028. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  1029.  


cron