Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search redirect to home page


Psytanium

Recommended Posts

Hi,

 

When i open my website on any browser and search for anything, the page load then redirect me to the home page.

This is happening only for the 1st search, a second search work fine.

This problem was solved by removing tep_hide_session_id() from the cm_search.php module.

 

I don't know what's the job of tep_hide_session_id(), what's the side effect of removing it ?

 

Thank you

Link to comment
Share on other sites

Hi, you can delete it, this function is not necessary now.

////
// Hide form elements
  function tep_hide_session_id() {
	$string = '';

	if (defined('SID') && tep_not_null(SID)) {
	  $string = tep_draw_hidden_field(tep_session_name(), tep_session_id());
	}

	return $string;
  }
Link to comment
Share on other sites

@@Solomono  This is wrong. Removing this function will cause loss of session, resulting in lost carts etc. Do not do this.

 

If your problem is solved by disabling this function, you have a sessions problem. The most common cause is an incorrect setting in the includes/copnfigure.php. Search this forum for suggested fixes.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

The tep_hide_session_id() function is part of osCommerce's session management. It passes a session token in form submissions. The tep_href_link() function performs the same session management for links. Both of those are needed to maintain session before the session cookie is first returned and when the customer's browser does not manage cookies correctly.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 4 months later...

Apparently the answer given is not the correct solution to this problem. So what is correct? I have the same problem.

 

On 4/24/2017 at 5:39 AM, Psytanium said:

When i open my website on any browser and search for anything, the page load then redirect me to the home page.

This is happening only for the 1st search, a second search work fine.

This problem was solved by removing tep_hide_session_id() from the cm_search.php module.

Link to comment
Share on other sites

This appears to be becoming a common problem.  I have just been working with a client who
experiences this same problem, however I could not replicate the problem in any browser...

As I could not replicate it, I could not fix it.  

Should anyone have the same or similar problem...and has fixed it (for certain), please post back.

Thanks

In my clients case

session management is correct
htaccess is not interfering
first search does nothing, from then on it works perfectly.

Link to comment
Share on other sites

On 9/12/2017 at 11:32 PM, wHiTeHaT said:

What oscommerce version ?
Stock (default) or bootstrap version?

From where is been searched?
-From the header (bootstrap version)?
-From the searchbox?
-From the advanced_search page?

2.3.4, this problem appear on your 1st search from any page, not only advanced search page.

Link to comment
Share on other sites

I turned back the tep_hide_session_id() to cm_search.php module. Now it's searching well, I don't know what was the problem.

But I'm sure it was happening on different computers and browsers, The store owners received many reports from users about it.

Anyway now we are fine. Thanks all

Link to comment
Share on other sites

  • 3 weeks later...
6 minutes ago, wHiTeHaT said:

I got same problem on first search on wood&gas.

Second search worked, then i was not able to replicate the bug anymore. Even when i removed stored sessions and cookies. (chrome browser)

So i tested after in Edge, used same search-word and it instantly worked. 

Conclusion.... no idea!

 

Exact same problem on a number of sites.  My conclusion was SEO URL rewriting interfering, but that was a total guess and have not had a chance to try it with SEO Urls turned off.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...