Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with "Manufacturers Contribution"


Guest

Recommended Posts

Posted

Hi.

Does anyone added "2nd Manufacturers" using "Manufacturers Contribution" doc.?

 

I have gotten an error msg when i wanted to edit the new manufucturers in admin after editing all the thing currently written in this doc.

 

     "Fatal error: Call to undefined function: tep_get_manufacturer2_url()"

*"manufacturer2" is the new-created 2nd manufacturers.php

 

 

I guessed this error means something's wrong with "mInfo" in the

manufacturer2:

 

$manufacturer2_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers2_url[' . $languages[$i]['id'] . ']', tep_get_manufacturer2_url($mInfo->manufacturers2_id, $languages[$i]['id']));
     }

 

I think this "mInfo" was the short-cut of "manufacuturer_info" in the manufacturers.php,(there were also "mID")

 

...So this case, i also have to create those short-cut of new "manufacturers2"

Ver., all over in the "manufacturers2" AND "modules.php"!!

 

i just understood in my head so :P , but i am a newbee and i don't know how to write in a php...

 

I am pleased if there is someone who had the same problem but already solved,

or just could help me out...

 

Thanks.

 

Izumi

 

*manufacturers2.php

  require('includes/application_top.php');

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'insert':
     case 'save':
       if (isset($HTTP_GET_VARS['mID'])) $manufacturers2_id = tep_db_prepare_input($HTTP_GET_VARS['mID']);
       $manufacturers2_name = tep_db_prepare_input($HTTP_POST_VARS['manufacturers2_name']);

       $sql_data_array = array('manufacturers2_name' => $manufacturers2_name);

       if ($action == 'insert') {
         $insert_sql_data = array('date_added' => 'now()');

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

         tep_db_perform(TABLE_MANUFACTURERS2, $sql_data_array);
         $manufacturers2_id = tep_db_insert_id();
       } elseif ($action == 'save') {
         $update_sql_data = array('last_modified' => 'now()');

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

         tep_db_perform(TABLE_MANUFACTURERS2, $sql_data_array, 'update', "manufacturers2_id = '" . (int)$manufacturers2_id . "'");
       }

       if ($manufacturers2_image = new upload('manufacturers2_image', DIR_FS_CATALOG_IMAGES)) {
         tep_db_query("update " . TABLE_MANUFACTURERS2 . " set manufacturers2_image = '" . $manufacturers2_image->filename . "' where manufacturers2_id = '" . (int)$manufacturers2_id . "'");
       }

       $languages = tep_get_languages();
       for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
         $manufacturers2_url_array = $HTTP_POST_VARS['manufacturers2_url'];
         $language_id = $languages[$i]['id'];

         $sql_data_array = array('manufacturers2_url' => tep_db_prepare_input($manufacturers2_url_array[$language_id]));

         if ($action == 'insert') {
           $insert_sql_data = array('manufacturers2_id' => $manufacturers2_id,
                                    'languages_id' => $language_id);

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

           tep_db_perform(TABLE_MANUFACTURERS2_INFO, $sql_data_array);
         } elseif ($action == 'save') {
           tep_db_perform(TABLE_MANUFACTURERS2_INFO, $sql_data_array, 'update', "manufacturers2_id = '" . (int)$manufacturers2_id . "' and languages_id = '" . (int)$language_id . "'");
         }
       }

       if (USE_CACHE == 'true') {
         tep_reset_cache_block('manufacturers2');
       }

       tep_redirect(tep_href_link(FILENAME_MANUFACTURERS2, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'mID=' . $manufacturers2_id));
       break;
     case 'deleteconfirm':
       $manufacturers2_id = tep_db_prepare_input($HTTP_GET_VARS['mID']);

       if (isset($HTTP_POST_VARS['delete_image']) && ($HTTP_POST_VARS['delete_image'] == 'on')) {
         $manufacturer2_query = tep_db_query("select manufacturers2_image from " . TABLE_MANUFACTURERS2 . " where manufacturers2_id = '" . (int)$manufacturers2_id . "'");
         $manufacturer2 = tep_db_fetch_array($manufacturer2_query);

         $image_location = DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG_IMAGES . $manufacturer2['manufacturers2_image'];

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

       tep_db_query("delete from " . TABLE_MANUFACTURERS2 . " where manufacturers2_id = '" . (int)$manufacturers2_id . "'");
       tep_db_query("delete from " . TABLE_MANUFACTURERS2_INFO . " where manufacturers2_id = '" . (int)$manufacturers2_id . "'");

       if (isset($HTTP_POST_VARS['delete_products']) && ($HTTP_POST_VARS['delete_products'] == 'on')) {
         $products_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where manufacturers2_id = '" . (int)$manufacturers2_id . "'");
         while ($products = tep_db_fetch_array($products_query)) {
           tep_remove_product($products['products_id']);
         }
       } else {
         tep_db_query("update " . TABLE_PRODUCTS . " set manufacturers2_id = '' where manufacturers2_id = '" . (int)$manufacturers2_id . "'");
       }

       if (USE_CACHE == 'true') {
         tep_reset_cache_block('manufacturers2');
       }

       tep_redirect(tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page']));
       break;
   }
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MANUFACTURERS2; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
             </tr>
<?php
 $manufacturers2_query_raw = "select manufacturers2_id, manufacturers2_name, manufacturers2_image, date_added, last_modified from " . TABLE_MANUFACTURERS2 . " order by manufacturers2_name";
 $manufacturers2_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $manufacturers2_query_raw, $manufacturers2_query_numrows);
 $manufacturers2_query = tep_db_query($manufacturers2_query_raw);
 while ($manufacturers2 = tep_db_fetch_array($manufacturers2_query)) {
   if ((!isset($HTTP_GET_VARS['mID']) || (isset($HTTP_GET_VARS['mID']) && ($HTTP_GET_VARS['mID'] == $manufacturers2['manufacturers2_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) {
     $manufacturer2_products_query = tep_db_query("select count(*) as products_count from " . TABLE_PRODUCTS . " where manufacturers2_id = '" . (int)$manufacturers2['manufacturers2_id'] . "'");
     $manufacturer2_products = tep_db_fetch_array($manufacturer2_products_query);

     $mInfo_array = array_merge($manufacturers2, $manufacturer2_products);
     $mInfo = new objectInfo($mInfo_array);
   }

   if (isset($mInfo) && is_object($mInfo) && ($manufacturers2['manufacturers2_id'] == $mInfo->manufacturers2_id)) {
     echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $manufacturers2['manufacturers2_id'] . '&action=edit') . '\'">' . "\n";
   } else {
     echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $manufacturers2['manufacturers2_id']) . '\'">' . "\n";
   }
?>
               <td class="dataTableContent"><?php echo $manufacturers2['manufacturers2_name']; ?></td>
               <td class="dataTableContent" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($manufacturers2['manufacturers2_id'] == $mInfo->manufacturers2_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $manufacturers2['manufacturers2_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
             </tr>
<?php
 }
?>
             <tr>
               <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="smallText" valign="top"><?php echo $manufacturers2_split->display_count($manufacturers2_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_MANUFACTURERS2); ?></td>
                   <td class="smallText" align="right"><?php echo $manufacturers2_split->display_links($manufacturers2_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
                 </tr>
               </table></td>
             </tr>
<?php
 if (empty($action)) {
?>
             <tr>
               <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers2_id . '&action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
             </tr>
<?php
 }
?>
           </table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
   case 'new':
     $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_MANUFACTURER2 . '</b>');

     $contents = array('form' => tep_draw_form('manufacturers2', FILENAME_MANUFACTURERS2, 'action=insert', 'post', 'enctype="multipart/form-data"'));
     $contents[] = array('text' => TEXT_NEW_INTRO);
     $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS2_NAME . '<br>' . tep_draw_input_field('manufacturers2_name'));
     $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS2_IMAGE . '<br>' . tep_draw_file_field('manufacturers2_image'));

     $manufacturer2_inputs_string = '';
     $languages = tep_get_languages();
     for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
       $manufacturer2_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers2_url[' . $languages[$i]['id'] . ']');
     }

     $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS2_URL . $manufacturer2_inputs_string);
     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $HTTP_GET_VARS['mID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
   case 'edit':
     $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_MANUFACTURER2 . '</b>');

     $contents = array('form' => tep_draw_form('manufacturers2', FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers2_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
     $contents[] = array('text' => TEXT_EDIT_INTRO);
     $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS2_NAME . '<br>' . tep_draw_input_field('manufacturers2_name', $mInfo->manufacturers2_name));
     $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS2_IMAGE . '<br>' . tep_draw_file_field('manufacturers2_image') . '<br>' . $mInfo->manufacturers2_image);

     $manufacturer2_inputs_string = '';
     $languages = tep_get_languages();
     for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
     $manufacturer2_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers2_url[' . $languages[$i]['id'] . ']', tep_get_manufacturer2_url($mInfo->manufacturers2_id, $languages[$i]['id']));
     }

     $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS2_URL . $manufacturer2_inputs_string);
     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers2_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
   case 'delete':
     $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_MANUFACTURER2 . '</b>');

     $contents = array('form' => tep_draw_form('manufacturers2', FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers2_id . '&action=deleteconfirm'));
     $contents[] = array('text' => TEXT_DELETE_INTRO);
     $contents[] = array('text' => '<br><b>' . $mInfo->manufacturers2_name . '</b>');
     $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE);

     if ($mInfo->products_count > 0) {
       $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
       $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $mInfo->products_count));
     }

     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers2_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
   default:
     if (isset($mInfo) && is_object($mInfo)) {
       $heading[] = array('text' => '<b>' . $mInfo->manufacturers2_name . '</b>');

       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers2_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_MANUFACTURERS2, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers2_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
       $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($mInfo->date_added));
       if (tep_not_null($mInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($mInfo->last_modified));
       $contents[] = array('text' => '<br>' . tep_info_image($mInfo->manufacturers2_image, $mInfo->manufacturers2_name));
       $contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $mInfo->products_count);
     }
     break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
   echo '            <td width="25%" valign="top">' . "\n";

   $box = new box;
   echo $box->infoBox($heading, $contents);

   echo '            </td>' . "\n";
 }
?>
         </tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

*modules.php

  require('includes/application_top.php');

 $set = (isset($HTTP_GET_VARS['set']) ? $HTTP_GET_VARS['set'] : '');

 if (tep_not_null($set)) {
   switch ($set) {
     case 'shipping':
       $module_type = 'shipping';
       $module_directory = DIR_FS_CATALOG_MODULES . 'shipping/';
       $module_key = 'MODULE_SHIPPING_INSTALLED';
       define('HEADING_TITLE', HEADING_TITLE_MODULES_SHIPPING);
       break;
     case 'ordertotal':
       $module_type = 'order_total';
       $module_directory = DIR_FS_CATALOG_MODULES . 'order_total/';
       $module_key = 'MODULE_ORDER_TOTAL_INSTALLED';
       define('HEADING_TITLE', HEADING_TITLE_MODULES_ORDER_TOTAL);
       break;
     case 'payment':
     default:
       $module_type = 'payment';
       $module_directory = DIR_FS_CATALOG_MODULES . 'payment/';
       $module_key = 'MODULE_PAYMENT_INSTALLED';
       define('HEADING_TITLE', HEADING_TITLE_MODULES_PAYMENT);
       break;
   }
 }

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'save':
       while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
         tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");
       }
       tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']));
       break;
     case 'install':
     case 'remove':
       $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
       $class = basename($HTTP_GET_VARS['module']);
       if (file_exists($module_directory . $class . $file_extension)) {
         include($module_directory . $class . $file_extension);
         $module = new $class;
         if ($action == 'install') {
           $module->install();
         } elseif ($action == 'remove') {
           $module->remove();
         }
       }
       tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class));
       break;
   }
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODULES; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
             </tr>
