Jump to content
Latest News: (loading..)
jaullo

Problem with function

Recommended Posts

Hi all, recently we installed document manager in our store, but we are getting an error on catalog.

 

Fatal error: Call to undefined function document_types() in public_html/includes/boxes/information.php on line 16

 

where is this function?

 

 

Thanks

Share this post


Link to post
Share on other sites

It's in catalog/includes/functions/general.php. It's one of four new functions that need to be added.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

It's in catalog/includes/functions/general.php. It's one of four new functions that need to be added.

 

Regards

Jim

 

Hi Jim,

 

I have error messages, could you please kindly tell me the steps how I can fix them, many thanks in advance.

 

Lyn

 

Fatal error: Call to undefined function document_types()

in /includes/modules/boxes/bm_links.php on line 45

Fatal error: Call to undefined function document_types()

in /includes/modules/boxes/bm_photo_gallery.php on line 40

Share this post


Link to post
Share on other sites

It's still the same answer.

 

Regards

Jim

hi Jim

// Start Documents Manager  
////
// Build an array of downloadable document types
//   Table: document_types
 function document_types () {
   $type_array = array ();
   $documents_query_raw = "
  select
    document_types_id,
    type_description
  from
    " . TABLE_DOCUMENT_TYPES . "
  where
    type_visible = 'True'
  order by
    sort_order
   ";
   $documents_query = tep_db_query ($documents_query_raw);
   while ($documents = tep_db_fetch_array ($documents_query) ) {
  $type_array[] = array ('id' => $documents['document_types_id'],
						 'text' => $documents['type_description']
					    );
   } // while ($documents
   return $type_array;
 } // function document_types
////
 function tep_build_columns_array (&$columns_array, $type, $heading) {
   $add_to_array = true;
   foreach ($columns_array as $column) {
  if ($column['type'] == $type) {
    $add_to_array = false;
    break;
  }
   }
   if ($add_to_array == true) {
  $columns_array[] = array ('type' => $type,
						    'heading' => $heading
						   );
   }
 } // function tep_build_columns_array
////
 function tep_get_column_number ($documents_heading, $documents_type) {
   $column_number = 1;
   if (is_array ($documents_heading) ) {
  foreach ($documents_heading as $heading_data) {
    if ($heading_data['type'] == $documents_type) {
	  break;
    } else {
	  $column_number++;
    }
  }
   }
   return $column_number;
 } //   function tep_get_column_number
////
// Get document type information from the extension
 function tep_get_document_type ($documents_extension) {
   $document_type = array();
   switch ($documents_extension) {  // Select the file type based on the document extension
  case 'odp': // Presentations
  case 'ppt':
  case 'photo':
  case 'cbr':
  case 'cbz':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_PRESENTATION;
    $document_type['type'] = 'presentation';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'photobook_small.png');
    break;
  case 'doc': // Text documents
  case 'docx':
  case 'odt':
  case 'txt':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_DOC;
    $document_type['type'] = 'doc';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'wordproc_small.png');
    break;
  case 'xls': // Spreadsheets
  case 'ods':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_SPREADSHEET;
    $document_type['type'] = 'spreadsheet';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'spreadsheet_small.png');
    break;
  case 'pdf': // Portable Document Format
  case 'eps':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_PDF;
    $document_type['type'] = 'pdf';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'pdf_small.png');
    break;
  case 'gif': // Image/Graphics formats
  case 'jpg':
  case 'png':
  case 'tif':
  case 'tiff':
  case 'exif':
  case 'raw':
  case 'bmp':
  case 'ppm':
  case 'pbm':
  case 'pnm':
  case 'cgm':
  case 'svg':
  case 'ecw':
  case 'cd5':
  case 'odg':
  case 'wmf':
  case 'emf':
  case 'xps':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_IMAGE;
    $document_type['type'] = 'image';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'movieicon_small.gif');
    break;
  case 'mov': // Video formats
  case 'wmv':
  case 'mp3':
  case 'mpg':
  case 'mpeg':
  case 'ogv':
  case 'swf':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_MOVIE;
    $document_type['type'] = 'movie';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'movieicon_small.png');
    break;
  case 'txt': // Text files
  case 'rtf':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_TEXT;
    $document_type['type'] = 'text';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'text_small.png');
    break;
  case 'iso': // CD or DVD images
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_CD;
    $document_type['type'] = 'cd_image';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'cdimage_small.png');
    break;
  case 'odb': // Database
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_DATABASE;
    $document_type['type'] = 'database';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'spreadsheet_small.png');
    break;
  case 'html': // Web page
  case 'xml':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_HTML;
    $document_type['type'] = 'html';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'html_small.png');
    break;
  case 'zip': // Archives
  case 'gz':
  case 'tgz':
  case 'tar.gz':
  case 'tar.gzip':
  case '7z':
  case 'rar':
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_ARCHIVE;
    $document_type['type'] = 'archive';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'tgz_small.png');
    break;
  case 'misc': // Everything else
  case '':
  default:
    $document_type['title'] = HEADING_DOCUMENT_FILENAME_MISC;
    $document_type['type'] = 'misc';
    $document_type['icon'] = tep_image (DIR_WS_ICONS . 'misc_small.png');
    break;
   } //switch ($documents_extension
   return $document_type;
 }
// End Documents Manager 

this is the file in catalog/includes/functions/general.php

related to Document Manager

sorry if I could not understand your previous answer, could you please explain more details? Many thanks in advance.

Lyn

Share this post


Link to post
Share on other sites

The first function in that code is what the error message says is missing. Is it?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×