[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_to_categories.php

Zen Cart 源代码 products_to_categories.php




下载文件

文件名: products_to_categories.php
文件类型: PHP文件
文件大小: 48.14 KiB
MD5: 7c47720343320d9c99f6e694d2d47407

products_to_categories.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_to_categories.php 17905 2010-10-09 21:49:07Z 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.   // verify product has a master_categories_id
  20.   $chk_products = $db->Execute("select master_categories_id from " . TABLE_PRODUCTS . " where products_id='" . $_GET['products_filter'] . "'");
  21.   if ($chk_products->fields['master_categories_id'] <= 0) {
  22.     $messageStack->add(ERROR_DEFINE_PRODUCTS_MASTER_CATEGORIES_ID, 'caution');
  23. //    zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  24.   }
  25.  
  26.   require(DIR_WS_CLASSES . 'currencies.php');
  27.   $currencies = new currencies();
  28.  
  29.   $languages = zen_get_languages();
  30.  
  31. function array_minus_array($a, $b) {
  32.        $c=array_diff($a,$b);
  33.        $c=array_intersect($c, $a);
  34.        return $c;
  35. }
  36.  
  37.   $products_filter = ((isset($_GET['products_filter']) and $_GET['products_filter'] > 0) ? $_GET['products_filter'] : $_POST['products_filter']);
  38.  
  39.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  40.  
  41.   $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id);
  42.  
  43.   if ($action == 'new_cat') {
  44.     $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id);
  45.     $new_product_query = $db->Execute("select ptc.* from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc  left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where ptc.categories_id='" . $current_category_id . "' order by pd.products_name");
  46.     $products_filter = $new_product_query->fields['products_id'];
  47. //    $messageStack->add_session('SUCCESSFUL! SWITCHED CATEGORIES', 'success');
  48.     zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  49.   }
  50.  
  51. // set categories and products if not set
  52.   if ($products_filter == '' and $current_category_id != '') {
  53.     $new_product_query = $db->Execute("select ptc.* from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc  left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where ptc.categories_id='" . $current_category_id . "' order by pd.products_name");
  54.     $products_filter = $new_product_query->fields['products_id'];
  55.     if ($products_filter != '') {
  56.       $messageStack->add_session(WARNING_PRODUCTS_LINK_TO_CATEGORY_REMOVED, 'caution');
  57.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  58.     }
  59.   } else {
  60.     if ($products_filter == '' and $current_category_id == '') {
  61.       $reset_categories_id = zen_get_category_tree('', '', '0', '', '', true);
  62.       $current_category_id = $reset_categories_id[0]['id'];
  63.       $new_product_query = $db->Execute("select ptc.* from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc  left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where ptc.categories_id='" . $current_category_id . "' order by pd.products_name");
  64.       $products_filter = $new_product_query->fields['products_id'];
  65.       $_GET['products_filter'] = $products_filter;
  66.     }
  67.   }
  68.  
  69.   require(DIR_WS_MODULES . FILENAME_PREV_NEXT);
  70.  
  71.  
  72.   if (zen_not_null($action)) {
  73.     switch ($action) {
  74.       case 'set_products_filter':
  75.         $_GET['products_filter'] = $_POST['products_filter'];
  76.  
  77.         zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_POST['current_category_id']));
  78.         break;
  79.       case 'copy_categories_products_to_another_category_linked':
  80.         $zv_invalid_copy_linked = 'false';
  81.         $zv_complete_message_linked = '';
  82.         $copy_from_linked = $_POST['copy_categories_id_from_linked'];
  83.         $copy_to_linked = $_POST['copy_categories_id_to_linked'];
  84.  
  85.         // do not proceed unless categories are different
  86.         if ($copy_from_linked == $copy_to_linked) {
  87.           $messageStack->add_session(WARNING_DUPLICATE_PRODUCTS_TO_CATEGORY_LINKED, 'warning');
  88.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  89.         }
  90.  
  91.         $check_category_from = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_from_linked . "' limit 1");
  92.         $check_category_to = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_to_linked . "' limit 1");
  93.  
  94.         // check if from is valid category
  95.         if ($check_category_from->RecordCount() < 1) {
  96.           $zv_invalid_copy_linked = 'true';
  97.           $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $copy_from_linked . '&nbsp;';
  98.         } else {
  99.           $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $copy_from_linked . '&nbsp;';
  100.         }
  101.  
  102.         // check if to is valid category
  103.         if ($check_category_to->RecordCount() < 1) {
  104.           if (zen_childs_in_category_count($copy_to_linked) > 0) {
  105.             $zv_invalid_copy_linked = 'true';
  106.             $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $copy_to_linked . '&nbsp;';
  107.           }
  108.         } else {
  109.           $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $copy_to_linked . '&nbsp;';
  110.         }
  111.  
  112.         if ($zv_invalid_copy_linked == 'true') {
  113.           $messageStack->add_session($zv_complete_message_linked, 'warning');
  114.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  115.         }
  116.  
  117.         ///////////////////////////////////////////////////////////////
  118.         // if either category was invalid nothing processes below
  119.         ///////////////////////////////////////////////////////////////
  120.  
  121.         // get products to be linked from
  122.         $products_to_categories_from_linked = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_from_linked . "'");
  123.         while (!$products_to_categories_from_linked->EOF) {
  124.           $add_links_array[] = array('products_id' => $products_to_categories_from_linked->fields['products_id']);
  125.           $products_to_categories_from_linked->MoveNext();
  126.         }
  127.  
  128.         // get products already in category to be linked to
  129.         $products_to_categories_to_linked = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $copy_to_linked . "'");
  130.         while (!$products_to_categories_to_linked->EOF) {
  131.           $remove_links_array[] = array('products_id' => $products_to_categories_to_linked->fields['products_id']);
  132.           $products_to_categories_to_linked->MoveNext();
  133.         }
  134.  
  135. // cannot count added/removed due to the nature of the how these are done
  136. //        $cnt_added = 0;
  137.         // remove elements in $remove_links_array that are in $add_links_array
  138.         for ($i=0, $n=sizeof($add_links_array); $i<$n; $i++) {
  139.           $good = 'true';
  140.           for ($j=0, $nn=sizeof($remove_links_array); $j<$nn; $j++) {
  141.             if ($add_links_array[$i]['products_id'] == $remove_links_array[$j]['products_id']) {
  142.               $good = 'false';
  143.               break;
  144.             }
  145.           }
  146.           // build final of good products
  147.           if ($good == 'true') {
  148.             $make_links_result[] = array('products_id' => $add_links_array[$i]['products_id']);
  149.           }
  150.         }
  151.  
  152.         for ($i=0, $n=sizeof($make_links_result); $i<$n; $i++) {
  153. //          $cnt_added++;
  154.           $new_product = $make_links_result[$i]['products_id'];
  155.           $sql = "insert into " . TABLE_PRODUCTS_TO_CATEGORIES . "
  156.                  (products_id, categories_id)
  157.                  values ($new_product, $copy_to_linked)";
  158.  
  159.           $db->Execute($sql);
  160.         }
  161.  
  162.         // set message of completion
  163.         if (sizeof($make_links_result) == 0) {
  164.             $zv_complete_message_linked = WARNING_COPY_FROM_IN_TO_LINKED . $zv_complete_message_linked;
  165.             $warning_color = 'caution';
  166.         } else {
  167.           if ($check_category_from->RecordCount() < 1 or $check_category_to->RecordCount() < 1) {
  168.             $zv_complete_message_linked = WARNING_COPY_LINKED . $zv_complete_message_linked;
  169.             $warning_color = 'error';
  170.           } else {
  171.             $zv_complete_message_linked = SUCCESS_COPY_LINKED . $zv_complete_message_linked;
  172.             $warning_color = 'success';
  173.           }
  174.         }
  175.  
  176.         if (sizeof($make_links_result) == 0) {
  177.           $messageStack->add_session($zv_complete_message_linked, $warning_color);
  178.         } else {
  179.           $messageStack->add_session($zv_complete_message_linked, $warning_color);
  180.         }
  181.  
  182.         zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  183.         break;
  184.  
  185.       case 'remove_categories_products_to_another_category_linked':
  186.         $zv_invalid_remove_linked = 'false';
  187.         $zv_complete_message_linked = '';
  188.         $remove_from_linked = $_POST['remove_categories_id_from_linked'];
  189.         $remove_to_linked = $_POST['remove_categories_id_to_linked'];
  190.  
  191.         // do not proceed unless categories are different
  192.         if ($remove_from_linked == $remove_to_linked) {
  193.           $messageStack->add_session(WARNING_DUPLICATE_PRODUCTS_TO_CATEGORY_LINKED, 'warning');
  194.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  195.         }
  196.  
  197.         $check_category_from = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $remove_from_linked . "' limit 1");
  198.         $check_category_to = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $remove_to_linked . "' limit 1");
  199.  
  200.  
  201.         // check if from is valid category
  202.         if ($check_category_from->RecordCount() < 1) {
  203.           $zv_invalid_remove_linked = 'true';
  204.           $zv_complete_message_linked .= WARNING_REMOVE_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $remove_from_linked . '&nbsp;';
  205.        } else {
  206.           $zv_complete_message_linked .= SUCCESS_REMOVE_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . $remove_from_linked . '&nbsp;';
  207.         }
  208.  
  209.         // check if to is valid category
  210.         if ($check_category_to->RecordCount() < 1) {
  211.           $zv_invalid_remove_linked = 'true';
  212.           $zv_complete_message_linked .= WARNING_REMOVE_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $remove_to_linked . '&nbsp;';
  213.         } else {
  214.           $zv_complete_message_linked .= SUCCESS_REMOVE_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . $remove_to_linked . '&nbsp;';
  215.         }
  216.  
  217.         if ($zv_invalid_remove_linked == 'true') {
  218.           $messageStack->add_session($zv_complete_message_linked, 'warning');
  219.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  220.         }
  221.  
  222.         ///////////////////////////////////////////////////////////////
  223.         // if either category was invalid nothing processes below
  224.         ///////////////////////////////////////////////////////////////
  225.  
  226.  
  227.         // get products to be removed as added linked from
  228.         $products_to_categories_from_linked = $db->Execute("select ptoc.products_id, p.master_categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptoc left join " . TABLE_PRODUCTS . " p on ptoc.products_id=p.products_id where ptoc.categories_id='" . $remove_from_linked . "'");
  229.  
  230.         while (!$products_to_categories_from_linked->EOF) {
  231.           if ($products_to_categories_from_linked->fields['master_categories_id'] == $remove_to_linked) {
  232.             //die('THIS IS THE MASTER CATEGORIES ID!! ' . $remove_to_linked . '<br>');
  233.             //break;
  234.             $master_categories_id_stop[] = array('products_id' => $products_to_categories_from_linked->fields['products_id'],
  235.                                      'master_categories_id' => $products_to_categories_from_linked->fields['master_categories_id']);
  236.           }
  237.           $add_links_array[] = array('products_id' => $products_to_categories_from_linked->fields['products_id'],
  238.                                      'master_categories_id' => $products_to_categories_from_linked->fields['master_categories_id']);
  239.           $products_to_categories_from_linked->MoveNext();
  240.         }
  241.  
  242.         $stop_warning = '';
  243.         if (sizeof($master_categories_id_stop) > 0) {
  244.           for ($i=0, $n=sizeof($master_categories_id_stop); $i<$n; $i++) {
  245.             $stop_warning .= TEXT_PRODUCTS_ID . $master_categories_id_stop[$i]['products_id'] . ': ' . zen_get_products_name($master_categories_id_stop[$i]['products_id']) . '<br>';
  246.           }
  247.  
  248.           $stop_warning_message = WARNING_MASTER_CATEGORIES_ID_CONFLICT . ' ' . TEXT_MASTER_CATEGORIES_ID_CONFLICT_FROM . $remove_from_linked . TEXT_MASTER_CATEGORIES_ID_CONFLICT_TO . $remove_to_linked . '<br />' . TEXT_INFO_MASTER_CATEGORIES_ID_PURPOSE . WARNING_MASTER_CATEGORIES_ID_CONFLICT_FIX . '<br /><br />' . TEXT_INFO_MASTER_CATEGORIES_ID_CONFLICT . $remove_to_linked . '<br />' . $stop_warning . '<br />';
  249.           $messageStack->add_session($stop_warning_message, 'warning');
  250.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $master_categories_id_stop[0]['products_id'] . '&current_category_id=' . $current_category_id));
  251. //          die('THIS IS THE MASTER CATEGORIES ID!! ' . $remove_to_linked . ' - stop: ' . sizeof($master_categories_id_stop) . '<br>');
  252.         }
  253.  
  254.         // get products already in category to be removed as linked to
  255.         $products_to_categories_to_linked = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $remove_to_linked . "'");
  256.         while (!$products_to_categories_to_linked->EOF) {
  257.           $remove_links_array[] = array('products_id' => $products_to_categories_to_linked->fields['products_id']);
  258.           $products_to_categories_to_linked->MoveNext();
  259.         }
  260.  
  261. //        $cnt_removed = 0;
  262.         // remove elements in $remove_links_array that are in $add_links_array
  263.         for ($i=0, $n=sizeof($add_links_array); $i<$n; $i++) {
  264.           $good = 'true';
  265.           for ($j=0, $nn=sizeof($remove_links_array); $j<$nn; $j++) {
  266.             if ($add_links_array[$i]['products_id'] == $remove_links_array[$j]['products_id']) {
  267.               $good = 'true';
  268.               break;
  269.             }
  270.           }
  271.           // build final of good products
  272.           if ($good == 'true') {
  273.             $make_links_result[] = array('products_id' => $add_links_array[$i]['products_id']);
  274.           }
  275.         }
  276.  
  277.         for ($i=0, $n=sizeof($make_links_result); $i<$n; $i++) {
  278. //          $cnt_removed++;
  279.           $remove_product = $make_links_result[$i]['products_id'];
  280.           $sql = "delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id='" . $remove_product . "' and categories_id='" . $remove_to_linked . "'";
  281.           $db->Execute($sql);
  282.         }
  283.  
  284.         // set message of completion
  285.         if (sizeof($make_links_result) == 0) {
  286.             $zv_complete_message_linked = WARNING_REMOVE_FROM_IN_TO_LINKED . $zv_complete_message_linked;
  287.             $warning_color = 'caution';
  288.         } else {
  289.           if ($check_category_from->RecordCount() < 1 or $check_category_to->RecordCount() < 1) {
  290.             $zv_complete_message_linked = WARNING_REMOVE_LINKED . $zv_complete_message_linked;
  291.             $warning_color = 'warning';
  292.           } else {
  293.             $zv_complete_message_linked = SUCCESS_REMOVE_LINKED . $zv_complete_message_linked;
  294.             $warning_color = 'success';
  295.           }
  296.         }
  297.  
  298.         if (sizeof($make_links_result) == 0) {
  299.           $messageStack->add_session($zv_complete_message_linked, $warning_color);
  300.         } else {
  301.           $messageStack->add_session($zv_complete_message_linked, $warning_color);
  302.         }
  303.  
  304.         zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  305.         break;
  306.  
  307.       case 'reset_categories_products_to_another_category_master':
  308.         // reset the master_categories_id for all products in selected category
  309.  
  310.         $zv_invalid_reset_master= 'false';
  311.         $zv_complete_message_master = '';
  312.         $reset_from_master = $_POST['reset_categories_id_from_master'];
  313.  
  314.         $check_category_from = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $reset_from_master . "' limit 1");
  315.  
  316.         // check if from is valid category
  317.         if ($check_category_from->RecordCount() < 1) {
  318.           $zv_invalid_reset_master = 'true';
  319.           $zv_complete_message_master .= WARNING_RESET_ALL_PRODUCTS_TO_CATEGORY_FROM_MASTER . $reset_from_master . '&nbsp;';
  320.         } else {
  321.           $zv_complete_message_master .= SUCCESS_RESET_ALL_PRODUCTS_TO_CATEGORY_FROM_MASTER . $reset_from_master . '&nbsp;';
  322.         }
  323.  
  324.         if ($zv_invalid_reset_master == 'true') {
  325.           $messageStack->add_session($zv_complete_message_master, 'warning');
  326.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  327.         }
  328.  
  329.         ///////////////////////////////////////////////////////////////
  330.         // if either category was invalid nothing processes below
  331.         ///////////////////////////////////////////////////////////////
  332.  
  333.         $reset_master_categories_id = $db->Execute("select p.products_id, p.master_categories_id, ptoc.categories_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " ptoc on ptoc.products_id= p.products_id and ptoc.categories_id='" . $reset_from_master . "' where ptoc.categories_id='" . $reset_from_master . "'");
  334.  
  335.         while (!$reset_master_categories_id->EOF) {
  336.           $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $reset_from_master . "' where products_id='" . $reset_master_categories_id->fields['products_id'] . "'");
  337.           // reset products_price_sorter for searches etc.
  338.           zen_update_products_price_sorter($reset_master_categories_id->fields['products_id']);
  339.           $reset_master_categories_id->MoveNext();
  340.         }
  341.  
  342.         $messageStack->add_session($zv_complete_message_master, 'success');
  343.         zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  344.         break;
  345.  
  346.       case 'set_master_categories_id':
  347.         $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $_GET['master_category'] . "' where products_id='" . $products_filter . "'");
  348.         // reset products_price_sorter for searches etc.
  349.         zen_update_products_price_sorter($products_filter);
  350.  
  351.         zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $current_category_id));
  352.         break;
  353.  
  354.       case 'update_product':
  355.         $zv_check_master_categories_id = 'true';
  356.         $new_categories_sort_array[] = $_POST['current_master_categories_id'];
  357.         $current_master_categories_id = $_POST['current_master_categories_id'];
  358.  
  359.         // set the linked products master_categories_id product(s)
  360.         for ($i=0, $n=sizeof($_POST['categories_add']); $i<$n; $i++) {
  361.           // is current master_categories_id in the list?
  362.           if ($zv_check_master_categories_id == 'true' and $_POST['categories_add'][$i] == $current_master_categories_id->fields['master_categories_id']) {
  363.             $zv_check_master_categories_id = 'true';
  364.             // array is set above to master category
  365.           } else {
  366.             $new_categories_sort_array[] = $_POST['categories_add'][$i];
  367.           }
  368.         }
  369.  
  370.         // remove existing products_to_categories for current product
  371.         $db->Execute("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id='" . $products_filter . "'");
  372.  
  373.         $reset_master_categories_id = '';
  374.         $old_master_categories_id = $current_master_categories_id;
  375.         // add products to categories in order of master_categories_id first then others
  376.         $verify_current_category_id = false;
  377.         for ($i=0, $n=sizeof($new_categories_sort_array); $i<$n; $i++) {
  378.           // is current master_categories_id in the list?
  379.           if ($new_categories_sort_array[$i] <= 0) {
  380.             die('I WOULD NOT ADD ' . $new_categories_sort_array[$i] . '<br>');
  381.           } else {
  382.             if ($current_category_id == $new_categories_sort_array[$i]) {
  383.               $verify_current_category_id = true;
  384.             }
  385.             $db->Execute("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . "
  386.                    (products_id, categories_id)
  387.                    values ($products_filter, $new_categories_sort_array[$i])");
  388.             if ($reset_master_categories_id == '') {
  389.               $reset_master_categories_id = $new_categories_sort_array[$i];
  390.             }
  391.             if ($old_master_categories_id == $new_categories_sort_array[$i]) {
  392.               $reset_master_categories_id = $new_categories_sort_array[$i];
  393.             }
  394.           }
  395.         }
  396.  
  397.         // reset master_categories_id in products table
  398.         if ($zv_check_master_categories_id == 'true') {
  399.           // make sure master_categories_id is set to current master_categories_id
  400.           $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $current_master_categories_id . "' where products_id='" . $products_filter . "'");
  401.         } else {
  402.           // reset master_categories_id to current_category_id because it was unselected
  403.           $db->Execute("update " . TABLE_PRODUCTS . " set master_categories_id='" . $reset_master_categories_id . "' where products_id='" . $products_filter . "'");
  404.         }
  405.  
  406.         // recalculate price based on new master_categories_id
  407.         zen_update_products_price_sorter($products_filter);
  408.  
  409.         if ($zv_check_master_categories_id == 'true') {
  410.           $messageStack->add_session(SUCCESS_MASTER_CATEGORIES_ID, 'success');
  411.         } else {
  412.           $messageStack->add_session(WARNING_MASTER_CATEGORIES_ID, 'warning');
  413.         }
  414.  
  415.         // if product was removed from current categories_id stay in same category
  416.         if (!$verify_current_category_id) {
  417.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'current_category_id=' . $current_category_id));
  418.         } else {
  419.           zen_redirect(zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  420.         }
  421.         break;
  422.  
  423.     }
  424.   }
  425.  
  426.   $product_to_copy = $db->Execute("select p.products_id, pd.products_name, p.products_price_sorter, p.products_model, p.master_categories_id, p.products_image
  427.                                  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd " . "
  428.                         where p.products_id = '" . $products_filter . "'
  429.                         and p.products_id = pd.products_id
  430.                         and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
  431.  
  432. //  $catagories_query = "select distinct cd.categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " cd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " ptoc on cd.categories_id = ptoc.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
  433.   $catagories_query = "select distinct ptoc.categories_id, cd.* from " . TABLE_PRODUCTS_TO_CATEGORIES. " ptoc left join " . TABLE_CATEGORIES_DESCRIPTION  . " cd on cd.categories_id = ptoc.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by cd.categories_name";
  434.   $categories_list = $db->Execute($catagories_query);
  435.  
  436. // current products to categories
  437.   $products_list = $db->Execute("select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $products_filter . "'");
  438.  
  439. ?>
  440. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  441. <html <?php echo HTML_PARAMS; ?>>
  442. <head>
  443. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  444. <title><?php echo TITLE; ?></title>
  445. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  446. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  447. <script language="javascript" src="includes/menu.js"></script>
  448. <script language="javascript" src="includes/general.js"></script>
  449. <script language="javascript"><!--
  450. function go_option() {
  451.   if (document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value != "none") {
  452.     location = "<?php echo zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'option_page=' . ($_GET['option_page'] ? $_GET['option_page'] : 1)); ?>&option_order_by="+document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value;
  453.   }
  454. }
  455. //--></script>
  456. <script type="text/javascript">
  457.   <!--
  458.   function init()
  459.   {
  460.     cssjsmenu('navbar');
  461.     if (document.getElementById)
  462.     {
  463.       var kill = document.getElementById('hoverJS');
  464.       kill.disabled = true;
  465.     }
  466.   }
  467.   // -->
  468. </script>
  469. </head>
  470. <!-- <body onload="init()"> -->
  471. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init()">
  472. <!-- header //-->
  473. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  474. <!-- header_eof //-->
  475.  
  476. <!-- body //-->
  477. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  478.   <tr>
  479. <!-- body_text //-->
  480.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  481. <?php
  482. ///////////////////////////////////////////////////////////
  483. // BOF: NEW CODE TO KEEP
  484. ?>
  485.  
  486. <?php
  487.   if ($action != 'edit_update') {
  488.     require(DIR_WS_MODULES . FILENAME_PREV_NEXT_DISPLAY);
  489. ?>
  490.  
  491.       <tr><form name="set_products_filter_id" <?php echo 'action="' . zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'action=set_products_filter') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?><?php echo zen_draw_hidden_field('current_category_id', $_GET['current_category_id']); ?>
  492.         <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  493.  
  494. <?php
  495. if ($_GET['products_filter'] != '') {
  496. ?>
  497.           <tr>
  498.             <td class="main" width="200" align="left" valign="top">&nbsp;</td>
  499.             <td colspan="2" class="main"><?php echo TEXT_PRODUCT_TO_VIEW; ?></td>
  500.           </tr>
  501.           <tr>
  502.             <td class="main" width="200" align="center" valign="top">
  503.  
  504. <?php
  505. // FIX HERE
  506.   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
  507.   echo ($display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '');
  508.   echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
  509.   echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
  510.   $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'");
  511.   while (!$not_for_cart->EOF) {
  512.     $not_for_cart_array[] = $not_for_cart->fields['products_id'];
  513.     $not_for_cart->MoveNext();
  514.    }
  515. ?>
  516.             </td>
  517.             <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>
  518.             <td class="main" align="center" valign="top">
  519.               <?php
  520.                 echo zen_image_submit('button_display.gif', IMAGE_DISPLAY);
  521.               ?>
  522.             </td>
  523.           </tr>
  524. <?php
  525. } else {
  526.   $not_for_cart = '';
  527. } // $_GET['products_filter'] != ''
  528. ?>
  529.  
  530. <?php
  531. // show when product is linked
  532. // not used in multiple products link manager
  533. ?>
  534.  
  535.         </table></td>
  536.       </form></tr>
  537. <?php } // $action != 'edit_update' ?>
  538. <?php
  539. // EOF: NEW CODE TO KEEP
  540. ///////////////////////////////////////////////////////////
  541. ?>
  542.       <tr>
  543.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  544. <?php if ($product_to_copy->EOF) { ?>
  545.           <tr>
  546.             <td class="pageHeading"><?php echo HEADING_TITLE . '<br />' . '<span class="alert">' . TEXT_PRODUCTS_ID . $products_filter . TEXT_PRODUCTS_ID_INVALID . '</span>'; ?></td>
  547.           </tr>
  548.           <tr>
  549.             <td class="main"><?php echo TEXT_PRODUCTS_ID_NOT_REQUIRED; ?></td>
  550.           </tr>
  551.           <tr>
  552.             <td><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  553.           </tr>
  554. <?php } else { ?>
  555.           <tr>
  556.             <td class="pageHeading"><?php echo HEADING_TITLE . '<br />' . TEXT_PRODUCTS_ID . $product_to_copy->fields['products_id'] . ' ' . $product_to_copy->fields['products_name']; ?></td>
  557.           </tr>
  558.           <tr>
  559.             <td><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  560.           </tr>
  561.           <tr>
  562.             <td class="main"><?php echo TEXT_INFO_PRODUCTS_TO_CATEGORIES_LINKER_INTRO; ?></td>
  563.           </tr>
  564.           <tr><?php echo zen_draw_form('restrict_product', FILENAME_PRODUCTS_TO_CATEGORIES, '', 'get', '', true) . zen_draw_hidden_field('action', 'set_master_categories_id') . zen_draw_hidden_field('products_filter', $products_filter) . zen_draw_hidden_field('current_category_id', $_GET['current_category_id']); ?>
  565.             <td class="main">
  566.               <?php
  567.                 echo '&nbsp;&nbsp;&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;';
  568.                 echo '<strong>' . TEXT_MASTER_CATEGORIES_ID . '</strong> ' . zen_draw_pull_down_menu('master_category', zen_get_master_categories_pulldown($products_filter), $product_to_copy->fields['master_categories_id'], 'onChange="this.form.submit();"');
  569.                 echo zen_hide_session_id();
  570.                 if ($product_to_copy->fields['master_categories_id'] <= 0) {
  571.                   echo '&nbsp;&nbsp;' . '<span class="alert">' . WARNING_MASTER_CATEGORIES_ID . '</span>';
  572.                 }
  573.                 echo TEXT_INFO_LINKED_TO_COUNT . $products_list->RecordCount();
  574.               ?>
  575.             </td>
  576.           </form></tr>
  577.           <tr>
  578.             <td><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  579.           </tr>
  580.         </table></td>
  581.       </tr>
  582.  
  583. <!-- bof: link to categories //-->
  584.       <tr>
  585.         <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  586.           <tr>
  587.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  588.           <tr>
  589.             <td colspan="<?php echo MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS*2; ?>"><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
  590.           </tr>
  591.           <tr class="dataTableHeadingRow">
  592.             <td colspan="<?php echo MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS*2; ?>" class="pageHeading" align="center"><?php echo TEXT_INFO_PRODUCTS_TO_CATEGORIES_AVAILABLE; ?></td>
  593.           </tr>
  594. <?php
  595.     while(!$products_list->EOF) {
  596.       $selected_categories_check .= $products_list->fields['categories_id'];
  597.       $products_list->MoveNext();
  598.       if (!$products_list->EOF) {
  599.         $selected_categories_check .= ',';
  600.       }
  601.     }
  602.     $selected_categories = explode(',', $selected_categories_check);
  603.     echo zen_draw_form('update', FILENAME_PRODUCTS_TO_CATEGORIES, 'action=update_product&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id, 'post');
  604. ?>
  605.           <tr class="dataTableHeadingRow">
  606.             <td colspan="<?php echo MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS*2; ?>" height="50" align="center" valign="middle" class="dataTableHeadingContent">
  607.               <?php
  608.                 if ($product_to_copy->fields['master_categories_id'] < 1) {
  609.                   echo '<span class="alert">' . TEXT_SET_MASTER_CATEGORIES_ID . '</span>';
  610.                 } else {
  611.               ?>
  612.                   <input type="submit" value="<?php echo BUTTON_UPDATE_CATEGORY_LINKS; ?>">
  613.               <?php } ?>
  614.             </td>
  615.           </tr>
  616. <?php
  617.     $cnt_columns = 0;
  618.     echo '<tr class="dataTableHeadingRow">';
  619.     while ($cnt_columns != MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS) {
  620.       $cnt_columns++;
  621.       echo '<td class="dataTableHeadingContent" align="right">' . TEXT_INFO_ID . '</td>' . '<td class="dataTableHeadingContent" align="left">' . '&nbsp;&nbsp;Categories Name' . '</td>';
  622.     }
  623.         echo '</tr>';
  624. //        echo '<tr class="dataTableHeadingRow">';
  625.  
  626.     $cnt_columns = 0;
  627.     while (!$categories_list->EOF) {
  628.       $cnt_columns++;
  629.       if (zen_not_null($selected_categories_check)) {
  630.         $selected = in_array($categories_list->fields['categories_id'], $selected_categories);
  631.       } else {
  632.         $selected = false;
  633.       }
  634.       $zc_categories_checkbox = zen_draw_checkbox_field('categories_add[]', $categories_list->fields['categories_id'], $selected);
  635.       if ($cnt_columns == 1) {
  636.         echo '<tr class="dataTableHeadingRow">';
  637.       }
  638.       echo '  <td class="dataTableContent" align="right">' . $categories_list->fields['categories_id'] . '</td>' . "\n";
  639.       if ($product_to_copy->fields['master_categories_id'] == $categories_list->fields['categories_id']) {
  640. //        echo '  <td class="dataTableContent" align="left">' . ($selected ? '<strong>' : '') . $zc_categories_checkbox . '&nbsp;' . $categories_list->fields['categories_name'] . ($selected ? '</strong>' : '') . '&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '</td>' . "\n";
  641.         echo '  <td class="dataTableContent" align="left">' . '&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;' . $categories_list->fields['categories_name'] . zen_draw_hidden_field('current_master_categories_id', $categories_list->fields['categories_id']) . '</td>' . "\n";
  642.       } else {
  643.         echo '  <td class="dataTableContent" align="left">' . ($selected ? '<strong>' : '') . $zc_categories_checkbox . '&nbsp;' . $categories_list->fields['categories_name'] . ($selected ? '</strong>' : '') . '</td>' . "\n";
  644.       }
  645.       $categories_list->MoveNext();
  646.       if ($cnt_columns == MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS or $categories_list->EOF) {
  647.         if ($categories_list->EOF and $cnt_columns != MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS) {
  648.           while ($cnt_columns < MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS) {
  649.             $cnt_columns++;
  650.             echo '  <td class="dataTableContent" align="right">' . '&nbsp;' . '</td>' . "\n";
  651.             echo '  <td class="dataTableContent" align="left">' . '&nbsp;' . '</td>' . "\n";
  652.           }
  653.         }
  654.         echo '</tr>' . "\n";
  655.         $cnt_columns = 0;
  656.       }
  657.     }
  658. ?>
  659.           <tr class="dataTableHeadingRow">
  660.             <td colspan="<?php echo MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS*2; ?>" height="50" align="center" valign="middle" class="dataTableHeadingContent">
  661.               <?php
  662.                 if ($product_to_copy->fields['master_categories_id'] < 1) {
  663.                   echo '<span class="alert">' . TEXT_SET_MASTER_CATEGORIES_ID . '</span>';
  664.                 } else {
  665.               ?>
  666.                   <input type="submit" value="<?php echo BUTTON_UPDATE_CATEGORY_LINKS; ?>">
  667.               <?php } ?>
  668.             </td>
  669.  
  670.           </tr>
  671.           </form>
  672.           <tr>
  673.             <td colspan="<?php echo MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS*2; ?>" valign="top"><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
  674.           </tr>
  675.           <tr>
  676.             <td colspan="<?php echo MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS*2; ?>" ><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  677.           </tr>
  678.           <tr>
  679.             <td colspan="<?php echo MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS*2; ?>" class="main"><?php echo TEXT_INFO_PRODUCTS_TO_CATEGORIES_LINKER; ?></td>
  680.           </tr>
  681.           <tr>
  682.             <td><?php echo zen_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
  683.           </tr>
  684. <?php } ?>
  685.             </table>
  686. <!-- eof: link to categories //-->
  687.             <table border="5" class="dataTableHeadingRow">
  688.               <tr class="dataTableHeadingRow">
  689.                 <td class="dataTableHeadingContent">
  690.             <table border="0" class="dataTableHeadingRow" width="100%">
  691.               <tr class="dataTableHeadingRow">
  692.                 <td class="pageHeading" align="center"><?php echo HEADER_CATEGORIES_GLOBAL_CHANGES; ?></td>
  693.               </tr>
  694.             </table>
  695. <!-- copy products from one category to another as linked or new products -->
  696.             <table border="0" class="dataTableHeadingRow" width="100%">
  697.               <tr>
  698.                 <td colspan="3" valign="middle" height="10"><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
  699.               </tr>
  700.               <form name="linked_copy" method="post" action="<?php echo zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'action=copy_categories_products_to_another_category_linked' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id, 'NONSSL'); ?>">
  701.               <?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  702.               <tr class="dataTableHeadingRow">
  703.                 <td colspan="3" class="dataTableContent"><?php echo TEXT_INFO_COPY_ALL_PRODUCTS_TO_CATEGORY_LINKED; ?></td>
  704.               </tr>
  705.               <tr class="dataTableHeadingRow">
  706.                 <td class="dataTableContent">
  707.                   <?php
  708.                     $categories_id_from_linked = TEXT_INFO_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . '&nbsp;<input type="text" name="copy_categories_id_from_linked" size="4">&nbsp;';
  709.                     echo $categories_id_from_linked;
  710.                   ?>
  711.                 </td>
  712.                 <td class="dataTableContent">
  713.                   <?php
  714.                     $categories_id_to_linked = TEXT_INFO_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . '&nbsp;<input type="text" name="copy_categories_id_to_linked" size="4">&nbsp;';
  715.                     echo $categories_id_to_linked;
  716.                   ?>
  717.                 </td>
  718.                 <td align="right" class="dataTableHeadingContent" valign="top">&nbsp;<input type="submit" value="<?php echo BUTTON_COPY_CATEGORY_LINKED; ?>">&nbsp;</td>
  719.               </tr>
  720.               </form>
  721.             </table>
  722. <!-- eof: copy products //-->
  723. <!-- remove products from one category that are linked to another category -->
  724.             <table border="0" class="dataTableHeadingRow" width="100%">
  725.               <tr>
  726.                 <td colspan="3" valign="middle" height="10"><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
  727.               </tr>
  728.               <form name="linked_remove" method="post" action="<?php echo zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'action=remove_categories_products_to_another_category_linked' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id, 'NONSSL'); ?>">
  729.               <?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  730.               <tr class="dataTableHeadingRow">
  731.                 <td colspan="3" class="dataTableContent"><?php echo TEXT_INFO_REMOVE_ALL_PRODUCTS_TO_CATEGORY_LINKED; ?></td>
  732.               </tr>
  733.               <tr class="dataTableHeadingRow">
  734.                 <td class="dataTableContent">
  735.                   <?php
  736.                     $categories_id_from_linked = TEXT_INFO_REMOVE_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED . '&nbsp;<input type="text" name="remove_categories_id_from_linked" size="4">&nbsp;';
  737.                     echo $categories_id_from_linked;
  738.                   ?>
  739.                 </td>
  740.                 <td class="dataTableHeadingContent">
  741.                   <?php
  742.                     $categories_id_to_linked = TEXT_INFO_REMOVE_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED . '&nbsp;<input type="text" name="remove_categories_id_to_linked" size="4">&nbsp;';
  743.                     echo $categories_id_to_linked;
  744.                   ?>
  745.                 </td>
  746.                 <td align="right" class="dataTableHeadingContent" valign="top">&nbsp;<input type="submit" value="<?php echo BUTTON_REMOVE_CATEGORY_LINKED; ?>">&nbsp;</td>
  747.               </tr>
  748.               </form>
  749.               <tr>
  750.                 <td colspan="3"><?php echo zen_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
  751.               </tr>
  752.             </table>
  753. <!-- eof: remove products //-->
  754. <!-- reset master_categories_id to request Categories -->
  755.             <table border="0" class="dataTableHeadingRow" width="100%">
  756.               <tr>
  757.                 <td colspan="3" valign="middle" height="10"><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
  758.               </tr>
  759.               <form name="master_reset" method="post" action="<?php echo zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'action=reset_categories_products_to_another_category_master' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id, 'NONSSL'); ?>">
  760.               <?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  761.               <tr class="dataTableHeadingRow">
  762.                 <td colspan="3" class="dataTableContent"><?php echo TEXT_INFO_RESET_ALL_PRODUCTS_TO_CATEGORY_MASTER; ?></td>
  763.               </tr>
  764.               <tr class="dataTableHeadingRow">
  765.                 <td class="dataTableContent">
  766.                   <?php
  767.                     $categories_id_from_linked = TEXT_INFO_RESET_ALL_PRODUCTS_TO_CATEGORY_FROM_MASTER . '&nbsp;<input type="text" name="reset_categories_id_from_master" size="4">&nbsp;';
  768.                     echo $categories_id_from_linked;
  769.                   ?>
  770.                 </td>
  771.                 <td align="right" class="dataTableHeadingContent" valign="top">&nbsp;<input type="submit" value="<?php echo BUTTON_RESET_CATEGORY_MASTER; ?>">&nbsp;</td>
  772.               </tr>
  773.               </form>
  774.               <tr>
  775.                 <td colspan="3"><?php echo zen_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
  776.               </tr>
  777.             </table>
  778. <!-- eof: reset master_categories_id //-->
  779.                 </td>
  780.               </tr>
  781.             </table>
  782.  
  783.             </td>
  784. <?php
  785.   $heading = array();
  786.   $contents = array();
  787.  
  788.   switch ($action) {
  789.     case 'edit':
  790.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_PRODUCTS_TO_CATEGORIES . '</b>');
  791.       $contents = array('form' => zen_draw_form('products_downloads_edit', FILENAME_PRODUCTS_TO_CATEGORIES, ''));
  792.       if ($products_filter > 0) {
  793.         $contents[] = array('text' => zen_image(DIR_WS_CATALOG_IMAGES . $product_to_copy->fields['products_image'], $product_to_copy->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));
  794.       }
  795.       $contents[] = array('text' => '<b>' . TEXT_PRODUCTS_NAME . $product_to_copy->fields['products_name'] . '<br />' . TEXT_PRODUCTS_MODEL . $product_to_copy->fields['products_model'] . '</b>');
  796.       $contents[] = array('text' => '<br />' . TEXT_SET_PRODUCTS_TO_CATEGORIES_LINKS . '<br />' . TEXT_PRODUCTS_ID . zen_draw_input_field('products_filter', $products_filter));
  797. //      $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>' . '</form>');
  798.       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, 'products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>' . '</form>');
  799.       break;
  800.     default:
  801.       $heading[] = array('text' => '<b>' . $product_to_copy->fields['products_id'] . ' ' . $product_to_copy->fields['products_name'] . '</b>');
  802.       if ($products_filter > 0) {
  803.         $contents[] = array('text' => zen_image(DIR_WS_CATALOG_IMAGES . $product_to_copy->fields['products_image'], $product_to_copy->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));
  804.       }
  805.       $contents[] = array('text' => '<br />' . TEXT_PRODUCTS_NAME . $product_to_copy->fields['products_name']);
  806.       $contents[] = array('text' => TEXT_PRODUCTS_MODEL . $product_to_copy->fields['products_model']);
  807.       $contents[] = array('text' => TEXT_PRODUCTS_PRICE . zen_get_products_display_price($products_filter));
  808.       switch (true) {
  809.         case ($product_to_copy->fields['master_categories_id'] == 0 and $products_filter > 0):
  810.           $contents[] = array('text' => '<br /><span class="alert">' . WARNING_MASTER_CATEGORIES_ID . '</span><br />&nbsp;');
  811.           break;
  812.         default:
  813.           $contents[] = array('text' => '<form action="' . FILENAME_PRODUCTS_TO_CATEGORIES . '.php' . '?action=edit&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id . '" method="post">');
  814.           $contents[] = array('align' => 'center', 'text' => '<input type="submit" value="' . BUTTON_NEW_PRODUCTS_TO_CATEGORIES . '"></form>');
  815.           $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3') . '<br />&nbsp;');
  816.           $contents[] = array('align' => 'center', 'text' =>
  817.             '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '</a>&nbsp;&nbsp;' .
  818.             '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '</a><br /><br />' .
  819.             '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . zen_get_parent_category_id($products_filter) . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_details.gif', IMAGE_DETAILS) . '</a>&nbsp;&nbsp;' .
  820.             '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . zen_get_parent_category_id($products_filter) . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '</a>' . '<br />&nbsp;'
  821.             );
  822.           break;
  823.       }
  824.     break;
  825.   }
  826.  
  827.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  828.     echo '            <td width="25%" valign="top">' . "\n";
  829.  
  830.     $box = new box;
  831.     echo $box->infoBox($heading, $contents);
  832.  
  833.     echo '            </td>' . "\n";
  834.   }
  835. ?>
  836.           </tr>
  837.         </td></table>
  838.       </tr>
  839.  
  840.     </table></td>
  841. <!-- downloads by product_name_eof //-->
  842.   </tr>
  843. </table>
  844. <!-- body_text_eof //-->
  845. <!-- footer //-->
  846. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  847. <!-- footer_eof //-->
  848. </body>
  849. </html>
  850. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron