Jump to content
Sign in to follow this  
keoga

FAQ system contribution

Recommended Posts

Ah gotcha, I am running php4. Decided not to upgrade to 5.

 

It would be nice to be able to edit and insert from the admin side. I guess as long as I can manually enter the info through the DB I guess that will work for now.

 

It's just really weird that those buttons just refresh and don't open anything.

 

 

BTW I know why you were not able to checkout on my site the other day. I didn't have the proper zones set but also it has to be within the USA as well.


Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Share this post


Link to post
Share on other sites
Ah gotcha, I am running php4. Decided not to upgrade to 5.

 

It would be nice to be able to edit and insert from the admin side. I guess as long as I can manually enter the info through the DB I guess that will work for now.

 

It's just really weird that those buttons just refresh and don't open anything.

BTW I know why you were not able to checkout on my site the other day. I didn't have the proper zones set but also it has to be within the USA as well.

Thanks for letting me know about the checkout problem.

 

FAQ System should work from the admin without any hassle. I had the trouble you describe on my test site when I did not have the configure.php quite right and I had not done the payment modules fix for osc.

If you want, I can start posting files?


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Yea if you could that would be great.


Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Share this post


Link to post
Share on other sites
Yea if you could that would be great.

admin\faq_manager.php Let me know

<?php
/*
 FAQ system for OSC 2.2 MS2 v2.1  22.02.2005
 Originally Created by: [url="http://adgrafics.com"]http://adgrafics.com[/url] admin@adgrafics.net
 Updated by: [url="http://www.webandpepper.ch"]http://www.webandpepper.ch[/url] osc@webandpepper.ch v2.0 (03.03.2004)
 Last Modified: [url="http://shopandgo.caesium55.com"]http://shopandgo.caesium55.com[/url] timmhaas@web.de v2.1 (22.02.2005)
 Released under the GNU General Public License
 osCommerce, Open Source E-Commerce Solutions
 Copyright © 2004 osCommerce
*/

 require('includes/application_top.php');
 require(DIR_WS_LANGUAGES . $language . '/faq.php');
 require(DIR_WS_FUNCTIONS . '/faq.php');

?>
<!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 FAQ_SYSTEM; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</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%">
<?php