<?php
 $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
 $directory_array = array();
 if ($dir = @dir($module_directory)) {
   while ($file = $dir->read()) {
     if (!is_dir($module_directory . $file)) {
       if (substr($file, strrpos($file, '.')) == $file_extension) {
         $directory_array[] = $file;
       }
     }
   }
   sort($directory_array);
   $dir->close();
 }

 $installed_modules = array();
 for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {
   $file = $directory_array[$i];

   include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/' . $module_type . '/' . $file);
   include($module_directory . $file);

   $class = substr($file, 0, strrpos($file, '.'));
   if (tep_class_exists($class)) {
     $module = new $class;
     if ($module->check() > 0) {
       if ($module->sort_order > 0) {
         $installed_modules[$module->sort_order] = $file;
       } else {
         $installed_modules[] = $file;
       }
     }

     if ((!isset($HTTP_GET_VARS['module']) || (isset($HTTP_GET_VARS['module']) && ($HTTP_GET_VARS['module'] == $class))) && !isset($mInfo)) {
       $module_info = array('code' => $module->code,
                            'title' => $module->title,
                            'description' => $module->description,
                            'status' => $module->check());

       $module_keys = $module->keys();

       $keys_extra = array();
       for ($j=0, $k=sizeof($module_keys); $j<$k; $j++) {
         $key_value_query = tep_db_query("select configuration_title, configuration_value, configuration_description, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_keys[$j] . "'");
         $key_value = tep_db_fetch_array($key_value_query);

         $keys_extra[$module_keys[$j]]['title'] = $key_value['configuration_title'];
         $keys_extra[$module_keys[$j]]['value'] = $key_value['configuration_value'];
         $keys_extra[$module_keys[$j]]['description'] = $key_value['configuration_description'];
         $keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];
         $keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];
       }

       $module_info['keys'] = $keys_extra;

       $mInfo = new objectInfo($module_info);
     }

     if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {
       if ($module->check() > 0) {
         echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit') . '\'">' . "\n";
       } else {
         echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
       }
     } else {
       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class) . '\'">' . "\n";
     }
