Guest User

Untitled

a guest
Dec 10th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 70.79 KB | None | 0 0
  1. require('includes/application_top.php');
  2.  
  3. require(DIR_WS_CLASSES . 'currencies.php');
  4. $currencies = new currencies();
  5.  
  6. $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  7.  
  8. if (tep_not_null($action)) {
  9. switch ($action) {
  10. case 'setflag':
  11. if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
  12. if (isset($HTTP_GET_VARS['pID'])) {
  13. tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
  14. }
  15.  
  16. if (USE_CACHE == 'true') {
  17. tep_reset_cache_block('categories');
  18. tep_reset_cache_block('also_purchased');
  19. }
  20. }
  21.  
  22. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));
  23. break;
  24. case 'insert_category':
  25. case 'update_category':
  26. if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
  27. $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);
  28.  
  29. $sql_data_array = array('sort_order' => $sort_order);
  30.  
  31. if ($action == 'insert_category') {
  32. $insert_sql_data = array('parent_id' => $current_category_id,
  33. 'date_added' => 'now()');
  34.  
  35. $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  36.  
  37. tep_db_perform(TABLE_CATEGORIES, $sql_data_array);
  38.  
  39. $categories_id = tep_db_insert_id();
  40. } elseif ($action == 'update_category') {
  41. $update_sql_data = array('last_modified' => 'now()');
  42.  
  43. $sql_data_array = array_merge($sql_data_array, $update_sql_data);
  44.  
  45. tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "'");
  46. }
  47.  
  48. $languages = tep_get_languages();
  49. for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  50. $categories_name_array = $HTTP_POST_VARS['categories_name'];
  51.  
  52. $language_id = $languages[$i]['id'];
  53.  
  54. $sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));
  55.  
  56. if ($action == 'insert_category') {
  57. $insert_sql_data = array('categories_id' => $categories_id,
  58. 'language_id' => $languages[$i]['id']);
  59.  
  60. $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  61.  
  62. tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);
  63. } elseif ($action == 'update_category') {
  64. tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
  65. }
  66. }
  67.  
  68. if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {
  69. tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");
  70. }
  71.  
  72. if (USE_CACHE == 'true') {
  73. tep_reset_cache_block('categories');
  74. tep_reset_cache_block('also_purchased');
  75. }
  76.  
  77. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
  78. break;
  79. case 'delete_category_confirm':
  80. if (isset($HTTP_POST_VARS['categories_id'])) {
  81. $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
  82.  
  83. $categories = tep_get_category_tree($categories_id, '', '0', '', true);
  84. $products = array();
  85. $products_delete = array();
  86.  
  87. for ($i=0, $n=sizeof($categories); $i<$n; $i++) {
  88. $product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$categories[$i]['id'] . "'");
  89.  
  90. while ($product_ids = tep_db_fetch_array($product_ids_query)) {
  91. $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];
  92. }
  93. }
  94.  
  95. reset($products);
  96. while (list($key, $value) = each($products)) {
  97. $category_ids = '';
  98.  
  99. for ($i=0, $n=sizeof($value['categories']); $i<$n; $i++) {
  100. $category_ids .= "'" . (int)$value['categories'][$i] . "', ";
  101. }
  102. $category_ids = substr($category_ids, 0, -2);
  103.  
  104. $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$key . "' and categories_id not in (" . $category_ids . ")");
  105. $check = tep_db_fetch_array($check_query);
  106. if ($check['total'] < '1') {
  107. $products_delete[$key] = $key;
  108. }
  109. }
  110.  
  111. // removing categories can be a lengthy process
  112. tep_set_time_limit(0);
  113. for ($i=0, $n=sizeof($categories); $i<$n; $i++) {
  114. tep_remove_category($categories[$i]['id']);
  115. }
  116.  
  117. reset($products_delete);
  118. while (list($key) = each($products_delete)) {
  119. tep_remove_product($key);
  120. }
  121. }
  122.  
  123. if (USE_CACHE == 'true') {
  124. tep_reset_cache_block('categories');
  125. tep_reset_cache_block('also_purchased');
  126. }
  127.  
  128. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
  129. break;
  130. case 'delete_product_confirm':
  131. if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['product_categories']) && is_array($HTTP_POST_VARS['product_categories'])) {
  132. $product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
  133. $product_categories = $HTTP_POST_VARS['product_categories'];
  134.  
  135. for ($i=0, $n=sizeof($product_categories); $i<$n; $i++) {
  136. tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "' and categories_id = '" . (int)$product_categories[$i] . "'");
  137. }
  138.  
  139. $product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");
  140. $product_categories = tep_db_fetch_array($product_categories_query);
  141.  
  142. if ($product_categories['total'] == '0') {
  143. tep_remove_product($product_id);
  144. }
  145. }
  146.  
  147. if (USE_CACHE == 'true') {
  148. tep_reset_cache_block('categories');
  149. tep_reset_cache_block('also_purchased');
  150. }
  151.  
  152. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
  153. break;
  154. case 'move_category_confirm':
  155. if (isset($HTTP_POST_VARS['categories_id']) && ($HTTP_POST_VARS['categories_id'] != $HTTP_POST_VARS['move_to_category_id'])) {
  156. $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
  157. $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);
  158.  
  159. $path = explode('_', tep_get_generated_category_path_ids($new_parent_id));
  160.  
  161. if (in_array($categories_id, $path)) {
  162. $messageStack->add_session(ERROR_CANNOT_MOVE_CATEGORY_TO_PARENT, 'error');
  163.  
  164. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
  165. } else {
  166. tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where categories_id = '" . (int)$categories_id . "'");
  167.  
  168. if (USE_CACHE == 'true') {
  169. tep_reset_cache_block('categories');
  170. tep_reset_cache_block('also_purchased');
  171. }
  172.  
  173. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));
  174. }
  175. }
  176.  
  177. break;
  178. case 'move_product_confirm':
  179. $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
  180. $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);
  181.  
  182. $duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$new_parent_id . "'");
  183. $duplicate_check = tep_db_fetch_array($duplicate_check_query);
  184. if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . (int)$new_parent_id . "' where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$current_category_id . "'");
  185.  
  186. if (USE_CACHE == 'true') {
  187. tep_reset_cache_block('categories');
  188. tep_reset_cache_block('also_purchased');
  189. }
  190.  
  191. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));
  192. break;
  193. case 'insert_product':
  194. case 'update_product':
  195. if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {
  196. $action = 'new_product';
  197. } else {
  198. if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);
  199. $products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);
  200.  
  201. $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';
  202.  
  203. $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),
  204. 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),
  205. 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),
  206. 'products_date_available' => $products_date_available,
  207. 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),
  208. 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),
  209. 'ordinabile' => tep_db_prepare_input($HTTP_POST_VARS['ordinabile']),
  210. 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),
  211. 'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));
  212.  
  213. if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {
  214. $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);
  215. }
  216.  
  217. if ($action == 'insert_product') {
  218. $insert_sql_data = array('products_date_added' => 'now()');
  219.  
  220. $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  221.  
  222. tep_db_perform(TABLE_PRODUCTS, $sql_data_array);
  223. $products_id = tep_db_insert_id();
  224.  
  225. tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
  226. } elseif ($action == 'update_product') {
  227. $update_sql_data = array('products_last_modified' => 'now()');
  228.  
  229. $sql_data_array = array_merge($sql_data_array, $update_sql_data);
  230.  
  231. tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
  232. }
  233.  
  234. //060417/zepitt/multi images extra/modif # 1
  235. //sql instructions to create or update product
  236. unset($sql_data_array);
  237.  
  238. for($nb=1; $nb <= NB_IMAGE_EXTRA ; $nb++) {
  239. $var_delete_image = "delete_image".$nb;
  240. $var_products_image = "products_image".$nb;
  241. // possibility to delete extra images, but not the standard image
  242. if ($HTTP_POST_VARS[$var_delete_image] == 'yes') {
  243. //not physical deleting
  244. //unlink(DIR_FS_CATALOG_IMAGES_EXTRA.$HTTP_POST_VARS[$var_products_image]);
  245. $sql_data_array[$var_products_image] = tep_db_prepare_input($HTTP_POST_VARS['none']);
  246. }
  247. //end delete image function
  248. else if (isset($HTTP_POST_VARS[$var_products_image]) && tep_not_null($HTTP_POST_VARS[$var_products_image]) && ($HTTP_POST_VARS[$var_products_image] != 'none')) {
  249. $sql_data_array[$var_products_image] = tep_db_prepare_input($HTTP_POST_VARS[$var_products_image]);
  250. }
  251. }
  252. $insert_sql_data = array('products_id' => $products_id);
  253. $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  254. if(isset($sql_data_array)) tep_db_perform(TABLE_PRODUCTS_IMAGES, $sql_data_array, 'replace');
  255. //060417/zepitt/multi images extra EOF
  256.  
  257. $languages = tep_get_languages();
  258. for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  259. $language_id = $languages[$i]['id'];
  260.  
  261. $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),
  262. 'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),
  263. 'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));
  264.  
  265. if ($action == 'insert_product') {
  266. $insert_sql_data = array('products_id' => $products_id,
  267. 'language_id' => $language_id);
  268.  
  269. $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  270. tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
  271. } elseif ($action == 'update_product') {
  272. tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
  273. }
  274. }
  275.  
  276.  
  277.  
  278. if (USE_CACHE == 'true') {
  279. tep_reset_cache_block('categories');
  280. tep_reset_cache_block('also_purchased');
  281. }
  282.  
  283. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
  284. }
  285.  
  286. break;
  287.  
  288. case 'copy_to_confirm':
  289. if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {
  290. $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
  291. $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
  292.  
  293. if ($HTTP_POST_VARS['copy_as'] == 'link') {
  294. if ($categories_id != $current_category_id) {
  295. $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");
  296. $check = tep_db_fetch_array($check_query);
  297. if ($check['total'] < '1') {
  298. tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
  299. }
  300. } else {
  301. $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
  302. }
  303. //060417/zepitt/multi images extra/modif #02
  304. // update sql copy or duplicate an item
  305. } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
  306. $product_query = tep_db_query("SELECT p.products_quantity, p.products_model,
  307. p.products_image, p.products_price, p.products_date_available, p.products_weight,
  308. p.products_tax_class_id, p.manufacturers_id,
  309. pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image4, pi.products_image5,
  310. pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9
  311. FROM (".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_PRODUCTS_IMAGES." pi ON p.products_id = pi.products_id)
  312. WHERE p.products_id = '".(int)$products_id."'");
  313. $product = tep_db_fetch_array($product_query);
  314.  
  315. tep_db_query("INSERT INTO " . TABLE_PRODUCTS . "
  316. (products_quantity, products_model, products_image, products_price, products_date_added, products_date_available,
  317. products_weight, products_status, products_tax_class_id, manufacturers_id)
  318. VALUES ('" .
  319. tep_db_input($product['products_quantity']) . "', '" .
  320. tep_db_input($product['products_model']) . "', '" .
  321. tep_db_input($product['products_image']) . "', '" .
  322. tep_db_input($product['products_price']) . "', now(), '" .
  323. tep_db_input($product['products_date_available']) . "', '" .
  324. tep_db_input($product['products_weight']) . "', '0', '" .
  325. (int)$product['products_tax_class_id'] . "', '" .
  326. (int)$product['manufacturers_id'] . "')");
  327. $dup_products_id = tep_db_insert_id();
  328.  
  329. tep_db_query("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
  330. (products_id, products_image1, products_image2, products_image3, products_image4, products_image5,
  331. products_image6, products_image7, products_image8, products_image9)
  332. VALUES ('" .
  333. (int)$dup_products_id . "', '" .
  334. tep_db_input($product['products_image1']) . "', '" .
  335. tep_db_input($product['products_image2']) . "', '" .
  336. tep_db_input($product['products_image3']) . "', '" .
  337. tep_db_input($product['products_image4']) . "', '" .
  338. tep_db_input($product['products_image5']) . "', '" .
  339. tep_db_input($product['products_image6']) . "', '" .
  340. tep_db_input($product['products_image7']) . "', '" .
  341. tep_db_input($product['products_image8']) . "', '" .
  342. tep_db_input($product['products_image9']) . "')");
  343.  
  344. //060417/zepitt/multi images extra EOF
  345.  
  346. $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
  347. while ($description = tep_db_fetch_array($description_query)) {
  348. tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
  349. }
  350.  
  351. tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
  352. $products_id = $dup_products_id;
  353. }
  354.  
  355. if (USE_CACHE == 'true') {
  356. tep_reset_cache_block('categories');
  357. tep_reset_cache_block('also_purchased');
  358. }
  359. }
  360.  
  361. tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
  362. break;
  363. case 'new_product_preview':
  364. // copy image only if modified
  365. $products_image = new upload('products_image');
  366. $products_image->set_destination(DIR_FS_CATALOG_IMAGES);
  367. if ($products_image->parse() && $products_image->save()) {
  368. $products_image_name = $products_image->filename;
  369. } else {
  370. $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');
  371. }
  372.  
  373. //060417/zepitt/multi images extra #03
  374. // update images for preview
  375.  
  376. for($nb=1; $nb <= NB_IMAGE_EXTRA ; $nb++) {
  377. $var_products_image = "products_image".$nb;
  378. $var_products_image_name = "products_image".$nb."_name";
  379. $var_products_previous_image = "products_previous_image".$nb;
  380. $var_delete_image = "delete_image".$nb;
  381.  
  382. $$var_products_image = new upload($var_products_image);
  383. $$var_products_image->set_destination(DIR_FS_CATALOG_IMAGES_EXTRA);
  384. if ($HTTP_POST_VARS[$var_delete_image] == 'yes') { $$var_products_image_name = ""; }
  385. else {
  386. if ($$var_products_image->parse() && $$var_products_image->save()) {
  387. $$var_products_image_name = $$var_products_image->filename;
  388. } else {
  389. $$var_products_image_name = (isset($HTTP_POST_VARS[$var_products_previous_image]) ? $HTTP_POST_VARS[$var_products_previous_image] : '');
  390. }
  391. }
  392. }
  393. //060417/zepitt/multi images extra EOF
  394. break;
  395. }
  396. }
  397.  
  398. // check if the catalog image directory exists
  399. if (is_dir(DIR_FS_CATALOG_IMAGES)) {
  400. if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
  401. } else {
  402. $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
  403.  
  404. //060417/zepitt/multi images extra #04
  405. }
  406. if (is_dir(DIR_FS_CATALOG_IMAGES_EXTRA)) {
  407. if (!is_writeable(DIR_FS_CATALOG_IMAGES_EXTRA)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
  408. } else {
  409. $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
  410. }
  411. //060417/zepitt/multi images extra EOF
  412. ?>
  413. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  414. <html <?php echo HTML_PARAMS; ?>>
  415. <head>
  416. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  417. <title><?php echo TITLE; ?></title>
  418. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  419. <script language="javascript" src="includes/general.js"></script>
  420. </head>
  421. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
  422. <div id="spiffycalendar" class="text"></div>
  423. <!-- header //-->
  424. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  425. <!-- header_eof //-->
  426.  
  427. <!-- body //-->
  428. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  429. <tr>
  430. <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  431. <!-- left_navigation //-->
  432. <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  433. <!-- left_navigation_eof //-->
  434. </table></td>
  435. <!-- body_text //-->
  436. <td width="100%" valign="top">
  437. <?php
  438. if ($action == 'new_product') {
  439. $parameters = array('products_name' => '',
  440. 'products_description' => '',
  441. 'products_url' => '',
  442. 'products_id' => '',
  443. 'products_quantity' => '',
  444. 'products_model' => '',
  445. 'products_image' => '',
  446. //060417/zepitt/multi images extra #05
  447. 'products_image1' => '',
  448. 'products_image2' => '',
  449. 'products_image3' => '',
  450. 'products_image4' => '',
  451. 'products_image5' => '',
  452. 'products_image6' => '',
  453. 'products_image7' => '',
  454. 'products_image8' => '',
  455. 'products_image9' => '',
  456. //060417/zepitt/multi images extra EOF
  457. 'products_price' => '',
  458. 'products_weight' => '',
  459. 'products_date_added' => '',
  460. 'products_last_modified' => '',
  461. 'products_date_available' => '',
  462. 'products_status' => '',
  463. 'products_tax_class_id' => '',
  464. 'manufacturers_id' => '');
  465.  
  466. $pInfo = new objectInfo($parameters);
  467.  
  468.  
  469. //060417/zepitt/multi images extra #06
  470. if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
  471. $product_query = tep_db_query("SELECT pd.products_name, pd.products_description,
  472. pd.products_url, p.products_id, p.products_quantity, p.products_model,
  473. p.products_image, p.products_price, p.products_weight, p.products_date_added,
  474. p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as
  475. products_date_available, p.products_status, p.products_tax_class_id,
  476. p.manufacturers_id,
  477. pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image3, pi.products_image4, pi.products_image5,
  478. pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9
  479. FROM (".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_PRODUCTS_IMAGES." pi ON p.products_id = pi.products_id)
  480. INNER JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd ON p.products_id = pd.products_id
  481. WHERE p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'
  482. AND pd.language_id = '".(int)$languages_id."'");
  483. $product = tep_db_fetch_array($product_query);
  484. //060417/zepitt/multi images extra EOF
  485.  
  486. $pInfo->objectInfo($product);
  487. } elseif (tep_not_null($HTTP_POST_VARS)) {
  488. $pInfo->objectInfo($HTTP_POST_VARS);
  489. $products_name = $HTTP_POST_VARS['products_name'];
  490. $products_description = $HTTP_POST_VARS['products_description'];
  491. $products_url = $HTTP_POST_VARS['products_url'];
  492. }
  493.  
  494. $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
  495. $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
  496. while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
  497. $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
  498. 'text' => $manufacturers['manufacturers_name']);
  499. }
  500.  
  501. $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
  502. $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");
  503. while ($tax_class = tep_db_fetch_array($tax_class_query)) {
  504. $tax_class_array[] = array('id' => $tax_class['tax_class_id'],
  505. 'text' => $tax_class['tax_class_title']);
  506. }
  507.  
  508. $languages = tep_get_languages();
  509.  
  510. if (!isset($pInfo->products_status)) $pInfo->products_status = '1';
  511. switch ($pInfo->products_status) {
  512. case '0': $in_status = false; $out_status = true; break;
  513. case '1':
  514. default: $in_status = true; $out_status = false;
  515. }
  516. ?>
  517. <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
  518. <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
  519. <script language="javascript"><!--
  520. var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);
  521. //--></script>
  522. <script language="javascript"><!--
  523. var tax_rates = new Array();
  524. <?php
  525. for ($i=0, $n=sizeof($tax_class_array); $i<$n; $i++) {
  526. if ($tax_class_array[$i]['id'] > 0) {
  527. echo 'tax_rates["' . $tax_class_array[$i]['id'] . '"] = ' . tep_get_tax_rate_value($tax_class_array[$i]['id']) . ';' . "\n";
  528. }
  529. }
  530. ?>
  531.  
  532. function doRound(x, places) {
  533. return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
  534. }
  535.  
  536. function getTaxRate() {
  537. var selected_value = document.forms["new_product"].products_tax_class_id.selectedIndex;
  538. var parameterVal = document.forms["new_product"].products_tax_class_id[selected_value].value;
  539.  
  540. if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) {
  541. return tax_rates[parameterVal];
  542. } else {
  543. return 0;
  544. }
  545. }
  546.  
  547. function updateGross() {
  548. var taxRate = getTaxRate();
  549. var grossValue = document.forms["new_product"].products_price.value;
  550.  
  551. if (taxRate > 0) {
  552. grossValue = grossValue * ((taxRate / 100) + 1);
  553. }
  554.  
  555. document.forms["new_product"].products_price_gross.value = doRound(grossValue, 4);
  556. }
  557.  
  558. function updateNet() {
  559. var taxRate = getTaxRate();
  560. var netValue = document.forms["new_product"].products_price_gross.value;
  561.  
  562. if (taxRate > 0) {
  563. netValue = netValue / ((taxRate / 100) + 1);
  564. }
  565.  
  566. document.forms["new_product"].products_price.value = doRound(netValue, 4);
  567. }
  568. //--></script>
  569. <?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?>
  570. <table border="0" width="100%" cellspacing="0" cellpadding="2">
  571. <tr>
  572. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  573. <tr>
  574. <td class="pageHeading"><?php echo sprintf(TEXT_NEW_PRODUCT, tep_output_generated_category_path($current_category_id)); ?></td>
  575. <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  576. </tr>
  577. </table></td>
  578. </tr>
  579. <tr>
  580. <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  581. </tr>
  582. <tr>
  583. <td><table border="0" cellspacing="0" cellpadding="2">
  584. <tr>
  585. <td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td>
  586. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_radio_field('products_status', '1', $in_status) . '&nbsp;' . TEXT_PRODUCT_AVAILABLE . '&nbsp;' . tep_draw_radio_field('products_status', '0', $out_status) . '&nbsp;' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td>
  587. </tr>
  588. <tr>
  589. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  590. </tr>
  591. <tr>
  592. <td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>
  593. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;'; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>
  594. </tr>
  595. <tr>
  596. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  597. </tr>
  598. <tr>
  599. <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>
  600. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td>
  601. </tr>
  602. <tr>
  603. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  604. </tr>
  605. <?php
  606. for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  607. ?>
  608. <tr>
  609. <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>
  610. <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>
  611. </tr>
  612. <?php
  613. }
  614. ?>
  615. <tr>
  616. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  617. </tr>
  618. <tr bgcolor="#ebebff">
  619. <td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>
  620. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td>
  621. </tr>
  622. <tr bgcolor="#ebebff">
  623. <td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>
  624. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>
  625. </tr>
  626. <tr bgcolor="#ebebff">
  627. <td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>
  628. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>
  629. </tr>
  630. <tr>
  631. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  632. </tr>
  633. <script language="javascript"><!--
  634. updateGross();
  635. //--></script>
  636. <?php
  637. for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  638. ?>
  639. <tr>
  640. <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>
  641. <td><table border="0" cellspacing="0" cellpadding="0">
  642. <tr>
  643. <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?>&nbsp;</td>
  644. <td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
  645. </tr>
  646. </table></td>
  647. </tr>
  648. <?php
  649. }
  650. ?>
  651. <tr>
  652. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  653. </tr>
  654. <tr>
  655. <td class="main"><?php echo TEXT_PRODUCTS_QUANTITY; ?></td>
  656. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td>
  657. </tr>
  658. <tr>
  659. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  660. </tr>
  661. <tr>
  662. <td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td>
  663. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_model', $pInfo->products_model); ?></td>
  664. </tr>
  665. <tr>
  666. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  667. </tr>
  668. <tr>
  669. <td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>
  670. <?php
  671. //060417/zepitt/multi images extra #07
  672. // input form
  673. ?>
  674. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;'.
  675. tep_draw_file_field('products_image').
  676. tep_draw_separator('pixel_trans.gif', '24', '15').'&nbsp;'.
  677. $pInfo->products_image.tep_draw_hidden_field('products_previous_image', $pInfo->products_image);?>
  678. </td>
  679. </tr>
  680. <tr>
  681. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  682. </tr>
  683.  
  684. <?php
  685. for($nb=1; $nb <= NB_IMAGE_EXTRA ; $nb++) {
  686. $var_products_image = "products_image".$nb;
  687. $var_products_previous_image = "products_previous_image".$nb;
  688. $var_delete_image = "delete_image".$nb;
  689. ?>
  690. <tr>
  691. <td class="main"><?php echo TEXT_PRODUCTS_IMAGE_EXTRA.$nb; ?></td>
  692. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15').'&nbsp;'.
  693. tep_draw_file_field($var_products_image).
  694. tep_draw_separator('pixel_trans.gif', '24', '15').'&nbsp;'.
  695. $pInfo->$var_products_image.tep_draw_hidden_field($var_products_previous_image, $pInfo->$var_products_image);?>
  696. <?php if($pInfo->$var_products_image) echo tep_draw_separator('pixel_trans.gif', '24', '15').tep_draw_checkbox_field($var_delete_image, 'yes', false).TEXT_DELETE_IMAGE;?>
  697. </td>
  698. </tr>
  699. <tr>
  700. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  701. </tr>
  702. <?php
  703. }
  704. //060417/zepitt/multi images extra EOF
  705. ?>
  706.  
  707.  
  708. <?php
  709. for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  710. ?>
  711. <tr>
  712. <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>
  713. <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>
  714. </tr>
  715. <?php
  716. }
  717. ?>
  718. <tr>
  719. <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  720. </tr>
  721. <tr>
  722. <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>
  723. <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>
  724. </tr>
  725. </table></td>
  726. </tr>
  727. <tr>
  728. <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  729. </tr>
  730. <tr>
  731. <td class="main" align="right"><?php echo tep_draw_hidden_field('products_date_added', (tep_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
  732. </tr>
  733. </table></form>
  734. <?php
  735. } elseif ($action == 'new_product_preview') {
  736. if (tep_not_null($HTTP_POST_VARS)) {
  737. $pInfo = new objectInfo($HTTP_POST_VARS);
  738. $products_name = $HTTP_POST_VARS['products_name'];
  739. $products_description = $HTTP_POST_VARS['products_description'];
  740. $products_url = $HTTP_POST_VARS['products_url'];
  741. } else {
  742.  
  743. //060417/zepitt/multi images extra #08
  744. $product_query = tep_db_query("SELECT p.products_id, pd.language_id,
  745. pd.products_name, pd.products_description, pd.products_url, p.products_quantity,
  746. p.products_model, p.products_image,
  747. pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image4, pi.products_image5,
  748. pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9,
  749. p.products_price, p.products_weight,
  750. p.products_date_added, p.products_last_modified, p.products_date_available,
  751. p.products_status, p.manufacturers_id
  752. FROM (".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_PRODUCTS_IMAGES." pi ON p.products_id = pi.products_id)
  753. INNER JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd ON p.products_id = pd.products_id
  754. WHERE p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");
  755.  
  756. $product = tep_db_fetch_array($product_query);
  757. $pInfo = new objectInfo($product);
  758. $products_image_name = $pInfo->products_image;
  759. $products_image1_name = $pInfo->products_image1;
  760. $products_image2_name = $pInfo->products_image2;
  761. $products_image3_name = $pInfo->products_image3;
  762. $products_image4_name = $pInfo->products_image4;
  763. $products_image5_name = $pInfo->products_image5;
  764. $products_image6_name = $pInfo->products_image6;
  765. $products_image7_name = $pInfo->products_image7;
  766. $products_image8_name = $pInfo->products_image8;
  767. $products_image9_name = $pInfo->products_image9;
  768. //060417/zepitt/multi images extra EOF
  769. }
  770. $form_action = (isset($HTTP_GET_VARS['pID'])) ? 'update_product' : 'insert_product';
  771.  
  772. echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');
  773.  
  774. $languages = tep_get_languages();
  775. for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  776. if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
  777. $pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
  778. $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
  779. $pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);
  780. } else {
  781. $pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]);
  782. $pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]);
  783. $pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);
  784. }
  785. ?>
  786. <table border="0" width="100%" cellspacing="0" cellpadding="2">
  787. <tr>
  788. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  789. <tr>
  790. <td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . $pInfo->products_name; ?></td>
  791. <td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price); ?></td>
  792. </tr>
  793. </table></td>
  794. </tr>
  795. <tr>
  796. <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  797. </tr>
  798. <tr>
  799. <td class="main">
  800. <?php
  801. //060417/zepitt/multi images extra #09
  802. // preview
  803. ?>
  804.  
  805. <table border="0" cellspacing="0" cellpadding="2" align="right">
  806. <?php
  807. echo "<tr><td class='smallText'>".tep_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . "</td></tr>";
  808.  
  809. for($nb=1; $nb <= NB_IMAGE_EXTRA ; $nb++) {
  810. $var_products_image_name = "products_image".$nb."_name";
  811.  
  812. if ($$var_products_image_name) echo "<tr><td class='smallText'>".tep_image(DIR_WS_CATALOG_IMAGES_EXTRA . $$var_products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') ."</td></tr>";
  813. }
  814. ?>
  815. </table>
  816.  
  817. <table border="0" cellspacing="0" cellpadding="2" align="right">
  818. <tr><td>
  819. <?=$pInfo->products_description;?>
  820. </td></tr></table>
  821. </td>
  822. </tr>
  823. <?php
  824. //060417/zepitt/multi images extra EOF
  825.  
  826. if ($pInfo->products_url) {
  827. ?>
  828. <tr>
  829. <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  830. </tr>
  831. <tr>
  832. <td class="main"><?php echo sprintf(TEXT_PRODUCT_MORE_INFORMATION, $pInfo->products_url); ?></td>
  833. </tr>
  834. <?php
  835. }
  836. ?>
  837. <tr>
  838. <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  839. </tr>
  840. <?php
  841. if ($pInfo->products_date_available > date('Y-m-d')) {
  842. ?>
  843. <tr>
  844. <td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_AVAILABLE, tep_date_long($pInfo->products_date_available)); ?></td>
  845. </tr>
  846. <?php
  847. } else {
  848. ?>
  849. <tr>
  850. <td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_ADDED, tep_date_long($pInfo->products_date_added)); ?></td>
  851. </tr>
  852. <?php
  853. }
  854. ?>
  855. <tr>
  856. <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  857. </tr>
  858. <?php
  859. }
  860.  
  861. if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
  862. if (isset($HTTP_GET_VARS['origin'])) {
  863. $pos_params = strpos($HTTP_GET_VARS['origin'], '?', 0);
  864. if ($pos_params != false) {
  865. $back_url = substr($HTTP_GET_VARS['origin'], 0, $pos_params);
  866. $back_url_params = substr($HTTP_GET_VARS['origin'], $pos_params + 1);
  867. } else {
  868. $back_url = $HTTP_GET_VARS['origin'];
  869. $back_url_params = '';
  870. }
  871. } else {
  872. $back_url = FILENAME_CATEGORIES;
  873. $back_url_params = 'cPath=' . $cPath . '&pID=' . $pInfo->products_id;
  874. }
  875. ?>
  876. <tr>
  877. <td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  878. </tr>
  879. <?php
  880. } else {
  881. ?>
  882. <tr>
  883. <td align="right" class="smallText">
  884. <?php
  885. /* Re-Post all POST'ed variables */
  886. reset($HTTP_POST_VARS);
  887. while (list($key, $value) = each($HTTP_POST_VARS)) {
  888. if (!is_array($HTTP_POST_VARS[$key])) {
  889. echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
  890. }
  891. }
  892. $languages = tep_get_languages();
  893. for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  894. echo tep_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']])));
  895. echo tep_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]['id']])));
  896. echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));
  897. }
  898. echo tep_draw_hidden_field('products_image', stripslashes($products_image_name));
  899.  
  900. //060417/zepitt/multi images extra #10
  901. echo tep_draw_hidden_field('products_image1', stripslashes($products_image1_name));
  902. echo tep_draw_hidden_field('products_image2', stripslashes($products_image2_name));
  903. echo tep_draw_hidden_field('products_image3', stripslashes($products_image3_name));
  904. echo tep_draw_hidden_field('products_image4', stripslashes($products_image4_name));
  905. echo tep_draw_hidden_field('products_image5', stripslashes($products_image5_name));
  906. echo tep_draw_hidden_field('products_image6', stripslashes($products_image6_name));
  907. echo tep_draw_hidden_field('products_image7', stripslashes($products_image7_name));
  908. echo tep_draw_hidden_field('products_image8', stripslashes($products_image8_name));
  909. echo tep_draw_hidden_field('products_image9', stripslashes($products_image9_name));
  910. //060417/zepitt/multi images extra EOF
  911.  
  912.  
  913. echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '&nbsp;&nbsp;';
  914.  
  915. if (isset($HTTP_GET_VARS['pID'])) {
  916. echo tep_image_submit('button_update.gif', IMAGE_UPDATE);
  917. } else {
  918. echo tep_image_submit('button_insert.gif', IMAGE_INSERT);
  919. }
  920. echo '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
  921. ?></td>
  922. </tr>
  923. </table></form>
  924. <?php
  925. }
  926. } else {
  927. ?>
  928. <table border="0" width="100%" cellspacing="0" cellpadding="2">
  929. <tr>
  930. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  931. <tr>
  932. <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  933. <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  934. <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  935. <tr>
  936. <td class="smallText" align="right">
  937. <?php
  938. echo tep_draw_form('search', FILENAME_CATEGORIES, '', 'get');
  939. echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search');
  940. echo '</form>';
  941. ?>
  942. </td>
  943. </tr>
  944. <tr>
  945. <td class="smallText" align="right">
  946. <?php
  947. echo tep_draw_form('goto', FILENAME_CATEGORIES, '', 'get');
  948. echo HEADING_TITLE_GOTO . ' ' . tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');
  949. echo '</form>';
  950. ?>
  951. </td>
  952. </tr>
  953. </table></td>
  954. </tr>
  955. </table></td>
  956. </tr>
  957. <tr>
  958. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  959. <tr>
  960. <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  961. <tr class="dataTableHeadingRow">
  962. <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>
  963. <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
  964. <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  965. </tr>
  966. <?php
  967. $categories_count = 0;
  968. $rows = 0;
  969. if (isset($HTTP_GET_VARS['search'])) {
  970. $search = tep_db_prepare_input($HTTP_GET_VARS['search']);
  971.  
  972. $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
  973. } else {
  974. $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
  975. }
  976. while ($categories = tep_db_fetch_array($categories_query)) {
  977. $categories_count++;
  978. $rows++;
  979.  
  980. // Get parent_id for subcategories if search
  981. if (isset($HTTP_GET_VARS['search'])) $cPath= $categories['parent_id'];
  982.  
  983. if ((!isset($HTTP_GET_VARS['cID']) && !isset($HTTP_GET_VARS['pID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $categories['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
  984. $category_childs = array('childs_count' => tep_childs_in_category_count($categories['categories_id']));
  985. $category_products = array('products_count' => tep_products_in_category_count($categories['categories_id']));
  986.  
  987. $cInfo_array = array_merge($categories, $category_childs, $category_products);
  988. $cInfo = new objectInfo($cInfo_array);
  989. }
  990.  
  991. if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) {
  992. echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '\'">' . "\n";
  993. } else {
  994. echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '\'">' . "\n";
  995. }
  996. ?>
  997. <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a>&nbsp;<b>' . $categories['categories_name'] . '</b>'; ?></td>
  998. <td class="dataTableContent" align="center">&nbsp;</td>
  999. <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  1000. </tr>
  1001.  
  1002. <?php
  1003. //060417/zepitt/multi images extra/modif #11
  1004. }
  1005. $products_count = 0;
  1006. if (isset($HTTP_GET_VARS['search'])) {
  1007. //find an item with search function
  1008. $products_query = tep_db_query("SELECT
  1009. p.products_id, pd.products_name, p.products_quantity, p.products_image,
  1010. pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image4, pi.products_image5,
  1011. pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9,
  1012. p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status,
  1013. p2c.categories_id
  1014. FROM (".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_PRODUCTS_IMAGES." pi ON p.products_id = pi.products_id)
  1015. INNER JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd ON p.products_id = pd.products_id
  1016. INNER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." p2c ON p.products_id = p2c.products_id
  1017. WHERE pd.language_id = '" . (int)$languages_id . "'
  1018. AND pd.products_name like '%" . tep_db_input($search) . "%'
  1019. ORDER BY pd.products_name");
  1020. } else {
  1021. //find an item with tree structure
  1022. $products_query = tep_db_query("SELECT
  1023. p.products_id, pd.products_name, p.products_quantity, p.products_image,
  1024. pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image4, pi.products_image5,
  1025. pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9,
  1026. p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status
  1027. FROM (".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_PRODUCTS_IMAGES." pi ON p.products_id = pi.products_id)
  1028. INNER JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd ON p.products_id = pd.products_id
  1029. INNER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." p2c ON p.products_id = p2c.products_id
  1030. WHERE pd.language_id = '" . (int)$languages_id . "'
  1031. AND p2c.categories_id = '" . (int)$current_category_id . "'
  1032. ORDER BY pd.products_name");
  1033. }
  1034. //060417/zepitt/multi images extra EOF
  1035. while ($products = tep_db_fetch_array($products_query)) {
  1036. $products_count++;
  1037. $rows++;
  1038.  
  1039. // Get categories_id for product if search
  1040. if (isset($HTTP_GET_VARS['search'])) $cPath = $products['categories_id'];
  1041.  
  1042. if ( (!isset($HTTP_GET_VARS['pID']) && !isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['pID']) && ($HTTP_GET_VARS['pID'] == $products['products_id']))) && !isset($pInfo) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
  1043. // find out the rating average from customer reviews
  1044. $reviews_query = tep_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int)$products['products_id'] . "'");
  1045. $reviews = tep_db_fetch_array($reviews_query);
  1046. $pInfo_array = array_merge($products, $reviews);
  1047. $pInfo = new objectInfo($pInfo_array);
  1048. }
  1049.  
  1050. if (isset($pInfo) && is_object($pInfo) && ($products['products_id'] == $pInfo->products_id) ) {
  1051. echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '\'">' . "\n";
  1052. } else {
  1053. echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '\'">' . "\n";
  1054. }
  1055. ?>
  1056. <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . $products['products_name']; ?></td>
  1057. <td class="dataTableContent" align="center">
  1058. <?php
  1059. if ($products['products_status'] == '1') {
  1060. echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  1061. } else {
  1062. echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  1063. }
  1064. ?></td>
  1065. <td class="dataTableContent" align="right"><?php if (isset($pInfo) && is_object($pInfo) && ($products['products_id'] == $pInfo->products_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  1066. </tr>
  1067. <?php
  1068. }
  1069.  
  1070. $cPath_back = '';
  1071. if (sizeof($cPath_array) > 0) {
  1072. for ($i=0, $n=sizeof($cPath_array)-1; $i<$n; $i++) {
  1073. if (empty($cPath_back)) {
  1074. $cPath_back .= $cPath_array[$i];
  1075. } else {
  1076. $cPath_back .= '_' . $cPath_array[$i];
  1077. }
  1078. }
  1079. }
  1080.  
  1081. $cPath_back = (tep_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : '';
  1082. ?>
  1083. <tr>
  1084. <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  1085. <tr>
  1086. <td class="smallText"><?php echo TEXT_CATEGORIES . '&nbsp;' . $categories_count . '<br>' . TEXT_PRODUCTS . '&nbsp;' . $products_count; ?></td>
  1087. <td align="right" class="smallText"><?php if (sizeof($cPath_array) > 0) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, $cPath_back . 'cID=' . $current_category_id) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>&nbsp;'; if (!isset($HTTP_GET_VARS['search'])) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_category') . '">' . tep_image_button('button_new_category.gif', IMAGE_NEW_CATEGORY) . '</a>&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_product') . '">' . tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?>&nbsp;</td>
  1088. </tr>
  1089. </table></td>
  1090. </tr>
  1091. </table></td>
  1092. <?php
  1093. $heading = array();
  1094. $contents = array();
  1095. switch ($action) {
  1096. case 'new_category':
  1097. $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_CATEGORY . '</b>');
  1098.  
  1099. $contents = array('form' => tep_draw_form('newcategory', FILENAME_CATEGORIES, 'action=insert_category&cPath=' . $cPath, 'post', 'enctype="multipart/form-data"'));
  1100. $contents[] = array('text' => TEXT_NEW_CATEGORY_INTRO);
  1101.  
  1102. $category_inputs_string = '';
  1103. $languages = tep_get_languages();
  1104. for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
  1105. $category_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('categories_name[' . $languages[$i]['id'] . ']');
  1106. }
  1107.  
  1108. $contents[] = array('text' => '<br>' . TEXT_CATEGORIES_NAME . $category_inputs_string);
  1109. $contents[] = array('text' => '<br>' . TEXT_CATEGORIES_IMAGE . '<br>' . tep_draw_file_field('categories_image'));
  1110. $contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));
  1111. $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  1112. break;
  1113. case 'edit_category':
  1114. $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_CATEGORY . '</b>');
  1115.  
  1116. $contents = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=update_category&cPath=' . $cPath, 'post', 'enctype="multipart/form-data"') . tep_draw_hidden_field('categories_id', $cInfo->categories_id));
  1117. $contents[] = array('text' => TEXT_EDIT_INTRO);
  1118.  
  1119. $category_inputs_string = '';
  1120. $languages = tep_get_languages();
  1121. for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
  1122. $category_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('categories_name[' . $languages[$i]['id'] . ']', tep_get_category_name($cInfo->categories_id, $languages[$i]['id']));
  1123. }
  1124.  
  1125. $contents[] = array('text' => '<br>' . TEXT_EDIT_CATEGORIES_NAME . $category_inputs_string);
  1126. $contents[] = array('text' => '<br>' . tep_image(DIR_WS_CATALOG_IMAGES . $cInfo->categories_image, $cInfo->categories_name) . '<br>' . DIR_WS_CATALOG_IMAGES . '<br><b>' . $cInfo->categories_image . '</b>');
  1127. $contents[] = array('text' => '<br>' . TEXT_EDIT_CATEGORIES_IMAGE . '<br>' . tep_draw_file_field('categories_image'));
  1128. $contents[] = array('text' => '<br>' . TEXT_EDIT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));
  1129. $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  1130. break;
  1131. case 'delete_category':
  1132. $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_CATEGORY . '</b>');
  1133.  
  1134. $contents = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=delete_category_confirm&cPath=' . $cPath) . tep_draw_hidden_field('categories_id', $cInfo->categories_id));
  1135. $contents[] = array('text' => TEXT_DELETE_CATEGORY_INTRO);
  1136. $contents[] = array('text' => '<br><b>' . $cInfo->categories_name . '</b>');
  1137. if ($cInfo->childs_count > 0) $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_CHILDS, $cInfo->childs_count));
  1138. if ($cInfo->products_count > 0) $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $cInfo->products_count));
  1139. $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  1140. break;
  1141. case 'move_category':
  1142. $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_CATEGORY . '</b>');
  1143.  
  1144. $contents = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=move_category_confirm&cPath=' . $cPath) . tep_draw_hidden_field('categories_id', $cInfo->categories_id));
  1145. $contents[] = array('text' => sprintf(TEXT_MOVE_CATEGORIES_INTRO, $cInfo->categories_name));
  1146. $contents[] = array('text' => '<br>' . sprintf(TEXT_MOVE, $cInfo->categories_name) . '<br>' . tep_draw_pull_down_menu('move_to_category_id', tep_get_category_tree(), $current_category_id));
  1147. $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_move.gif', IMAGE_MOVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  1148. break;
  1149. case 'delete_product':
  1150. $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_PRODUCT . '</b>');
  1151.  
  1152. $contents = array('form' => tep_draw_form('products', FILENAME_CATEGORIES, 'action=delete_product_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id));
  1153. $contents[] = array('text' => TEXT_DELETE_PRODUCT_INTRO);
  1154. $contents[] = array('text' => '<br><b>' . $pInfo->products_name . '</b>');
  1155.  
  1156. $product_categories_string = '';
  1157. $product_categories = tep_generate_category_path($pInfo->products_id, 'product');
  1158. for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) {
  1159. $category_path = '';
  1160. for ($j = 0, $k = sizeof($product_categories[$i]); $j < $k; $j++) {
  1161. $category_path .= $product_categories[$i][$j]['text'] . '&nbsp;&gt;&nbsp;';
  1162. }
  1163. $category_path = substr($category_path, 0, -16);
  1164. $product_categories_string .= tep_draw_checkbox_field('product_categories[]', $product_categories[$i][sizeof($product_categories[$i])-1]['id'], true) . '&nbsp;' . $category_path . '<br>';
  1165. }
  1166. $product_categories_string = substr($product_categories_string, 0, -4);
  1167.  
  1168. $contents[] = array('text' => '<br>' . $product_categories_string);
  1169. $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  1170. break;
  1171. case 'move_product':
  1172. $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_PRODUCT . '</b>');
  1173.  
  1174. $contents = array('form' => tep_draw_form('products', FILENAME_CATEGORIES, 'action=move_product_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id));
  1175. $contents[] = array('text' => sprintf(TEXT_MOVE_PRODUCTS_INTRO, $pInfo->products_name));
  1176. $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_CATEGORIES . '<br><b>' . tep_output_generated_category_path($pInfo->products_id, 'product') . '</b>');
  1177. $contents[] = array('text' => '<br>' . sprintf(TEXT_MOVE, $pInfo->products_name) . '<br>' . tep_draw_pull_down_menu('move_to_category_id', tep_get_category_tree(), $current_category_id));
  1178. $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_move.gif', IMAGE_MOVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  1179. break;
  1180. case 'copy_to':
  1181. $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_COPY_TO . '</b>');
  1182.  
  1183. $contents = array('form' => tep_draw_form('copy_to', FILENAME_CATEGORIES, 'action=copy_to_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id));
  1184. $contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO);
  1185. $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_CATEGORIES . '<br><b>' . tep_output_generated_category_path($pInfo->products_id, 'product') . '</b>');
  1186. $contents[] = array('text' => '<br>' . TEXT_CATEGORIES . '<br>' . tep_draw_pull_down_menu('categories_id', tep_get_category_tree(), $current_category_id));
  1187. $contents[] = array('text' => '<br>' . TEXT_HOW_TO_COPY . '<br>' . tep_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . '<br>' . tep_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE);
  1188. $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_copy.gif', IMAGE_COPY) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  1189. break;
  1190. default:
  1191. if ($rows > 0) {
  1192. if (isset($cInfo) && is_object($cInfo)) { // category info box contents
  1193. $heading[] = array('text' => '<b>' . $cInfo->categories_name . '</b>');
  1194.  
  1195. $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a>');
  1196. $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added));
  1197. if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified));
  1198. $contents[] = array('text' => '<br>' . tep_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br>' . $cInfo->categories_image);
  1199. $contents[] = array('text' => '<br>' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '<br>' . TEXT_PRODUCTS . ' ' . $cInfo->products_count);
  1200. } elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents
  1201. $heading[] = array('text' => '<b>' . tep_get_products_name($pInfo->products_id, $languages_id) . '</b>');
  1202.  
  1203. $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_product') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=move_product') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=copy_to') . '">' . tep_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a>');
  1204. $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($pInfo->products_date_added));
  1205. if (tep_not_null($pInfo->products_last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($pInfo->products_last_modified));
  1206. if (date('Y-m-d') < $pInfo->products_date_available) $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . tep_date_short($pInfo->products_date_available));
  1207. $contents[] = array('text' => '<br>' . tep_info_image($pInfo->products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->products_image);
  1208.  
  1209. //060417/zepitt/multi images extra modif # 12
  1210. for($nb=1; $nb <= NB_IMAGE_EXTRA ; $nb++) {
  1211. $products_image = "products_image".$nb;
  1212. $contents[] = array('text' => '<br>' . tep_info_image_extra($pInfo->$products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->$products_image);
  1213. }
  1214. //060417/zepitt/multi images extra EOF
  1215.  
  1216. $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity);
  1217. $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%');
  1218. }
  1219. } else { // create category/product info
  1220. $heading[] = array('text' => '<b>' . EMPTY_CATEGORY . '</b>');
  1221.  
  1222. $contents[] = array('text' => TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS);
  1223. }
  1224. break;
  1225. }
  1226.  
  1227. if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
  1228. echo ' <td width="25%" valign="top">' . "\n";
  1229.  
  1230. $box = new box;
  1231. echo $box->infoBox($heading, $contents);
  1232.  
  1233. echo ' </td>' . "\n";
  1234. }
  1235. ?>
  1236. </tr>
  1237. </table></td>
  1238. </tr>
  1239. </table>
  1240. <?php
  1241. }
  1242. ?>
  1243. </td>
  1244. <!-- body_text_eof //-->
  1245. </tr>
  1246. </table>
  1247.  
  1248. <!-- body_eof //-->
  1249.  
  1250. <!-- footer //-->
  1251. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  1252. <!-- footer_eof //-->
  1253. <br>
  1254. </body>
  1255. </html>
  1256. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Add Comment
Please, Sign In to add comment