switch($faq_action) {

 case "Added":
$data = browse_faq($language,$HTTP_GET_VARS);
$no = 1;
if (sizeof($data) > 0) {
  while (list($key, $val) = each($data)) {
  	$no++;
  }
};
$title = FAQ_ADD . ' #' . $no;
echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=AddSure');
include('faq_form.php');
 break;

 case "AddSure":
function add_faq ($data) {
  $query = "INSERT INTO " . TABLE_FAQ . " VALUES(null, '$data[visible]', '$data[v_order]', '$data[question]', '$data[answer]', NOW(''),'$data[faq_language]')";
  tep_db_query($query);
  unset($HTTP_POST_VARS);
}
if ($v_order && $answer && $question) {
  if ((INT)$v_order) {
	add_faq($HTTP_POST_VARS);
	$data = browse_faq($language,$HTTP_GET_VARS);
	$title = FAQ_CREATED . ' ' . FAQ_ADD_QUEUE . ' ' . $v_order;
	include('faq_list.php');
  } else {
  	$error = 20;
  }
} else {
  $error = 80;
}
 break;

 case "Edit":
if ($faq_id) {
  $edit = read_data($faq_id);
  $data = browse_faq($language,$HTTP_GET_VARS);
  $button = array("Update");
  $title = FAQ_EDIT_ID . ' ' . $faq_id;
  echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=Update');
  echo tep_draw_hidden_field('faq_id', $faq_id);
  include('faq_form.php');
} else {
  $error = 80;
}
 break;

 case "Update":
function update_faq ($data) {
  tep_db_query("UPDATE " . TABLE_FAQ . " SET question='$data[question]', answer='$data[answer]', visible='$data[visible]', v_order=$data[v_order], date = now() WHERE faq_id=$data[faq_id]");
}
if ($faq_id && $question && $answer && $v_order) {
  if ((INT)$v_order) {
	update_faq($HTTP_POST_VARS);
	$data = browse_faq($language,$HTTP_GET_VARS);
	$title = FAQ_UPDATED_ID . ' ' . $faq_id;
	include('faq_list.php');
  } else {
  	$error = 20;
  } 
} else {
  $error = 80;
}
 break;

 case 'Visible':
function tep_set_faq_visible($faq_id, $HTTP_GET_VARS) {
  if ($HTTP_GET_VARS['visible'] == 1) {
	return tep_db_query("update " . TABLE_FAQ . " set visible = '0', date = now() where faq_id = '" . $faq_id . "'");
  } else{
	return tep_db_query("update " . TABLE_FAQ . " set visible = '1', date = now() where faq_id = '" . $faq_id . "'");
  } 
}
tep_set_faq_visible($faq_id, $HTTP_GET_VARS);
$data = browse_faq($language,$HTTP_GET_VARS);
if ($HTTP_GET_VARS['visible'] == 1) {
  $vivod = FAQ_DEACTIVATED_ID;
} else {
  $vivod = FAQ_ACTIVATED_ID;
}
$title = $vivod . ' ' . $faq_id;
include('faq_list.php');
 break;

 case "Delete":
if ($faq_id) {
  $delete = read_data($faq_id);
  $data = browse_faq($language,$HTTP_GET_VARS);
  $title = FAQ_DELETE_CONFITMATION_ID . ' ' . $faq_id;
  echo '
  	<tr class="pageHeading"><td>' . $title . '</td></tr>
  	<tr><td class="dataTableContent"><b>' . FAQ_QUESTION . ':</b></td></tr>
  	<tr><td class="dataTableContent">' . $delete[question] . '</td></tr>
  	<tr><td class="dataTableContent"><b>' . FAQ_ANSWER . ':</b></td></tr>
  	<tr><td class="dataTableContent">' . $delete[answer] . '</td></tr>
  	<tr><td align="right">
  ';
  echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=DelSure&faq_id='.$val[faq_id]);
  echo tep_draw_hidden_field('faq_id', $faq_id);
  echo tep_image_submit('button_delete.gif', IMAGE_DELETE);
  echo '<a href="' . tep_href_link(FILENAME_FAQ_MANAGER, '', 'NONSSL') . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
  echo '</form></td></tr>';
} else {
  $error = 80;
}
 break;


 case "DelSure":
function delete_faq ($faq_id) {
  tep_db_query("DELETE FROM " . TABLE_FAQ . " WHERE faq_id=$faq_id");
}
if ($faq_id) {
  delete_faq($faq_id);
  $data = browse_faq($language,$HTTP_GET_VARS);
  $title = FAQ_DELETED_ID . ' ' . $faq_id;
  include('faq_list.php');
} else {
  $error = 80;
}
 break;


 default:
$data = browse_faq($language,$HTTP_GET_VARS);
$title = FAQ_MANAGER;
include('faq_list.php');
 break;
}

if ($error) {
 $content = error_message($error);
 echo $content;
 $data = browse_faq($language,$HTTP_GET_VARS);
 $no = 1;
 if (sizeof($data) > 0) {
 	while (list($key, $val) = each($data)) {
 	  $no++; 
 	}
 };
 $title = FAQ_ADD_QUEUE . ' ' . $no;
 echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=AddSure');
 include('faq_form.php');
}
?>
</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'); ?>


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Nope still does it.


Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Share this post


Link to post
Share on other sites
Nope still does it.

OK, admin/includes/functions/faq.php

<?php
/*
 FAQ system for OSC 2.2 MS2 v2.1  22.02.2005
 Originally Created by: [url="http://adgrafics.com"]http://adgrafics.com[/url] admin@adgrafics.net
 Updated by: [url="http://www.webandpepper.ch"]http://www.webandpepper.ch[/url] osc@webandpepper.ch v2.0 (03.03.2004)
 Last Modified: [url="http://shopandgo.caesium55.com"]http://shopandgo.caesium55.com[/url] timmhaas@web.de v2.1 (22.02.2005)
 Released under the GNU General Public License
 osCommerce, Open Source E-Commerce Solutions
 Copyright © 2004 osCommerce
*/

 function faq_toc ($language) {
static $old_faq_id;

if ($old_faq_id) {
  $exclude = explode("&", $old_faq_id);
  while (list($dummy,$old_id) = each($exclude)) {
	if ($old_id) {
	  $query .= 'faq_id != ' . $old_id . ' AND ';
	  unset($old_id);
	}
  }
}
$result = tep_db_fetch_array(tep_db_query("SELECT faq_id, question FROM " . TABLE_FAQ . " WHERE $query visible='1' AND language = '$language' ORDER BY v_order asc"));
if ($result['faq_id']) {
  $old_faq_id .= $result['faq_id'] . '&';
  $result['toc'] = '<a href="' . tep_href_link(FILENAME_FAQ_VIEW_ALL,'#' . $result['faq_id']) . '"><b>' . $result['question'] . '</b></a>';
}
return $result;
 }

 function read_faq ($language) {
static $old_faq_id;

if ($old_faq_id) {
  $exclude = explode("&", $old_faq_id);
  while (list($dummy,$old_id) = each($exclude)) {
	if ($old_id) {
	  $query .= 'faq_id != ' . $old_id . ' AND ';
	  unset($old_id);
	}
  }
}
$result = tep_db_fetch_array(tep_db_query("SELECT faq_id, question, answer FROM " . TABLE_FAQ . " WHERE $query visible='1' AND language = '$language' ORDER BY v_order asc"));
if ($result['faq_id']) {
  $old_faq_id .= $result['faq_id'] . '&';
  $result['faq'] = '<b><span id="' . $result['faq_id'] . '">' . $result['question'] . '</span></b><br>' . $result['answer'];
}
   return $result;
 }

