sargenle Posted November 26, 2004 Share Posted November 26, 2004 Okay I think I made some big time mistakes or I just don't care for what I see and need to replace my site from a back up. For some reason the FAQDESK is listed under my footer, is this where it is supposed to be? It looks like this. My Webpage scroll to the bottom of the screen past the footer. Lee Quote Link to comment Share on other sites More sharing options...
sargenle Posted November 26, 2004 Share Posted November 26, 2004 Okay I think I made some big time mistakes or I just don't care for what I see and need to replace my site from a back up. For some reason the FAQDESK is listed under my footer, is this where it is supposed to be? It looks like this. My Webpage scroll to the bottom of the screen past the footer. Lee <{POST_SNAPBACK}> Okay looking back on my installation. Make just one change to the column_right.php shows me that I am not as good as I thought I was with copying and pasting coding. I now have an infobox for the FAQ but most of the FAQ stuff is still below the footer. So here are some questions. In Application_top.PHP where do you put // faqsdesk define('DIR_WS_RSS', DIR_WS_INCLUDES . 'modules/faqdesk/rss/'); I have no idea in this big jumbo of a file. How about this. include(DIR_WS_BOXES . 'faqdesk.php'); include(DIR_WS_BOXES . 'faqdesk_latest.php'); These go in Column_right.php. It says to put it before or after best sellers. Well I have a problem there as well. There are a lot of else and }'s so I am unsure as to where to put those as well. I put them after this } else { include(DIR_WS_BOXES . 'product_notifications.php'); } } else { include(DIR_WS_BOXES . 'best_sellers.php'); } and before this if (isset($HTTP_GET_VARS['products_id'])) { if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php'); } else { include(DIR_WS_BOXES . 'specials.php'); } But I do get a box for include(DIR_WS_BOXES . 'faqdesk_latest.php'); but not for include(DIR_WS_BOXES . 'faqdesk.php'); Another one I am lost on is Index.php in Catalog/includes This code <!-- BEGIN faqdesk --> <tr><td><?php include(FILENAME_FAQDESK_STICKY); ?></td></tr> <!-- //END faqdesk --> <!-- BEGIN faqdesk --> <tr><td><?php include(FILENAME_FAQDESK); ?></td></tr> <!-- //END faqdesk --> Where does it go in the file. I currently have it listed under my New Products box. And it is coded like this. <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td> </tr> <!-- BEGIN faqdesk --> <tr><td><?php include(FILENAME_FAQDESK_STICKY); ?></td></tr> <!-- //END faqdesk --> <!-- BEGIN faqdesk --> <tr><td><?php include(FILENAME_FAQDESK); ?></td></tr> <!-- //END faqdesk --> Is this where it is supposed to go or is there a better place to put it. As you look at my site maybe you can point out some of the other problems that I am having. I hope someone can help me. IF not well I have a a backup right before I installed this contribution. So all is really not lost if I am asking to much. Thank you for any help. Lee Quote Link to comment Share on other sites More sharing options...
sargenle Posted November 29, 2004 Share Posted November 29, 2004 Okay I think after the last couple of days looking over the code and cutting and pasting things where they would be most benificial in my opinion I think I finally have this working. Now my question is this. In admin when someone reviews an FAQ it gets submitted on the admin side. But there is no button for me to approve the review to be placed in the FAQ system. Anyone hazard a quess as to what I am doing wrong. Lee Quote Link to comment Share on other sites More sharing options...
sargenle Posted November 29, 2004 Share Posted November 29, 2004 Now my question is this. In admin when someone reviews an FAQ it gets submitted on the admin side. But there is no button for me to approve the review to be placed in the FAQ system. Anyone hazard a quess as to what I am doing wrong. Lee <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
sargenle Posted November 29, 2004 Share Posted November 29, 2004 Opps posted before I could say what I need to ask. I have found the problem. Seems the gif files in the admin review are missing. Anyway I could get them. Seems like I am talking to myself alot over the last couple of days. Anyone out there. Lee Quote Link to comment Share on other sites More sharing options...
Guest Posted December 28, 2004 Share Posted December 28, 2004 When I try to delete a question in admin, I get the following error message: Fatal error: Call to undefined function: tep_array_reverse() in /[path]/[admin]/includes/functions/faqdesk_general.php on line 206 The code (lines 202 to 209) is as follows: $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "'"); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']); if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = faqdesk_generate_category_path($category['parent_id'], 'category', $categories_array, $index); $categories_array[$index] = tep_array_reverse($categories_array[$index]); } $index++; } ---------------------------------------------------------------------------------------------- Any suggestions? Quote Link to comment Share on other sites More sharing options...
241 Posted December 29, 2004 Author Share Posted December 29, 2004 (edited) When I try to delete a question in admin, I get the following error message: Fatal error: Call to undefined function: tep_array_reverse() in /[path]/[admin]/includes/functions/faqdesk_general.php on line 206 The code (lines 202 to 209) is as follows: $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "'"); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']); if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = faqdesk_generate_category_path($category['parent_id'], 'category', $categories_array, $index); $categories_array[$index] = tep_array_reverse($categories_array[$index]); } $index++; } ---------------------------------------------------------------------------------------------- Any suggestions? <{POST_SNAPBACK}> Yes, support thread Post #78 Edited December 29, 2004 by 241 Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
verbalkent Posted January 12, 2005 Share Posted January 12, 2005 Can some1 add an install file/directions for the latest FaQDesk v1.0.1.1 with the image hack fix.. the fix on the contrib page only says it fixed 2 files without naming which 2 files or the code that was changed. making it really hard for a newbie like me who has additional contribs installed to get this thing implemented.. :P Quote Link to comment Share on other sites More sharing options...
sam_a Posted January 23, 2005 Share Posted January 23, 2005 When I paste an html table into the Long Answer box, it appears in Preview with about 6 inches of space above it. Does anyone know how to fix this? When I paste normal text into the box, everything appears correctly. Do the HTML tages break FAQdesk? Thanks! Quote Link to comment Share on other sites More sharing options...
Guest Posted February 21, 2005 Share Posted February 21, 2005 I using FAQDesk on my website. I would like to display the FAQ's without using any catagories. I moved my FAQ's to the top level and they do not appear. :( IS this possible what I am trying to do? If so How to I go about doing it? <_< TIA TOM B) Quote Link to comment Share on other sites More sharing options...
Guest Posted February 21, 2005 Share Posted February 21, 2005 I using FAQDesk on my website. I would like to display the FAQ's without using any catagories. I moved my FAQ's to the top level and they do not appear. :( IS this possible what I am trying to do? If so How to I go about doing it? <_< TIA TOM B) <{POST_SNAPBACK}> I don't know, but have you looked at your site in Firefox? Quote Link to comment Share on other sites More sharing options...
billi Posted March 7, 2005 Share Posted March 7, 2005 Hi.. The box faqdesk.php does not indicate categories to me. Can unfortunately no error find. cu billi Quote My English is unfortunately bad. Excused ask. Link to comment Share on other sites More sharing options...
Guest Posted March 20, 2005 Share Posted March 20, 2005 (edited) At some point the categories box stopped listing the categories; I could swear that at some point this was working, but I can't be 100% sure. In any case, I can not see any reason why this should not work. Some detective work on my part seems to indicate the problem is that in includes/boxes/faqdesk.php this code: if ($faqPath) { $new_path = ''; is failing the if check. I could not find any place where "$faqpath" is being set. Any ideas? (Wonder if this is also not billi's same issue?) You can see the failure on my site. Thanks! Edited March 20, 2005 by lane Quote Link to comment Share on other sites More sharing options...
Guest Posted March 26, 2005 Share Posted March 26, 2005 I've spent a few more hours on this, with no luck other than confirming that the problem is due to $faqPath not being set. Anyone know what $faqPath is supposed to be set to? Or maybe what we can hard code in to at least get the top categories to display? Quote Link to comment Share on other sites More sharing options...
osjunkie Posted April 1, 2005 Share Posted April 1, 2005 Just wondering if someone could help me figure out how to alter the order of the question list. Currently it has the date then the question and I want to switch it around. What are the files and code I have to change? /modules/faqdesk/faqdesk_listing.php? <?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="pageHeading"><?php echo TABLE_HEADING_TOPICS; ?></td> </tr> <tr> <td> </td> </tr> <tr> <?php $listing_numrows_sql = $listing_sql; // $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_FAQDESK_SEARCH_RESULTS, '*', $HTTP_GET_VARS['page']); $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_FAQDESK_SEARCH_RESULTS, 'p.faqdesk_id'); // fix counted faqs $listing_numrows = tep_db_query($listing_numrows_sql); $listing_numrows = tep_db_num_rows($listing_numrows); if ($listing_numrows > 0 && (FAQDESK_PREV_NEXT_BAR_LOCATION == '1' || FAQDESK_PREV_NEXT_BAR_LOCATION == '3')) { ?> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"> <?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_ARTICLES); ?> </td> <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_FAQDESK_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> <?php } ?> <tr> <td> <?php $list_box_contents = array(); $list_box_contents[] = array('params' => 'class="productListing-heading"'); $cur_row = sizeof($list_box_contents) - 1; $cl_size = sizeof($column_list); for ($col=0; $col<$cl_size; $col++) { switch ($column_list[$col]) { case 'FAQDESK_QUESTION': $lc_text = TABLE_HEADING_ARTICLE_NAME; $lc_align = 'left'; break; case 'FAQDESK_DATE_AVAILABLE': $lc_text = TABLE_HEADING_DATE_AVAILABLE; $lc_align = 'left'; break; case 'FAQDESK_ANSWER_SHORT': $lc_text = TABLE_HEADING_ARTICLE_SHORTTEXT; $lc_align = 'left'; break; case 'FAQDESK_ANSWER_LONG': $lc_text = TABLE_HEADING_ARTICLE_DESCRIPTION; $lc_align = 'left'; break; case 'FAQDESK_EXTRA_URL': $lc_text = TABLE_HEADING_ARTRICLE_URL; $lc_align = 'left'; break; case 'FAQDESK_EXTRA_URL_NAME': $lc_text = TABLE_HEADING_ARTRICLE_URL_NAME; $lc_align = 'left'; break; } // -------------------------------------------------------------------------------------------------------------------------------------------- // turn off links -- dummy value is set at "FAQDESK_ARTICLE_URL" since I want to keep all the links active // -------------------------------------------------------------------------------------------------------------------------------------------- if ($column_list[$col] != 'FAQDESK_ARTICLE_URL' && $column_list[$col] ) $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); $list_box_contents[$cur_row][] = array( 'align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => " " . $lc_text . " " ); } // -------------------------------------------------------------------------------------------------------------------------------------------- if ($listing_numrows > 0) { /* $number_of_faqs = '0'; $listing = tep_db_query($listing_sql); while ($listing_values = tep_db_fetch_array($listing)) { $number_of_faqs++; */ $number_of_products = '0'; $listing_query = tep_db_query($listing_split->sql_query); while ($listing_values = tep_db_fetch_array($listing_query)) { $number_of_products++; if ( ($number_of_products/2) == floor($number_of_products/2) ) { // if ( ($number_of_faqs/2) == floor($number_of_faqs/2) ) { $list_box_contents[] = array('params' => 'class="productListing-even"'); } else { $list_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($list_box_contents) - 1; $cl_size = sizeof($column_list); for ($col=0; $col<$cl_size; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'FAQDESK_QUESTION': $lc_text = ' <a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') . 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_question'] . '</a> '; break; case 'FAQDESK_DATE_AVAILABLE': $lc_text = ' <a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') . 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_date_added'] . '</a> '; break; case 'FAQDESK_ANSWER_LONG': $lc_text = ' <a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') . 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_answer_long'] . '</a> '; break; case 'FAQDESK_EXTRA_URL': $lc_text = ' <a href="' . tep_href_link(FILENAME_NEWSDESK_INFO, ($newsPath ? 'newsPath=' . $newsPath . '&' : '') . 'newsdesk_id=' . $listing_values['newsdesk_id']) . '">' . $listing_values['newsdesk_article_url'] . '</a> '; break; case 'FAQDESK_EXTRA_URL_NAME': $lc_text = ' <a href="' . tep_href_link(FILENAME_NEWSDESK_INFO, ($newsPath ? 'newsPath=' . $newsPath . '&' : '') . 'newsdesk_id=' . $listing_values['newsdesk_id']) . '">' . $listing_values['newsdesk_article_url_name'] . '</a> '; break; case 'FAQDESK_ANSWER_SHORT': $lc_text = ' <a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') . 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_answer_short'] . '</a> '; break; } $list_box_contents[$cur_row][] = array( 'align' => $lc_align, 'params' => 'class="productListing-data"', 'text' => $lc_text ); } } new tableBox($list_box_contents, true); echo '</td>' . "\n"; echo '</tr>' . "\n"; } else { ?> <tr class="productListing-odd"> <td class="smallText"> <?php echo TEXT_NO_ARTICLES ?> </td> </tr> <?php } ?> <tr> <td> </td> </tr> <?php if ($listing_numrows > 0 && (FAQDESK_PREV_NEXT_BAR_LOCATION == '1' || FAQDESK_PREV_NEXT_BAR_LOCATION == '3')) { ?> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"> <?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_ARTICLES); ?> </td> <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_FAQDESK_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td> </tr> </table> </td> </tr> <?php } ?> </table> <?php /* osCommerce, Open Source E-Commerce Solutions ---- http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License IMPORTANT NOTE: This script is not part of the official osC distribution but an add-on contributed to the osC community. Please read the NOTE and INSTALL documents that are provided with this file for further information and installation notes. script name: FAQDesk version: 1.01.0 date: 22-06-2004 (dd/mm/yyyy) original author: Carsten aka moyashi web site: www..com modified code by: Wolfen aka 241 */ ?> Much thanks in advanced. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 5, 2005 Share Posted April 5, 2005 The bad news is that I was completely off base on why the categories were not displaying in the categories box. The good news is that I discovered the fix, and it's easy! :D Find this code (line 133 in my file): new infoBoxHeading($faqdesk_box_contents, false, false); $categories_faqdesk_string = ''; $categories_faqdesk_query = tep_db_query( "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.catagory_status = '1' and c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name" ); while ($categories_faqdesk = tep_db_fetch_array($categories_faqdesk_query)) { $foo_faqdesk[$categories_faqdesk['categories_id']] = array( 'name' => $categories_faqdesk['categories_name'], 'parent' => $categories_faqdesk['parent_id'], 'level' => 0, 'path' => $categories_faqdesk['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo_faqdesk[$prev_id]['next_id'] = $categories_faqdesk['categories_id']; } $prev_id = $categories_faqdesk['categories_id']; if (!isset($counter)) { $counter = $categories_faqdesk['categories_id']; } } and replace it with this code: new infoBoxHeading($faqdesk_box_contents, false, false); $categories_faqdesk_string = ''; $counter = 0; $categories_faqdesk_query = tep_db_query( "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.catagory_status = '1' and c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name" ); while ($categories_faqdesk = tep_db_fetch_array($categories_faqdesk_query)) { $foo_faqdesk[$categories_faqdesk['categories_id']] = array( 'name' => $categories_faqdesk['categories_name'], 'parent' => $categories_faqdesk['parent_id'], 'level' => 0, 'path' => $categories_faqdesk['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo_faqdesk[$prev_id]['next_id'] = $categories_faqdesk['categories_id']; } $prev_id = $categories_faqdesk['categories_id']; if (!$counter) { $counter = $categories_faqdesk['categories_id']; } } There are only two changes: 1. add $counter = 0; at the top of the code in the init portion. 2. change the if (!isset($counter)) to if (!$counter) What I figured out finally by studying the code is that $counter is used as an index into arrays; I had assumed that in PHP an uninitialized variable would have a value of zero in that use. However, it appears not and by forcing it to be initialized to zero the code then works. (The "faqpath" not being set is correct at the index page, it will be set if you go to a category, when it would list subcategories in the box). Hopefully this fix works for everyone! Quote Link to comment Share on other sites More sharing options...
Spaceboy Posted May 14, 2005 Share Posted May 14, 2005 Hi people, I'm upgrading my previous FAQdesk system (that didn't work with MS2.2) to the latest version 1.01.1. Once up and running, I will publish a new version v1.1 with all bug fixes for images, category box, tep_array_reverse, stylesheet, sprintf error, etc. This contrib has some weird coding but it does the job. Stay tuned here for more info in a couple of days. Didier. Quote Published modified Contributions Link to comment Share on other sites More sharing options...
billi Posted May 21, 2005 Share Posted May 21, 2005 2. change the if (!isset($counter)) to if (!$counter) There is unfortunately a small error in it. It must mean if ($counter) { and not if (!$counter) { . Unfortunately there is however still an error sees to screen SHOT. Someone has a Bugfix for it. cu billi Quote My English is unfortunately bad. Excused ask. Link to comment Share on other sites More sharing options...
billi Posted May 21, 2005 Share Posted May 21, 2005 Here is the Code from my faqdesk.php Box <?php // set application wide parameters // this query set is for FAQDesk $configuration_query = tep_db_query("select configuration_key as cfgKey, configuration_value as cfgValue from " . TABLE_FAQDESK_CONFIGURATION . ""); while ($configuration = tep_db_fetch_array($configuration_query)) { define($configuration['cfgKey'], $configuration['cfgValue']); } if ( DISPLAY_FAQS_CATAGORY_BOX ) { $do_we_have_categories_faq_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.catagory_status = '1' and c.parent_id = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); $faqdesk_check = tep_db_num_rows($do_we_have_categories_faq_query); if ($faqdesk_check > 0) { // ------------------------------------------------------------------------------------------------------------------------------------------------------------- // Return true if the category has subcategories // TABLES: categories function FAQDesk_box_has_category_subcategories($category_id) { $child_faqdesk_category_query = tep_db_query("select count(*) as count from " . TABLE_FAQDESK_CATEGORIES . " where parent_id = '" . $category_id . "'"); $child_category = tep_db_fetch_array($child_faqdesk_category_query); if ($child_category['count'] > 0) { return true; } else { return false; } } // ------------------------------------------------------------------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------------------------------------------------------------------- // Return the number of products in a category // TABLES: products, products_to_categories, categories function FAQDesk_box_count_products_in_category($category_id, $include_inactive = false) { $products_faqdesk_count = 0; if ($include_inactive) { $products_faqdesk_faqdesk_query = tep_db_query("select count(*) as total from " . TABLE_FAQDESK . " p, " . TABLE_FAQDESK_TO_CATEGORIES . " p2c where p.faqdesk_id = p2c.faqdesk_id and p2c.categories_id = '" . $category_id . "'"); } else { $products_faqdesk_faqdesk_query = tep_db_query("select count(*) as total from " . TABLE_FAQDESK . " p, " . TABLE_FAQDESK_TO_CATEGORIES . " p2c where p.faqdesk_id = p2c.faqdesk_id and p.faqdesk_status = '1' and p2c.categories_id = '" . $category_id . "'"); } $products_faqdesk = tep_db_fetch_array($products_faqdesk_faqdesk_query); $products_faqdesk_count += $products_faqdesk['total']; if (USE_RECURSIVE_COUNT == 'true') { $child_categories_query = tep_db_query("select categories_id from " . TABLE_FAQDESK_CATEGORIES . " where parent_id = '" . $category_id . "'"); if (tep_db_num_rows($child_categories_query)) { while ($child_categories = tep_db_fetch_array($child_categories_query)) { $products_faqdesk_count += FAQDesk_box_count_products_in_category($child_categories['categories_id'], $include_inactive); } } } return $products_faqdesk_count; } // ------------------------------------------------------------------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------------------------------------------------------------------- function FAQDesk_show_category($counter) { // ------------------------------------------------------------------------------------------------------------------------------------------------------------- global $foo_faqdesk, $categories_faqdesk_string, $id; for ($a=0; $a<$foo_faqdesk[$counter]['level']; $a++) { $categories_faqdesk_string .= " "; } $categories_faqdesk_string .= '<a href="'; if ($foo_faqdesk[$counter]['parent'] == 0) { $faqPath_new = 'faqPath=' . $counter; } else { $faqPath_new = 'faqPath=' . $foo_faqdesk[$counter]['path']; } $categories_faqdesk_string .= tep_href_link(FILENAME_FAQDESK_INDEX, $faqPath_new); $categories_faqdesk_string .= '">'; if ( ($id) && (in_array($counter, $id)) ) { $categories_faqdesk_string .= '<b>'; } // display category name $categories_faqdesk_string .= $foo_faqdesk[$counter]['name']; if ( ($id) && (in_array($counter, $id)) ) { $categories_faqdesk_string .= '</b>'; } if (FAQDesk_box_has_category_subcategories($counter)) { $categories_faqdesk_string .= '->'; } $categories_faqdesk_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_faqdesk_in_category = FAQDesk_box_count_products_in_category($counter); if ($products_faqdesk_in_category > 0) { $categories_faqdesk_string .= ' (' . $products_faqdesk_in_category . ')'; } } $categories_faqdesk_string .= '<br>'; if ($foo_faqdesk[$counter]['next_id']) { FAQDesk_show_category($foo_faqdesk[$counter]['next_id']); } } // ------------------------------------------------------------------------------------------------------------------------------------------------------------- ?> <!-- categories //--> <tr> <td> <?php $faqdesk_box_contents = array(); $faqdesk_box_contents[] = array( 'align' => 'left', 'text' => BOX_HEADING_FAQDESK_CATEGORIES ); new infoBoxHeading($faqdesk_box_contents, false, false); $categories_faqdesk_string = ''; $counter = 0; $categories_faqdesk_query = tep_db_query( "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.catagory_status = '1' and c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name" ); while ($categories_faqdesk = tep_db_fetch_array($categories_faqdesk_query)) { $foo_faqdesk[$categories_faqdesk['categories_id']] = array( 'name' => $categories_faqdesk['categories_name'], 'parent' => $categories_faqdesk['parent_id'], 'level' => 0, 'path' => $categories_faqdesk['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo_faqdesk[$prev_id]['next_id'] = $categories_faqdesk['categories_id']; } $prev_id = $categories_faqdesk['categories_id']; if ($counter) { $counter = $categories_faqdesk['categories_id']; } } //------------------------ if ($faqPath) { $new_path = ''; $id = split('_', $faqPath); reset($id); while (list($key, $value) = each($id)) { unset($prev_id); unset($first_id); $categories_faqdesk_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.catagory_status = '1' and c.parent_id = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); $category_faqdesk_check = tep_db_num_rows($categories_faqdesk_query); if ($category_faqdesk_check > 0) { $new_path .= $value; while ($row = tep_db_fetch_array($categories_faqdesk_query)) { $foo_faqdesk[$row['categories_id']] = array( 'name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo_faqdesk[$prev_id]['next_id'] = $row['categories_id']; } $prev_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $foo_faqdesk[$last_id]['next_id'] = $foo_faqdesk[$value]['next_id']; $foo_faqdesk[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } FAQDesk_show_category($counter); $faqdesk_box_contents = array(); $faqdesk_box_contents[] = array( 'align' => 'left', 'text' => $categories_faqdesk_string ); new infoBox($faqdesk_box_contents); ?> </td> </tr> <!-- categories_eof //--> <?php } } else { } ?> <?php /* osCommerce, Open Source E-Commerce Solutions ---- http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License IMPORTANT NOTE: This script is not part of the official osC distribution but an add-on contributed to the osC community. Please read the NOTE and INSTALL documents that are provided with this file for further information and installation notes. script name: FAQDesk version: 1.0 date: 2003-03-27 author: Carsten aka moyashi web site: www..com */ ?> thx billi Quote My English is unfortunately bad. Excused ask. Link to comment Share on other sites More sharing options...
Guest Posted May 25, 2005 Share Posted May 25, 2005 There is unfortunately a small error in it. It must mean if ($counter) { and not if (!$counter) { . Unfortunately there is however still an error sees to screen SHOT. Someone has a Bugfix for it. cu billi <{POST_SNAPBACK}> No, that needs to be !$counter , or if you want to make it more readable, $counter==0 See next post Quote Link to comment Share on other sites More sharing options...
Guest Posted May 25, 2005 Share Posted May 25, 2005 Here is the Code from my faqdesk.php Box $counter = 0; $categories_faqdesk_query = tep_db_query(...); while ($categories_faqdesk = tep_db_fetch_array($categories_faqdesk_query)) { $foo_faqdesk[$categories_faqdesk['categories_id']] = array(...); if ($counter) $counter = $categories_faqdesk['categories_id']; } <{POST_SNAPBACK}> This code is incorrect, let's follow the logic: 1. What is the purpose of $counter ? This variable should really have been called $category_id (and is in some of the functions, just not the main code or function). That's because $counter is holding the topmost category id for the box display. 2. What is the code doing at the point of your change? The code checks to see if $counter has been set yet, and if not sets it to the first found category. Your change has the code check to see if $counter has been set and if so sets it! Thus, your code will never set $counter to any value, because the check will always fail! To summarize, your change caused $counter to never be set! This change should cause the box display to contain no items. And, if $counter had been set at any point your change would have caused it to always be set to the last item found because it would be set every time through the while loop. However, this has been a good exercise, because it caused me to realize that my small mod could have been written to work on more installations because if the check doesn't find a match, it will use category ID zero, which should never exist. So we should add an extra check after the while loop like so: // If we didn't find a match, set our category ID to the most likely topmost value if($counter==0) $counter=1; Why have this and not set $counter to 1 to start with? Because then we'd have to modify the check to say ==1 and in most installations you would end up skipping the first category because it's also ==1. On my store this removed the top 2 categories from my box! Note the comment (I wish more PHP programmers would comment their code!) - we are guessing that 1 is the most likely topmost category ID for the store if no other candidate is found in the while loop. I can't think of any scenario where the while loop should fail, but it's good to be sure. So, here is the entire new code where $counter is setup (I don't post my entire file because it's heavily modified in other areas, like for BTS): $counter = 0; $categories_faqdesk_query = tep_db_query( "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, " . TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.catagory_status = '1' and c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name" ); while ($categories_faqdesk = tep_db_fetch_array($categories_faqdesk_query)) { $foo_faqdesk[$categories_faqdesk['categories_id']] = array( 'name' => $categories_faqdesk['categories_name'], 'parent' => $categories_faqdesk['parent_id'], 'level' => 0, 'path' => $categories_faqdesk['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo_faqdesk[$prev_id]['next_id'] = $categories_faqdesk['categories_id']; } $prev_id = $categories_faqdesk['categories_id']; if ($counter==0) { $counter = $categories_faqdesk['categories_id']; } } // If we didn't find a match, set our category ID to the most likely topmost value if($counter==0) $counter=1; Quote Link to comment Share on other sites More sharing options...
Guest Posted May 25, 2005 Share Posted May 25, 2005 There is unfortunately a small error in it. It must mean if ($counter) { and not if (!$counter) { . Unfortunately there is however still an error sees to screen SHOT. Someone has a Bugfix for it. <{POST_SNAPBACK}> I wanted to make sure I pointed out that your problem with only getting the '->' in the categories box is the direct result of your modification! Since your mod guarantees that $counter is never set, $counter will always be zero which matches no categories so the display function has nothing to display. Quote Link to comment Share on other sites More sharing options...
billi Posted May 25, 2005 Share Posted May 25, 2005 @lane Big THX. It is running... :thumbsup: cu billi Quote My English is unfortunately bad. Excused ask. Link to comment Share on other sites More sharing options...
ACE99 Posted June 7, 2005 Share Posted June 7, 2005 When I try to click on a subcategory or try and search for a faq, I keep getting the following error (this happens on the catalog side): 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 0, 20' at line 1 select pd.faqdesk_answer_long, pd.faqdesk_answer_short, p.products_id, pd.products_info, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '60' order by limit 0, 20 What could be wrong? Quote Link to comment Share on other sites More sharing options...
Kristofor Posted September 1, 2005 Share Posted September 1, 2005 (edited) does anyone kno why there are places that still TEXT_FAQDESK_READMORE?? Edited September 1, 2005 by Kristofor Quote Don't die with the music in you!!! Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere... Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.