[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文件
文件大小: 51.48 KiB
MD5: d86365c6d04442f3d635375c83160b67

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


cron