<?php
/*

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce
  
  osCommRes, Services Online
  http://www.oscommres.com

  Copyright (c) 2005 osCommRes

  Released under the GNU General Public License
  
  Freeway eCommerce from ZacWare
http://www.zac-ware.com/freeway

Copyright 2007 ZacWare Pty. Ltd
*/		
 // Check to ensure this file is included in Freeway!
defined('_FEXEC') or die(); 

 if(HIDE_FROM_BACKEND_MENU_PRODUCTS=='false'){
?>
<!-- catalog //-->
          <tr>
            <td>
<?php 
	$files_list=array(BOX_CATALOG_CATEGORIES_PRODUCTS,FILENAME_CATEGORIES,
					'Add Product',FILENAME_CATEGORIES,
					BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES,FILENAME_PRODUCTS_ATTRIBUTES,
					BOX_CATALOG_MANUFACTURERS,FILENAME_MANUFACTURERS,
					BOX_CATALOG_REVIEWS,FILENAME_REVIEWS,
					BOX_CATALOG_SPECIALS,FILENAME_SPECIALS,
					BOX_CATALOG_EASYPOPULATE,FILENAME_EASYPOPULATE,
					BOX_CATALOG_SALEMAKER,FILENAME_SALEMAKER,
					BOX_CATALOG_FEATURED,FILENAME_FEATURED,
					BOX_CATALOG_PRODUCTS_EXPECTED,FILENAME_PRODUCTS_EXPECTED,
					BOX_CATALOG_PRODUCTS_OPTIONS,FILENAME_PRODUCTS_OPTIONS,
					BOX_CATALOG_PRODUCTS_MESSAGE,FILENAME_PRODUCTS_MESSAGE,
					BOX_CATALOG_PACKING_SLIP,FILENAME_EMAIL_MESSAGES);
  $heading = array();
  $contents = array();
  $packing_slip_sql = "SELECT * from " . TABLE_EMAIL_MESSAGES . " where message_type='PSP'";
  $packing_slip_query  = tep_db_query($packing_slip_sql);
  $packing_slip_result = tep_db_fetch_array($packing_slip_query);
  $file_packing_slip = "action=new_message&type=PSP&list_add=P";
  if($packing_slip_result['message_id']!='')$file_packing_slip = "action=new_message&id=" . $packing_slip_result['message_id'] . "&list_add=P_B_D";

  $heading[] = array('text'  => BOX_HEADING_PRODUCT,
                     'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

	$links_list='';
	reset($files_list);
	for($fcnt=0,$fn=count($files_list);$fcnt<$fn-1;$fcnt=$fcnt+2){
		if ($selected_box == 'catalog' || $menu_dhtml == true) {
			if($files_list[$fcnt]=='Add Product'){
				$links_list.='<a href="' . tep_href_link($files_list[$fcnt+1],'action=new_product','NONSSL') . '" class="menuBoxContentLink">' . $files_list[$fcnt] . '</a><br>';
			}else if($files_list[$fcnt+1]==FILENAME_EMAIL_MESSAGES){
				$links_list.='<a href="' . tep_href_link($files_list[$fcnt+1],$file_packing_slip) . '" class="menuBoxContentLink">' . $files_list[$fcnt] . '</a><br>';
			}else{
				$links_list.=tep_admin_files_boxes($files_list[$fcnt+1],$files_list[$fcnt]);
			}
		}
		if (isset($HTTP_POST_VARS["search_link"]) && $HTTP_POST_VARS["search_link"]!='' && strpos(strtolower($files_list[$fcnt]),strtolower($HTTP_POST_VARS["search_link"]))!==false){
			if($files_list[$fcnt]=='Add Product'){
				$search_links_list[]=array('text'=>$files_list[$fcnt],'link'=>$files_list[$fcnt+1] . '?selected_box=catalog&action=new_product');
			}else if($files_list[$fcnt+1]==FILENAME_EMAIL_MESSAGES){
				$search_links_list[]=array('text'=>$files_list[$fcnt],'link'=>$files_list[$fcnt+1] . '?selected_box=catalog&' . $file_packing_slip);
			}else{
				$search_links_list[]=array('text'=>$files_list[$fcnt],'link'=>$files_list[$fcnt+1] . '?selected_box=catalog');
			}
		}
	}
	if ($links_list!=''){
		$contents[] = array('text'  => $links_list);
	}

  $box = new box;
  echo $box->menuBox($heading, $contents);
  unset($files_list);
?>
            </td>
          </tr>
<?php }?>
<!-- catalog_eof //-->