Jump to content
Latest News: (loading..)

Recommended Posts

This addon provides a FAQ page for any shop that is able to install addons via the modules content section. All of the FAQ's are handled in the admin. This version is compatible with any oscommerce shop that uses modules to load infoboxes in admin (about since V 2.3.1).
                        
This addon is based on the FAQ System addon but has many improvements and security fixes.

Installation only requires one file change.
                      

Share this post


Link to post
Share on other sites

Hi Jack

I had a look at this FAQ app of yours and I got all up and running thus far.
I have no issues adding or editing Questions/Answers in the admin area except for the delete function.
I cannot delete any of the created Questions/Answers. Running this in an Edge test shop.

Share this post


Link to post
Share on other sites

I tried it here in a few shops and it is working. What php version are you using? When you click delete, does the page change to the confirm delete page? Does the url change and have "faq_action=Delete" in it?

Share this post


Link to post
Share on other sites

Thanks for your reply Jack.

The URL does have the "faq_action=Delete"  in it. (.../admin/faq_manager.php?faq_action=Delete&faq_id=3)
Once I click on the X in the listing page I get redirected to the "Delete confirmation" page where the title says for example "Delete Confirmation FAQ ID= 3"
Then on that page when I click the X again I get redirected back to the listing page (faq_manager.php) and the entry, in my example ID=3, is still there.

Running PHP 5.6.31 at the moment.

I did however get 2 error messages after the initial install.
 

Quote

Fatal error: Cannot re-assign auto-global variable _GET in C:\xampp\htdocs\edge1\admin\faq_manager.php on line 104

Quote

Fatal error: Cannot re-assign auto-global variable _GET in C:\xampp\htdocs\edge1\admin\includes\functions\faq.php on line 50

I fixed those by removing the $_GET variables from the lines mentioned in the error messages.

Edited by Tsimi

Share this post


Link to post
Share on other sites

Thanks for mentioning the errors Lambros. It reminded me that I had removing those from the unreleased version. I checked that version and found I had also changed the delete buttons so that is probably the problem you are having. In faq_manager.php, find the following starting around line 135

      //echo tep_image_submit('button_delete.gif', IMAGE_DELETE);
      echo '<a href="' . tep_href_link('faq_manager.php') . '"><i class="fa fa-times dodelete"></i></a>';

and replace them with

      echo tep_image_submit('button_delete.gif', IMAGE_DELETE);
      echo '<a href="' . tep_href_link('faq_manager.php') . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';

 

Share this post


Link to post
Share on other sites
6 hours ago, Jack_mcs said:

I checked that version and found I had also changed the delete buttons so that is probably the problem you are having.

That did the trick. Thanks for the quick support. :thumbsup:
Change mine to this
 

echo tep_draw_button(IMAGE_DELETE);
echo tep_draw_button(IMAGE_CANCEL, NULL, tep_href_link('faq_manager.php', '', 'NONSSL'));

 

Something else, isn't this following line

echo tep_draw_form('faq_manager','faq_manager.php', 'faq_action=DelSure&faq_id='.$val[faq_id]);

suppose to look like this?

echo tep_draw_form('faq_manager','faq_manager.php', 'faq_action=DelSure&faq_id='.$faq_id);

When I look at the form using "Inspect Element" on my Firefox browser the faq_id= within the form is empty but when I change the line from faq_id='.$val[faq_id] to faq_id='.$faq_id the id is passed on and shows fine. However no matter which one I use the FAQ gets deleted correctly so not sure if it is a major issue.

Edited by Tsimi

Share this post


Link to post
Share on other sites

Hi,

I was not able to sucessfully run faq_manager.php in admin. Although I am not an expert, I believe there is an error in function tep_set_faq_visible in admin/faq_manager.php arround line 107:

function tep_set_faq_visible($faq_id, $_GET) {
     if ($_GET['visible'] == 1) {
        return tep_db_query("update faq set visible = '0', date = now() where faq_id = '" . (int)$faq_id . "'");
     } else{
        return tep_db_query("update faq set visible = '1', date = now() where faq_id = '" . (int)$faq_id . "'");
     } 
   }

I modified the code as follows:

   $faq_visible = $_GET['visible'];
   function tep_set_faq_visible($faq_id, $faq_visible) {
     if ($_GET['visible'] == 1) {
        tep_db_query("update faq set visible = '0', date = now() where faq_id = '" . (int)$faq_id . "'");
     } else{
        tep_db_query("update faq set visible = '1', date = now() where faq_id = '" . (int)$faq_id . "'");
     } 
   }

I am not sure why, but this is working for me :-)

Share this post


Link to post
Share on other sites

@TsimiThank you for mentioning the mistake. That code would work in lower versions of php but probably fail in the newer ones.

@luboshshThank you for mentioning that. This addon is based on one that has been around for years and the coding in that was sloppy. I thought I had corrected all of those but see I missed some.

Share this post


Link to post
Share on other sites