?>
               <td class="dataTableContent"><?php echo $module->title; ?></td>
               <td class="dataTableContent" align="right"><?php if (is_numeric($module->sort_order)) echo $module->sort_order; ?></td>
               <td class="dataTableContent" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
             </tr>
<?php
   }
 }

 ksort($installed_modules);
 $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_key . "'");
 if (tep_db_num_rows($check_query)) {
   $check = tep_db_fetch_array($check_query);
   if ($check['configuration_value'] != implode(';', $installed_modules)) {
     tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $installed_modules) . "', last_modified = now() where configuration_key = '" . $module_key . "'");
   }
 } else {
   tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Modules', '" . $module_key . "', '" . implode(';', $installed_modules) . "', 'This is automatically updated. No need to edit.', '6', '0', now())");
 }
?>
             <tr>
               <td colspan="3" class="smallText"><?php echo TEXT_MODULE_DIRECTORY . ' ' . $module_directory; ?></td>
             </tr>
           </table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
   case 'edit':
     $keys = '';
     reset($mInfo->keys);
     while (list($key, $value) = each($mInfo->keys)) {
       $keys .= '<b>' . $value['title'] . '</b><br>' . $value['description'] . '<br>';

       if ($value['set_function']) {
         eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');");
       } else {
         $keys .= tep_draw_input_field('configuration[' . $key . ']', $value['value']);
       }
       $keys .= '<br><br>';
     }
     $keys = substr($keys, 0, strrpos($keys, '<br><br>'));

     $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');

     $contents = array('form' => tep_draw_form('modules', FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'] . '&action=save'));
     $contents[] = array('text' => $keys);
     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
   default:
     $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');

     if ($mInfo->status == '1') {
       $keys = '';
       reset($mInfo->keys);
       while (list(, $value) = each($mInfo->keys)) {
         $keys .= '<b>' . $value['title'] . '</b><br>';
         if ($value['use_function']) {
           $use_function = $value['use_function'];
           if (ereg('->', $use_function)) {
             $class_method = explode('->', $use_function);
             if (!is_object(${$class_method[0]})) {
               include(DIR_WS_CLASSES . $class_method[0] . '.php');
               ${$class_method[0]} = new $class_method[0]();
             }
             $keys .= tep_call_function($class_method[1], $value['value'], ${$class_method[0]});
           } else {
             $keys .= tep_call_function($use_function, $value['value']);
           }
         } else {
           $keys .= $value['value'];
         }
         $keys .= '<br><br>';
       }
       $keys = substr($keys, 0, strrpos($keys, '<br><br>'));

       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=remove') . '">' . tep_image_button('button_module_remove.gif', IMAGE_MODULE_REMOVE) . '</a> <a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . (isset($HTTP_GET_VARS['module']) ? '&module=' . $HTTP_GET_VARS['module'] : '') . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
       $contents[] = array('text' => '<br>' . $mInfo->description);
       $contents[] = array('text' => '<br>' . $keys);
     } else {
       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=install') . '">' . tep_image_button('button_module_install.gif', IMAGE_MODULE_INSTALL) . '</a>');
       $contents[] = array('text' => '<br>' . $mInfo->description);
     }
     break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
   echo '            <td width="25%" valign="top">' . "\n";

   $box = new box;
   echo $box->infoBox($heading, $contents);

   echo '            </td>' . "\n";
 }
?>
         </tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

Hi

go to includes/functions/general.php

 

find

tep_get_manufacturer_url()"

 

and create another one with manufacturer2_url()

 

BUT BEFORE doing so, try do use the same function for both

 

ie: try the tep_get_manufacturer_url()" for the manufacturer2

 

Salvo

Posted

Hi Salvo.

 

As you wrote, i just found that out too!!

 

2 Problems were:

 

1. Needed to edit in manufacturers2.php, All the "mInfo" or "mID"

"m2Info" or "m2ID"

 

2.Copy this part into admin/includes/function/general.php

function tep_get_manufacturer2_url($manufacturer2_id, $language_id) {
   $manufacturer2_query = tep_db_query("select manufacturers2_url from " . TABLE_MANUFACTURERS2_INFO . " where manufacturers2_id = '" . (int)$manufacturer2_id . "' and languages_id = '" . (int)$language_id . "'");
   $manufacturer2 = tep_db_fetch_array($manufacturer2_query);

   return $manufacturer2['manufacturers2_url'];
 }

 

Well, now i have EDIT and DELETE in 2nd manufacturers too!

 

Thanks for your advices :)

Archived

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

×
×
  • Create New...