Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Manufacturers Email v6 contribution problem


nyderrn

Recommended Posts

I recently installed maunfacturers_email_v6 contribution and now when I edit a manufacturer and try to save I get this message:

 

  • Fatal error: Cannot instantiate non-existent class: upload in c:apachehtdocscatalogadminmanufacturers.php on line 36

 

Here's the code it talks about:

 

if ($manufacturers_image = new upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {

       tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image->filename . "' where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");

 

Here's the section of code surrounding it:

 

switch ($HTTP_GET_VARS['action']) {

   case 'insert':

   case 'save':

     $manufacturers_id = tep_db_prepare_input($HTTP_GET_VARS['mID']);

     $manufacturers_name = tep_db_prepare_input($HTTP_POST_VARS['manufacturers_name']);

     $manufacturers_email = tep_db_prepare_input($HTTP_POST_VARS['manufacturers_email']); 

     $manufacturers_send_email = tep_db_prepare_input($HTTP_POST_VARS['manufacturers_send_email']);



     $sql_data_array = array('manufacturers_name' => $manufacturers_name, 'manufacturers_email' => $manufacturers_email, 'manufacturers_send_email' => $manufacturers_send_email);



     if ($HTTP_GET_VARS['action'] == 'insert') {

       $insert_sql_data = array('date_added' => 'now()');

       $sql_data_array = tep_array_merge($sql_data_array, $insert_sql_data);

       tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array);

       $manufacturers_id = tep_db_insert_id();

     } elseif ($HTTP_GET_VARS['action'] == 'save') {

       $update_sql_data = array('last_modified' => 'now()');

       $sql_data_array = tep_array_merge($sql_data_array, $update_sql_data);

       tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");

     }



     if ($manufacturers_image = new upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {

       tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image->filename . "' where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");

     }



     $languages = tep_get_languages();

     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

       $manufacturers_url_array = $HTTP_POST_VARS['manufacturers_url'];

       $language_id = $languages[$i]['id'];



       $sql_data_array = array('manufacturers_url' => tep_db_prepare_input($manufacturers_url_array[$language_id]));



       if ($HTTP_GET_VARS['action'] == 'insert') {

         $insert_sql_data = array('manufacturers_id' => $manufacturers_id,

                                  'languages_id' => $language_id);

         $sql_data_array = tep_array_merge($sql_data_array, $insert_sql_data);

         tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array);

       } elseif ($HTTP_GET_VARS['action'] == 'save') {

         tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . tep_db_input($manufacturers_id) . "' and languages_id = '" . $language_id . "'");

       }

     }



     if (USE_CACHE == 'true') {

       tep_reset_cache_block('manufacturers');

     }



     tep_redirect(tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $manufacturers_id));

     break;

   case 'deleteconfirm':

     $manufacturers_id = tep_db_prepare_input($HTTP_GET_VARS['mID']);



     if ($HTTP_POST_VARS['delete_image'] == 'on') {

       $manufacturer_query = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");

       $manufacturer = tep_db_fetch_array($manufacturer_query);

       $image_location = DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG_IMAGES . $manufacturer['manufacturers_image'];

       if (file_exists($image_location)) @unlink($image_location);

     }



     tep_db_query("delete from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");

     tep_db_query("delete from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");



     if ($HTTP_POST_VARS['delete_products'] == 'on') {

       $products_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");

       while ($products = tep_db_fetch_array($products_query)) {

         tep_remove_product($products['products_id']);

       }

     } else {

       tep_db_query("update " . TABLE_PRODUCTS . " set manufacturers_id = '' where manufacturers_id = '" . tep_db_input($manufacturers_id) . "'");

     }



     if (USE_CACHE == 'true') {

       tep_reset_cache_block('manufacturers');

     }



     tep_redirect(tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page']));

     break;

 }

?>

 

Thanks for any help.

Link to comment
Share on other sites

I have a file called upload.php in admin/includes/classes directory and in my application_top.php this is defined as :

// file uploading class

 require(DIR_WS_CLASSES . 'upload.php');

 

on what version did you install this?

With kind regards ,

Fred Stuurman

Link to comment
Share on other sites

Ok downloaded the snapshot, got the upload.php and copied it over. Changed application_top.php to include the code you provided and now it works perfectly.

 

The majority of code is from 2.2 MS1 so either so it might have just got deleted accidentally.

 

Ok thats fixed but now I don't think that the manufacturer is getting an email. I had to cut and paste the orders.php a little cause I also have ordercheck that affects that same file and I didn't want to mess that up. Just have to find a way to incorporate both contributions.

 

 

Thanks for your help ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...