SCH_001 Posted June 1, 2019 Share Posted June 1, 2019 So what this module does is give you buttons above the order edit status and comment area which on click auto fill the comment area with what ever you programmed for the button which save a heap of time each day. Click the button and all the shipping info is filled in - just add the connote number Anyway the add-on is here https://apps.oscommerce.com/7WMMM&automatic-responses-or-comments-to-order Yes it's a bit dated, I have hardcoded what would have been in filenames.php and also the images dir and a few others. It's all deplaying correctly but when I click the bottom is does nothing So - Does anyone know of a newer add-on that does the same / similar thing? Or can some please check the below code catalog/admin/includes/languages/english/automatic_responses.php catalog/admin/includes/languages/espanol/automatic_responses.php catalog/admin/includes/modules/responses.php catalog/admin/automatic_responses.php admin/automatic_responses.php <?php /* $Id: automatic_responses.php 2014/08/20 figue Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); $action = (isset($_GET['action']) ? $_GET['action'] : ''); $languages = tep_get_languages(); // Sets the status of a response function tep_set_response_status($responses_id, $status) { if ($status == '1') { return tep_db_query("update " . TABLE_RESPONSES . " set status = '1' where responses_id = '" . $responses_id . "'"); } elseif ($status == '0') { return tep_db_query("update " . TABLE_RESPONSES . " set status = '0' where responses_id = '" . $responses_id . "'"); } else { return -1; } } if (tep_not_null($action)) { switch ($action) { case 'setflag': if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) { tep_set_response_status($_GET['bID'], $_GET['flag']); $messageStack->add_session(SUCCESS_RESPONSE_STATUS_UPDATED, 'success'); } else { $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error'); } tep_redirect(tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $_GET['bID'])); break; case 'insert': case 'update': if (isset($_POST['responses_id'])) $responses_id = tep_db_prepare_input($_POST['responses_id']); $responses_title = tep_db_prepare_input($_POST['responses_title']); $responses_alt = tep_db_prepare_input($_POST['responses_alt']); $responses_description = tep_db_prepare_input($_POST['responses_description']); $sort_order = tep_db_prepare_input($_POST['sort_order']); $new_responses_group = tep_db_prepare_input($_POST['new_responses_group']); $responses_group = (empty($new_responses_group)) ? tep_db_prepare_input($_POST['responses_group']) : $new_responses_group; $response_error = false; if (empty($responses_group)) { $messageStack->add(ERROR_RESPONSE_GROUP_REQUIRED, 'error'); $response_error = true; } for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $title_field_name=$_POST['responses_title_'.$languages[$i]['id']]; if (empty($title_field_name)) { $messageStack->add(ERROR_RESPONSE_TITLE_REQUIRED, 'error'); $response_error = true; } } if (empty($responses_description)) { } if ($response_error == false) { $messageSt = false; for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $responses_titlem=$_POST['responses_title_'.$languages[$i]['id']]; $responses_altm=$_POST['responses_alt_'.$languages[$i]['id']]; $responses_descriptionm=$_POST['responses_description_'.$languages[$i]['id']]; $language_idm='language_id_'.$languages[$i]['id']; $sql_data_array_responses = array('sort_order' => $sort_order, 'status' => '1', 'responses_group' => $responses_group); $sql_data_array_responses_description = array('responses_title' => $responses_titlem, 'responses_alt' => $responses_altm, 'responses_description' => stripslashes($responses_descriptionm)); if ($action == 'insert') { $bID=""; if ($i == 0) { tep_db_perform(TABLE_RESPONSES, $sql_data_array_responses); $responses_id = tep_db_insert_id(); } $responseid_merge= array('responses_id' => $responses_id, 'language_id' => $languages[$i]['id']); $sql_data_array_responses_desc = array_merge($sql_data_array_responses_description, $responseid_merge); tep_db_perform(TABLE_RESPONSES_DESCRIPTION, $sql_data_array_responses_desc); $messageSt = true; $messageSta = SUCCESS_RESPONSE_INSERTED; } elseif ($action == 'update') { if ($i == 0) { tep_db_perform(TABLE_RESPONSES, $sql_data_array_responses, 'update', "responses_id = '" . (int)$responses_id . "'"); } $selectexists=tep_db_query("select count( * ) as `countrecords` from `".TABLE_RESPONSES_DESCRIPTION."` where responses_id='" . (int)$responses_id . "' and language_id='".$languages[$i]['id']."'"); $recordexists = tep_db_fetch_array($selectexists); if($recordexists['countrecords'] >= 1 ) { tep_db_perform(TABLE_RESPONSES_DESCRIPTION, $sql_data_array_responses_description, 'update', "responses_id = '" . (int)$responses_id . "' and language_id='".$languages[$i]['id']."'"); } else { $responseid_merge= array('responses_id' => $responses_id, 'language_id' => $languages[$i]['id']); $sql_data_array_responses_desc = array_merge($sql_data_array_responses_description, $responseid_merge); tep_db_perform(TABLE_RESPONSES_DESCRIPTION, $sql_data_array_responses_desc); } $messageSt = true; $messageSta = SUCCESS_RESPONSE_UPDATED; } } //for if ($messageSt == true) $messageStack->add_session($messageSta, 'success'); tep_redirect(tep_href_link('automatic_responses.php', (isset($_GET['response']) ? 'response=' . $_GET['response'] . '&' : '') . 'bID=' . $responses_id)); } else { $action = 'new'; } break; case 'deleteconfirm': $responses_id = tep_db_prepare_input($_GET['bID']); tep_db_query("delete from " . TABLE_RESPONSES . " where responses_id = '" . (int)$responses_id . "'"); tep_db_query("delete from " . TABLE_RESPONSES_DESCRIPTION . " where responses_id = '" . (int)$responses_id . "'"); $messageStack->add_session(SUCCESS_RESPONSE_REMOVED, 'success'); tep_redirect(tep_href_link('automatic_responses.php', 'response=' . $_GET['response'])); break; } } require('includes/template_top.php'); ?> <script language="javascript"> function disableIt(a){ document.getElementById(a).disabled=true; } function enableIt(a){ document.getElementById(a).disabled=false; } </script> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><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> <tr> <td colspan="2" class="main" align="left"><?php echo '<span class="smallText">' . TEXT_RESPONSES_ATTENTION . '</span><br>'; ?></td> </tr> </table></td> </tr> <?php if ($action == 'new') { $form_action = 'insert'; $parameters = array('responses_title' => '', 'responses_alt' => '', 'responses_description' => '', 'sort_order' =>'', 'responses_group' => '', 'status' =>''); $bInfo = new objectInfo($parameters); if (isset($_GET['bID'])) { $form_action = 'update'; $bID = tep_db_prepare_input($_GET['bID']); $response_query = tep_db_query("select s.status, s.sort_order, s.responses_group, p.responses_title, p.responses_alt, p.responses_description, p.language_id from " . TABLE_RESPONSES . " s left join " . TABLE_RESPONSES_DESCRIPTION . " p on s.responses_id=p.responses_id where s.responses_id = '" . (int)$bID . "'"); while($response = tep_db_fetch_array($response_query)) { $languageid=$response['language_id']; $responsetitle[$languageid]= $response['responses_title']; $responsealt[$languageid]= $response['responses_alt']; $sortorder=$response['sort_order']; $responsesgroup=$response['responses_group']; $responses_description[$languageid]=$response['responses_description']; } } elseif (tep_not_null($_POST)) { $bInfo->objectInfo($_POST); } $bIDif=""; if(!empty($bID) && $bID != "") { $bIDif='&bID='.$bID; } // grupo $groups_array = array(); $groups_query = tep_db_query("select distinct responses_group from " . TABLE_RESPONSES . " order by responses_group"); while ($groups = tep_db_fetch_array($groups_query)) { $groups_array[] = array('id' => $groups['responses_group'], 'text' => $groups['responses_group']); } // fin grupo ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr><?php echo tep_draw_form('new_response', 'automatic_responses.php', (isset($_GET['response']) ? 'response=' . $_GET['response'] . '&' : '') . 'action=' . $form_action.$bIDif, 'post', 'enctype="multipart/form-data"'); if ($form_action == 'update') echo tep_draw_hidden_field('responses_id', $bID); ?> <td><table border="0" cellspacing="0" cellpadding="2"> <?php // grupo ?> <tr> <td class="main" valign="top"><?php echo TEXT_RESPONSES_GROUP; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('responses_group', $groups_array, $responsesgroup) . TEXT_RESPONSES_NEW_GROUP . '<br />' . tep_draw_input_field('new_responses_group', '', '', ((sizeof($groups_array) > 0) ? false : true)); ?></td> </tr> <?php // fin grupo ?> <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?> <tr> <td class="main"><?php if ($i == 0) echo TEXT_RESPONSES_TITLE; ?></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('responses_title_'.$languages[$i]['id'], $responsetitle[$languages[$i]['id']], '', true); ?></td> </tr> <tr> <td class="main"><?php if ($i == 0) echo TEXT_RESPONSES_ALT; ?></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('responses_alt_'.$languages[$i]['id'], $responsealt[$languages[$i]['id']], '', true); ?></td> </tr> <?php } ?> <tr> <td class="main"><?php echo TEXT_RESPONSES_SORT_ORDER; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sort_order', $sortorder, '', false); ?></td> </tr> <tr> <td class="main"> </td> <td class="main"> </td> </tr> <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?> <tr> <td valign="top" class="main" colspan="2"><br> <?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']). ' '. tep_draw_textarea_field('responses_description_'.$languages[$i]['id'],'soft','100','10', $responses_description[$languages[$i]['id']]); ?> </td> </tr> <?php } ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main" align="center"><?php echo TEXT_RESPONSES_RESPONSE_NOTE . '<br>'; ?></td> <td class="main" align="right" valign="top"> <?php echo tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('automatic_responses.php', (isset($_GET['response']) ? 'response=' . $_GET['response'] . '&' : '') . (!empty($bID) and $bID != "" ? 'bID=' . $bID : ''))); ?> </td> </tr> </table> <input type="hidden" name="bID" value="<?php echo $bID; ?>"> </td> </form></tr> <?php } else { ?> <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" width="100%"> <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_RESPONSES; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_RESPONSES_ALT; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_GROUPS; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SORT_ORDER; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent"></td> <td class="dataTableHeadingContent"></td> </tr> <?php $responses_query_raw = "select p.responses_id, p.status, p.sort_order, p.responses_group, s.responses_title, s.responses_alt from " . TABLE_RESPONSES . " p LEFT JOIN " .TABLE_RESPONSES_DESCRIPTION . " s on p.responses_id = s.responses_id where s.language_id='" . (int)$languages_id . "' order by p.responses_group, p.sort_order, s.responses_title"; $responses_split = new splitPageResults($_GET['response'], MAX_DISPLAY_SEARCH_RESULTS_RESPONSES, $responses_query_raw, $responses_query_numrows); $responses_query = tep_db_query($responses_query_raw); while ($responses = tep_db_fetch_array($responses_query)) { if ((!isset($_GET['bID']) || (isset($_GET['bID']) && ($_GET['bID'] == $responses['responses_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) { $bInfo_array = array_merge($responses, (array) $info); $bInfo = new objectInfo($bInfo_array); } if (isset($bInfo) && is_object($bInfo) && ($responses['responses_id'] == $bInfo->responses_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $responses['responses_id']) . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $responses['responses_id']) . '\'">' . "\n"; } ?> <td class="dataTableContent" align="left"><?php echo '<a href="javascript:popupImageWindow(\'' . FILENAME_POPUP_IMAGE . '?response=' . $responses['responses_id'] . '\')">' . tep_image('images/icon_popup.gif', 'View Page') . '</a> ' . $responses['responses_title']; ?></td> <td class="dataTableContent" align="center"><?php echo $responses['responses_alt']; ?></td> <td class="dataTableContent" align="center"><?php echo $responses['responses_group']; ?></td> <td class="dataTableContent" align="center"><?php echo $responses['sort_order']; ?></td> <td class="dataTableContent" align="center"> <?php if ($responses['status'] == '1') { echo tep_image('images/icon_status_green.gif', 'Active', 10, 10) . ' <a href="' . tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $responses['responses_id'] . '&action=setflag&flag=0') . '">' . tep_image('images/icon_status_red_light.gif', 'Set Inactive', 10, 10) . '</a>'; } else { echo '<a href="' . tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $responses['responses_id'] . '&action=setflag&flag=1') . '">' . tep_image('images/icon_status_green_light.gif', 'Set Active', 10, 10) . '</a> ' . tep_image('images/icon_status_red.gif', 'Inactive', 10, 10); } ?> </td> <td class="dataTableContent" align="right"></td> <td class="dataTableContent" align="right"></td> </tr> <?php } ?> <tr> <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"><?php echo $responses_split->display_count($responses_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_RESPONSES, $_GET['response'], TEXT_DISPLAY_NUMBER_OF_RESPONSES); ?></td> <td class="smallText" align="right"><?php echo $responses_split->display_links($responses_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_RESPONSES, MAX_DISPLAY_RESPONSE_LINKS, $_GET['response']); ?></td> </tr> <tr> <td class="smallText" align="right" colspan="2"><?php echo tep_draw_button(IMAGE_NEW_RESPONSE, 'plus', tep_href_link('automatic_responses.php', 'action=new')); ?></td> </tr> </table></td> </tr> </table></td> <?php $heading = array(); $contents = array(); switch ($action) { case 'delete': $heading[] = array('text' => '<b>' . $bInfo->responses_title . '</b> - ' . $bInfo->responses_alt); $contents = array('form' => tep_draw_form('responses', 'automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $bInfo->responses_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '<br><b>' . $bInfo->responses_title . '</b> - ' . $bInfo->responses_alt); if ($bInfo->responses_image) $contents[] = array('text' => '<br />' . tep_draw_checkbox_field('delete_image', 'on', true) . ' ' . TEXT_INFO_DELETE_IMAGE); // $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $_GET['bID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $_GET['bID']))); break; default: if (is_object($bInfo)) { $heading[] = array('text' => '<b>' . $bInfo->responses_title . '</b> - ' . $bInfo->responses_alt); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $bInfo->responses_id . '&action=new')) . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link('automatic_responses.php', 'response=' . $_GET['response'] . '&bID=' . $bInfo->responses_id . '&action=delete'))); if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_RESPONSES_SCHEDULED_AT_DATE, tep_date_short($bInfo->date_scheduled))); if ($bInfo->expires_date) { $contents[] = array('text' => '<br>' . sprintf(TEXT_RESPONSES_EXPIRES_AT_DATE, tep_date_short($bInfo->expires_date))); } elseif ($bInfo->expires_impressions) { $contents[] = array('text' => '<br>' . sprintf(TEXT_RESPONSES_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions)); } if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_RESPONSES_STATUS_CHANGE, tep_date_short($bInfo->date_status_change))); } 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> <?php } ?> </table> <?php require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?> and this one admin/includes/modules/responses.php <?php /* $Id: responses.php 2014/08/20 figue Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ $botones = '<tr><td><table border="0" style="border:solid 0px #666666; width:800px; margin-top:15px; margin-bottom:15px;" cellspacing="0" cellpadding="0">'; $funciones = '<script type="text/javascript">'; $responses_group_query = tep_db_query("select distinct responses_group from " . TABLE_RESPONSES . " where status = 1"); if (tep_db_num_rows($responses_group_query)) { while($responses_group = tep_db_fetch_array($responses_group_query)) { $botones .= ' <tr> <td class="main" style="padding-top:14px; padding-bottom:4px;"><b> ' . $responses_group['responses_group'] . '</b></td> </tr> <tr> <td>'; $responses_query = tep_db_query("select r.responses_id, r.status, r.sort_order, r.responses_group, rd.responses_title, rd.responses_alt, rd.responses_description from " . TABLE_RESPONSES . " r left join " . TABLE_RESPONSES_DESCRIPTION . " rd on r.responses_id = rd.responses_id where r.status = 1 and r.responses_group = '" . $responses_group['responses_group'] . "'and rd.language_id = '" . (int)$languages_id . "'"); while($responses = tep_db_fetch_array($responses_query)) { $responses_id = $responses['responses_id']; $responses_title = $responses['responses_title']; $responses_alt = (($responses['responses_alt'] !='') ? $responses['responses_alt'] : $responses_title); $responses_desc = $responses['responses_description']; $responses_desc = str_replace("\r", "", $responses_desc); // elimino los saltos de linea de la etiqueta \r. $responses_desc = str_replace("\n", "\\n", $responses_desc); // reemplazo la etiqueta \n por \\n, para que se imprima en el texto y funcione el script. // $botones .= '<input type=button value="' . $responses_title . '" title="' . $responses_alt . '" onclick=\'return mensaje' . $responses_id . '();\'>'; $botones .= '<div style="float:left;"><input type=button value="' . $responses_title . '" title="' . $responses_alt . '" onclick=\'return mensaje' . $responses_id . '();\'></div>'; $funciones .= ' function mensaje' . $responses_id . '() { document.status.comments.value="' . $responses_desc . '"; }'; } $botones .= ' </td> </tr>'; } } $botones .= '</table></td></tr>'; $funciones .= '</script>'; // echo $botones; // echo $funciones; ?> Link to comment Share on other sites More sharing options...
Dan Cole Posted June 1, 2019 Share Posted June 1, 2019 5 hours ago, supercheaphobb said: I have hardcoded what would have been in filenames.php and also the images dir and a few others. Did you add the table names to database.php....I see a number of places in the code above where there are references to TABLE defines instead of those being hard coded. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
SCH_001 Posted June 2, 2019 Author Share Posted June 2, 2019 sure did @Dan Cole at the bottom the instructions say to enter the below before the closing ?> which has been shown here // automatic responses or comments to orders with admin define('TABLE_RESPONSES', 'responses'); define('TABLE_RESPONSES_DESCRIPTION', 'responses_description'); ?> Link to comment Share on other sites More sharing options...
Dan Cole Posted June 2, 2019 Share Posted June 2, 2019 I don't use that add on but I assume you need to add some database tables by executing some SQL statements. Are those tables in place and do they contain any data? Also are you seeing any errors at all or does some button just not work? Which button? Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted June 2, 2019 Share Posted June 2, 2019 Just drop an echo into the code at key points to help trace what bits are being exicuted as required and what if falling over. Link to comment Share on other sites More sharing options...
SCH_001 Posted June 2, 2019 Author Share Posted June 2, 2019 Ok I found the problem but don't know how to fix I added the below to orders.php <td><?php //echo tep_draw_textarea_tinymce('comments', 'soft', '60', '6', null, 'style="width: 100%;"'); ?> So I can use tinymce in the comment box but this stops both the addons "Canned Order Comments 2.0 - for OSC 2.3" and "automatic responses or comments to order" working Once I put the line back to normal textarea_field both work, so now I got two very but no WYSIWYG editor Link to comment Share on other sites More sharing options...
♥JcMagpie Posted June 2, 2019 Share Posted June 2, 2019 To use tinymice you should just be applying an ID to the text area you need it to apply to. <textarea id="basic-example"> and calling that id in the js take a look at this example https://codepen.io/pen/?&editable=true Link to comment Share on other sites More sharing options...
burt Posted June 2, 2019 Share Posted June 2, 2019 I made a system back in '16 for one of the 28d projects. So far as I recall, this was the days before the orders page got hooked, so it was a couple of core code changes - I think it may be now doable without core code changes (not sure how deep the hook goes in orders.php - haven't looked at it in a while). Link to comment Share on other sites More sharing options...
♥JcMagpie Posted June 3, 2019 Share Posted June 3, 2019 So for anyone else looking to use tinymce, this is basicly how you do it. First add the script to your header ( admin side and/or shop it's up to you) <script src="//cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.1/tinymce.min.js"></script> This is the free cdn, you can use a paid version if you like. Also you can make a header tag module for shop side if you wish. Then to stop it beeing applied to all text areas you need to target it to a class. So we add this to the header as well. We sre using the selector "comments" to limit which text area it will show on. This could be anything you pick. <script> tinymce.init({ //mode : "textareas", mode : "specific_textareas", editor_selector : "comments" }); </script> For the comments in order edit you will need to add the class to the textarea. To do this go to public_html/your--admin/includes/functions/html_output.php and find line 266 // Output a form textarea field // The $wrap parameter is no longer used in the core xhtml template function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) { $field = '<textarea name="' . tep_output_string($name) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"'; and change to // Output a form textarea field // The $wrap parameter is no longer used in the core xhtml template function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) { $field = '<textarea class="comments" name="' . tep_output_string($name) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"'; All we have done is add the class="comments" to the code. If you now go to order edit you will see, It's the same for any input textarea you wish to use the editor on. Make sure the script is loaded and add the selector class to the area. Those using CE BS4 Edge will see that if you just add the script many of the text area's (not all) automaticly show the editor. Link to comment Share on other sites More sharing options...
SCH_001 Posted June 3, 2019 Author Share Posted June 3, 2019 @JcMagpie Your method of installation works but still does not work with "Canned Order Comments 2.0 - for OSC 2.3" and "automatic responses or comments to order" Meaning once installed you click any of the canned responses box and nothing. I guess for other it would be good to find a solution, but myself I am not too worried about have an editor on the customers orders comment box Link to comment Share on other sites More sharing options...
♥JcMagpie Posted June 3, 2019 Share Posted June 3, 2019 No problem. Looks like you have a problem in those 2 add-on's as they should not stop working just because you load tinymce script. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.