Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_get function error


Genius

Recommended Posts

HI

 

I have added a new field called products_name2 just below products_name.

 

I my admin page i see the second row and i am able to add text to the second line, products_name2. I am able to preview the the second line. BUT when i go back to my admin products page to edit the product,,, It does not call the second products_name2 line and gives me this error

 

 

Fatal error: Call to undefined function: tep_get_products_name2() in C:Inetpubwwwroottestsitecatalogadminincludesmodulesproducts_new_edit.php on line 376

 

 

Please could someone help me as i really need some assistance.

 

the code i have in the products_new-edit is:

 

<?php // BOF TEXT_PRODUCTS_NAME ///////////////////////////////////////////////////////////////////

?>

         <tr>

           <td class="mainheading" colspan="2"><?php echo TEXT_PRODUCTS_NAME_TITLE . '<br><hr>';?></td>

         </tr>

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

         <tr>

           <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>

           <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : tep_get_products_name($pInfo->products_id, $languages[$i]['id'])), 'style="width: 482"'); ?></td>

   </tr>

         <tr>

          <td class="main" valign="top"></td>

          <td class="main"><?php echo tep_draw_input_field('products_name2[' . $languages[$i]['id'] . ']', '', 'style="width: 482"', (($products_name2[$languages[$i]['id']]) ? stripslashes($products_nam2[$languages[$i]['id']]) : tep_get_products_name2($pInfo->products_id, $languages[$i]['id']))); ?>

  </tr>

Link to comment
Share on other sites

you need to add a second function to /includes/functions/general.php

 

something like:

 

function tep_get_products_name2($product_id, $language = '') {

global $languages_id;

 

if (empty($language)) $language = $languages_id;

 

$product_query = tep_db_query("select products_name2 from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'");

$product = tep_db_fetch_array($product_query);

 

return $product['products_name'];

}

 

should do it, assuming that is how you've structured you db change.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...