A new version has been uploaded with these changes:

  • Added cancel and delete buttons back in.
  • Added commands to remove backslashes on the shops FAQ page.
  • Corrected code for the delete function. Found by member Tismi,
  • Merged a number of functions into the code since they were not needed.
  • Removed the tep_set_faq_visible function. Found by member luboshsh.
  • Removed $_GET from function calls that were left over from the previous addon and no longer needed.

 

Share this post


Link to post
Share on other sites

Hello Jack, using php 7.2  I get the following errors :

Warning: Use of undefined constant faq_lang - assumed 'faq_lang'  in includes/functions/faq.php line 52

Warning: Use of undefined constant v_order - assumed 'v_order' in admin/faq_form. php line 43

Warning: Use of undefined constant visible - assumed 'visible' in admin/faq_form. php on line 54

...any ideas?

Thank you in advance,

Barbie

Share this post


Link to post
Share on other sites

Those are leftover from the original addon that I missed. Here's how to fix them:

Line 52 should be:

$query_lang = "WHERE language = '" . (int)$_GET['faq_lang'] . "'";

Line 43 and 44 should be:

 if ($edit['v_order']) {
  	$no = $edit['v_order']; 

Line 54 should be:

if ($edit['visible']) {

Line 32 should be:

echo $val[v_order] . ', ';

Basically, any [name] should be ['name'] (add apostrophes).

Those checks probably include isset commands but I don't have a test shop set up to test them at the moment. Please try the above changes and let me know how it goes.

Share this post


Link to post
Share on other sites

Hello again Jack,

Merry Christmas§ Sorry, I had an accident and just back back home.

There is another error :

Parse error: syntax error, unexpected '$no' (T_VARIABLE) in /xxxx/xxxx/xxxx/xxxx/admin/faq_form.php on line 47

Can not figure this one out.

Thank you in advance for your help.

 

Barbie

Share this post


Link to post
Share on other sites
21 hours ago, artfulweb said:

I had an accident

I hate it when life gets in the way.  :) Hope you are alreight.

To fix the error, in the file find this line:

echo tep_draw_input_field('v_order', "$no", 'size=3 maxlength=4');

and change it to this (just remove the quotes around $no)

echo tep_draw_input_field('v_order', $no, 'size=3 maxlength=4');

 

Share this post


Link to post
Share on other sites

Yep as you say, "life gets in the way"... crushed vertebra in the back so life is going to be tough. Have to rethink a lot of things.

Thanks so much for the fix. Wishing you a very Happy New Year!

Barbie

Share this post


Link to post
Share on other sites

Hello Jack,

I believe there is a correction to make for PHP 7.2 users to avoid the error message

"Warning: sizeof(): Parameter must be an array or an object that implements Countable in /xxx/xxx/xxx/xxx/admin/faq_manager.php on line 35"

change line 35 from:

     if (sizeof($data) > 0) {

to:
  if (is_array($data) && sizeof($data) > 0) {

 

and the same for the warning 

""Warning: sizeof(): Parameter must be an array or an object that implements Countable in /xxx/xxx/xxx/xxx/admin/faq_form.php on line 30""

on line 30

     if (sizeof($data) > 0) {

to:
  if (is_array($data) && sizeof($data) > 0) {

Hope this helps, it worked for me

 

-Barbie

Share this post


Link to post
Share on other sites

@artfulwebThanks for posting that Barbie. I don't have a test shop setup with 7.2 so I can't test it. But the version of this addon I have here has the following change. If you have the time to bother with it, I would be interested to know if it fixes the issue without your change in? If you want to try it, reverse your changes and then in admin/includes/functions/faq.php fine (around line 58)

     $c = 0;
     while ($buffer = tep_db_fetch_array($daftar)) {

and change to

     $c = 0;
     $result = array();
     while ($buffer = tep_db_fetch_array($daftar)) {

 

Share this post


Link to post
Share on other sites
33 minutes ago, Jack_mcs said:

@artfulwebThanks for posting that Barbie. I don't have a test shop setup with 7.2 so I can't test it. But the version of this addon I have here has the following change. If you have the time to bother with it, I would be interested to know if it fixes the issue without your change in? If you want to try it, reverse your changes and then in admin/includes/functions/faq.php fine (around line 58)


     $c = 0;
     while ($buffer = tep_db_fetch_array($daftar)) {

and change to


     $c = 0;
     $result = array();
     while ($buffer = tep_db_fetch_array($daftar)) {

 

Hello again Jack,

I reverted back and put your replacement code in admin/includes/functions/faq.php and the errors are back so maybe the sizeof function is no longer valid in php 7.2? With my change it works like a charm on my site. What do you think?

Share this post


Link to post
Share on other sites
Posted (edited)

Oh, note that I have error reporting on in the admin section so I can spot these errors because if not I get a white page.

Edited by artfulweb
did not finish

Share this post


Link to post
Share on other sites

Sorry Jack, I uploaded the wrong admin/includes/functions/faq.php. Your correction

$c = 0;

$result = array();

while ($buffer = tep_db_fetch_array($daftar)) {

DOES work.

Thank you !

 

Barbie

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

×