laszlo_m Posted April 6, 2007 Posted April 6, 2007 Hi, I added some custom fields to the product table and I want one of them as a text area, same type as the product description combo box. I found the code in catalog/admin/categories.php how the product description box is created but for some reason I can not convert it to my new field. I know the 'tep_draw_textarea_field' function is sitting in html_output.php but I have a hard time to setup the parameters the same way as the function requests it. Can somebody help me with this? Or is there an easier way to create a text area, combo box? I want to create the text area for products_compatibility field (defined as text). Content could be 300-500 character length. Here is the code I found for the production description: <tr> <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td> <td><table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td> <?php ?></td> <td class="main"><?php if(HTML_AREA_WYSIWYG_DISABLE == 'Enable') { echo tep_draw_fckeditor ('products_description[' . $languages[$i]['id'] . ']', '550', '300', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))) . '</td>'; } else { echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'].']','soft','70','15',(isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))) . '</td>'; } // EOF: MOD WYSIWYG Editor ?> </tr> </table></td> </tr> This is the function: // Output a form textarea field function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) { $field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"'; if (tep_not_null($parameters)) $field .= ' ' . $parameters; $field .= '>'; if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) { // LINE CHANGED: MS2 update 501112 - Added: tep_output_string_protected(...) $field .= tep_output_string_protected(stripslashes($GLOBALS[$name])); } elseif (tep_not_null($text)) { // LINE CHANGED: MS2 update 501112 - Added: tep_output_string_protected(...) $field .= tep_output_string_protected($text); } $field .= '</textarea>'; return $field; } Thanks, Laszlo_M
dittones Posted April 6, 2007 Posted April 6, 2007 Mayer, This is the code you should use...you need a for loop to wrap your code since there are three languages... <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?> <tr> <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td> <td><table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td> <td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '300', '500', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td> </tr> </table></td> </tr> <?php } ?> I hope this helps Roman Dittone.com
Recommended Posts
Archived
This topic is now archived and is closed to further replies.