Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Losing Session_id On Filter_id


krnl

Recommended Posts

After placing an item in my shopping cart, all is ok until I go to a category and use the manufacturer drop-down at the top to filter the category results. When I use the drop-down, for some reason, the session ID is blown away and a new session is set for the user. This results in the shopping cart being emptied.

 

The site is all-in-general.com.

To reproduce the problem,

1) place an item in the cart

2) select a category

3) select a subcategory

4) use the Show: [ Manufacturers drop-down-list ] to select filter by manufacturer (not the manufacturer drop-down in the left menu - that one seems to work fine)

 

Can anyone give me an idea why using the filter would result in the session being reset, or how I can go about debugging it?

 

Thanks!

Rick

Link to comment
Share on other sites

After placing an item in my shopping cart, all is ok until I go to a category and use the manufacturer drop-down at the top to filter the category results. When I use the drop-down, for some reason, the session ID is blown away and a new session is set for the user. This results in the shopping cart being emptied.

 

The site is all-in-general.com.

To reproduce the problem,

1) place an item in the cart

2) select a category

3) select a subcategory

4) use the Show: [ Manufacturers drop-down-list ] to select filter by manufacturer (not the manufacturer drop-down in the left menu - that one seems to work fine)

 

Can anyone give me an idea why using the filter would result in the session being reset, or how I can go about debugging it?

 

Thanks!

Rick

 

It's a bug with the osc code. It can happen when the cookies aren't accepted or if the cookes domains/paths in the configure.php aren't set properly.

 

To get around it open your catalog\index.php locate this code

		echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');

 

change it to

		echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"') . tep_hide_session_id();

It's probably discussed several times earlier.

Link to comment
Share on other sites

Thanks enigma. That fixed it. I did do a couple of forum searches and didn't find a fix. I'm glad you are around. You've helped me out on more than one occasion. Here's to you!

 

Rick

Link to comment
Share on other sites

It's a bug with the osc code. It can happen when the cookies aren't accepted or if the cookes domains/paths in the configure.php aren't set properly.

 

To get around it open your catalog\index.php locate this code

		echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');

 

change it to

		echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"') . tep_hide_session_id();

It's probably discussed several times earlier.

 

Thanks for this fix. I new I had to insert ". tep_hide_session_id()" but was placing it before the ')' so it was not working. Your answer saved my hours of trying ;)

Link to comment
Share on other sites

When I used the suggestion above, I was getting the following url:

 

?osCsid=c648c6f2ffbb68be31a6f039bb36aec9&filter_id=3

 

and this was not making tha manufacturers change.

 

so I did the following instead:

 

echo ' <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . tep_hide_session_id() . TEXT_SHOW . ' ';

 

and the url is:

 

?filter_id=3&osCsid=c648c6f2ffbb68be31a6f039bb36aec9

 

which works fine.

Link to comment
Share on other sites

When I used the suggestion above, I was getting the following url:

 

?osCsid=c648c6f2ffbb68be31a6f039bb36aec9&filter_id=3

 

and this was not making tha manufacturers change.

 

so I did the following instead:

 

echo ' <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . tep_hide_session_id() . TEXT_SHOW . ' ';

 

and the url is:

 

?filter_id=3&osCsid=c648c6f2ffbb68be31a6f039bb36aec9

 

which works fine.

there's should be no difference of the arguments order in the url. However seeing the "amp;" indicates some sort of url encoding taking place. Possibly in your tep_href_link function. Now you can cause problems with forms and should be applied conditionally.

Link to comment
Share on other sites

True it is strange but I am not a php expert and does not understand all the code. I have Ultimate SEO installed... maybe it is the cause.

ah yes, in this case goto your osc Admin->Configuration->SEO URLs->Output W3C valid URLs. Set this to false and retry it with the other code. The thing is you need to conditionally encode the urls because with forms (especially with payment gateways) encoding can cause problems with the return or error urls at it's outside the osc so you have no way of knowing how each gateway processes them.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...