function browse_faq ($language,$HTTP_GET_VARS) {
  if ($HTTP_GET_VARS['faq_lang'] != '') {
  	$query_lang = "WHERE language = '$HTTP_GET_VARS[faq_lang]'";
  } elseif ($HTTP_GET_VARS['faq_action'] == 'Added') {
  	$query_lang = "WHERE language = '$language'";
  }
  $query = "SELECT *, DATE_FORMAT(date, '%d.%m.%y') AS d FROM " . TABLE_FAQ . " $query_lang ORDER BY v_order";
  $daftar = tep_db_query($query);
  $c=0;
  while ($buffer = tep_db_fetch_array($daftar)) {
  	$result[$c] = $buffer;
  	$c++;
  }
  return $result;
}

function read_data ($faq_id) {
  $result = tep_db_fetch_array(tep_db_query("SELECT * FROM " . TABLE_FAQ . " WHERE faq_id=$faq_id"));
  return $result;
}

function error_message($error) {
  switch ($error) {
	case "20":
	  return '<tr class=messageStackError><td>' . tep_image(DIR_WS_IMAGES . 'icons/warning.gif', FAQ_WARNING) . ' ' . FAQ_ERROR_20 . '</td></tr>';
	  break;
	case "80":
	  return '<tr class=messageStackError><td>' . tep_image(DIR_WS_IMAGES . 'icons/warning.gif', FAQ_WARNING) . ' ' . FAQ_ERROR_80 . '</td></tr>';
	  break;
	default:
	  return $error;
  }
}

?>


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Which version did you use?

 

If we are using the same version then your files should be the same correct?


Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Share this post


Link to post
Share on other sites
Which version did you use?

 

If we are using the same version then your files should be the same correct?

2.1 something, I didn't really take much notice of the version. I also can't find my install files because I lost a lot of info when my storage hard disk crashed.

Howver, I do know that mines works on php 4 and 5. There aren't many files involved, and check this:

admin/includes/database_tables.php:

-----------------------------------

// FAQ SYSTEM 2.1

 

define('TABLE_FAQ', 'faq');

 

// FAQ SYSTEM 2.1


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Yea that is the same version I am using and I just double checked the installation and everything that was suppose to be pasted into those files were there. Not sure why it wont let me edit, delete, or insert new entries.


Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Share this post


Link to post
Share on other sites
Yea that is the same version I am using and I just double checked the installation and everything that was suppose to be pasted into those files were there. Not sure why it wont let me edit, delete, or insert new entries.

Very odd. You obviously don't receive error messages.

Does FAQ View and FAQ View All work in Admin?


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Hi, I have the exact same problem as Silverado05, I have no errors but I can't edit nor add new FAQs, those buttons just refresh and don't open anything.

Share this post


Link to post
Share on other sites

Hi

 

I have installed the FAQ System 3.0 constribution and tripple checked that I have done everything the install file says you should do on the admin side but when i click any of the links only a blank page shows up... Inserted som echos in the faq_manager.php file to see where it went wrong and it is when it includes functions/faq.php

 

require(DIR_WS_FUNCTIONS . '/faq.php');

 

 

it gets stuck. Have compared the 2.x faq.php with the 3.0 one and they are exactly the same, the faq_manager.php files are also the same.

 

Anyone had a similar problem and knows how to solve it?

 

/Rob

Edited by robfor

Share this post


Link to post
Share on other sites

I'm using version 3.0. Installed it from the straight-forward instructions but as above..you click the edit or delete icons in admin and nothing happens, no edit, no delete.

 

Has anyone solved this yet? Does the admin edit and delete actually work for anyone?

 

Ross

Share this post


Link to post
Share on other sites
I'm using version 3.0. Installed it from the straight-forward instructions but as above..you click the edit or delete icons in admin and nothing happens, no edit, no delete.

 

Has anyone solved this yet? Does the admin edit and delete actually work for anyone?

 

Ross

Maybe it is related to the OSC version installed. Don't see what else it can be.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

just installed the 3.0 version and this is working fine! I really love that contrib!! will be really helpful! Chers for that to the creators!

Share this post


Link to post
Share on other sites
I'm using version 3.0. Installed it from the straight-forward instructions but as above..you click the edit or delete icons in admin and nothing happens, no edit, no delete.

 

Has anyone solved this yet? Does the admin edit and delete actually work for anyone?

 

Ross

 

I installed FAQ System 3.0 and had the problem you mentioned as well. I fixed the problem and post it in the contribution. You can try to see if it works. It is working for me now.

 

http://addons.oscommerce.com/info/1948

Share this post


Link to post
Share on other sites

I have installed the addon (triple checked) but my "Information" box just dissappears totally. I really mean the whole box, rather than just the FAQ link. The admin side of things seems to be working although I cant say for sure as the customer output is not there.

I think the problem might be that I already have another Information page and that those maybe conflict after I installed the FAQ?

 

In any case I would prefer the link to be the lowest link in the "Categories box". Do I achieve this by adding:

  '<a href="' . tep_href_link(FILENAME_FAQ) . '">' . BOX_INFORMATION_FAQ . '</a><br>' .

somewhere in the categories.php?

 

I am a total php newbie and can only follow step by step instructions. If something goes wrong I dont even know where to start, so please bear with me :)

 

I have php 4.4 /Apache 2.0

 

Please do not hesitate to ask for any further info that would help!


Open Source Newsletter: PhPList

Open Source Questionnaire: Lime Survey

Share this post


Link to post
Share on other sites

Do you mean you want it to display as a product?

 

The contrib is designed to be installed in an information box (much easier).


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
The contrib is designed to be installed in an information box (much easier).

 

I get that, I would just prefer it in the Categories box. Still, failing tis due to difficulty I would be happy with it appearing in the Information box.

As you can see here: Wormstore

 

I have 2 Information Boxes. Could that be the reason it doesnt work? I am sure I followed the instructions to the letter but all that happens is that the whole original(standard) information box disaapears while the FAQ system managers appears in the admin interface.

 

BTW the additional box is the same that doesnt seem to work properly either as you have read here: InfoBox

Edited by NewBudda

Open Source Newsletter: PhPList

Open Source Questionnaire: Lime Survey

Share this post


Link to post
Share on other sites
I get that, I would just prefer it in the Categories box. Still, failing tis due to difficulty I would be happy with it appearing in the Information box.

As you can see here: Wormstore

 

I have 2 Information Boxes. Could that be the reason it doesnt work? I am sure I followed the instructions to the letter but all that happens is that the whole original(standard) information box disaapears while the FAQ system managers appears in the admin interface.

 

BTW the additional box is the same that doesnt seem to work properly either as you have read here: InfoBox

Put it in the original osc info box (the one in the right column).

 

The extra pages info box works very well for me.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Put it in the original osc info box (the one in the right column).

Thats what I tried originally. It just made the whole box disappear.

 

The extra pages info box works very well for me.

I am very happy for you, but that doesnt really help me. I am sure the Contribution as such works. I am just concerned there might be a conflict issue that I cant recognise...


Open Source Newsletter: PhPList

Open Source Questionnaire: Lime Survey

Share this post


Link to post
Share on other sites
Put it in the original osc info box (the one in the right column).

Thats what I tried originally. It just made the whole box disappear.

 

The extra pages info box works very well for me.

I am very happy for you, but that doesnt really help me. I am sure the Contribution as such works. I am just concerned there might be a conflict issue that I cant recognise...

If you post your code for the disappearing box, we can see if we can get it to work for you.

 

There is no conflict.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

So sorry, I did not want to sound so touchy. I was very tired and didnt check how that sounded.

 

I will get back about the prob after I solved my link issue graphics linked.

 

Thank you for your patience, i DO appreciate it!


Open Source Newsletter: PhPList

Open Source Questionnaire: Lime Survey

Share this post


Link to post
Share on other sites

Can anyone tell me if the FAQ System has the capability for creating different categories for faq's?

 

I am looking for the capability to have several groups of questions each grouped under different FAQ categories.

 

For example: General Questions, Wholesale FAQ, Shipping FAQ, etc.

 

Thanks!!

Randy

Share this post


Link to post
Share on other sites

I would like that also, but the best solution so far seem to install multiple versions of it. I have not done this though and assume it might cause conflicts in the database.


Open Source Newsletter: PhPList

Open Source Questionnaire: Lime Survey

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×