Author Topic: Need fix for vmRedirect / vmcchk, which is most annoying.  (Read 5908 times)

Macro Man

  • Beginner
  • *
  • Posts: 3
Need fix for vmRedirect / vmcchk, which is most annoying.
« on: February 02, 2010, 22:07:31 pm »
Each first time one clicks on a VM (Virtue Mart) category, it redirects to the default category. As long as one doesn't exit VM, the links then work fine. But, the minute you go to the Joomla part of the site and then come back, you start a new session with VM and go to the default category again.

I've tried everything I can think of and have searched the Forums and Developer Portals. It appears many people have the problem, but there is no workable solution. I am using VM 1.1.4 stable. The problem appears to be in "ps_session.php" and has something to do with the cookie checks.

I have ideas on how to fix it, but don't know php language. Let me know what to do. Does anyone read these posts? I see many questions and few answers. Here's the site in case you want to look at it: www.ohsawamacrobiotics.com.

baltasarb

  • Beginner
  • *
  • Posts: 3
Re: Need fix for vmRedirect / vmcchk, which is most annoying.
« Reply #1 on: February 02, 2010, 22:49:53 pm »
I have found this error in my joomla also.

Sakia884

  • Beginner
  • *
  • Posts: 4
Re: Need fix for vmRedirect / vmcchk, which is most annoying.
« Reply #2 on: February 02, 2010, 23:31:41 pm »
Surely someone has an idea what is causing this and a fix. My problem, too.

While in the main, non-store, part of my Joomla site, if I click on one of the store links it always goes to a default first before the links will work properly. And if I leave the store area, it all starts over again.

I see now I am not alone in this. Any answers out there?

rb

  • Advanced
  • Full Member
  • *****
  • Posts: 1503
Re: Need fix for vmRedirect / vmcchk, which is most annoying.
« Reply #3 on: February 05, 2010, 01:26:57 am »
Do you have the "Cookie Check" enabled?  If so, try it with it disabled and see if that helps.

Admin->Configuration->Global tab->Core Settings box

baltasarb

  • Beginner
  • *
  • Posts: 3
Re: Need fix for vmRedirect / vmcchk, which is most annoying.
« Reply #4 on: February 05, 2010, 09:38:00 am »
This solution is ok for me.

Macro Man

  • Beginner
  • *
  • Posts: 3
Re: Need fix for vmRedirect / vmcchk, which is most annoying.
« Reply #5 on: February 05, 2010, 17:52:55 pm »
Thank you so much for responding -- I unchecked the box and saved it but there is no change in the problem -- it still goes to the VM default category. You can go to www.ohsawamacrobiotics.com to check it out. I've opened the site in Firefox and in Internet Explorer.

My thinking is that it is in "ps_session.php". If you go there, simply search on "vmcchk" and you'll go directly to the coding problem. (You can also search "vmRedirect" and the first instance takes you to the same place.)

I have a workaround idea but don't know the proper php language, and also don't know if my idea would mess up other things. Here's my idea as sent to a friend who was not able to help:

> Based on this, here is the problem line:
vmRedirect( $this->url( $mm_action_url . 'index.php?' .$query_string .'&vmcchk=1', true, false ));
     Since this is close to the top, you might want to read from the top since prior "paragraphs" also talk about cookies. It appears that each first time one clicks on a VM (Virtue Mart) file, it redirects to the default file (in our case "PDF - Current Issues). As long as you don't exit VM, the links then work fine. But, the minute you go to the Joomla part of the site -- any of those at the top of the page -- you start a new session with VM when you go back there because you are starting a new session. If we can keep it from adding '&vmcchk=1', then it would be solved.
 
However, I have a new idea this morning. Instead of taking out the "&vmcchk=1", we could add php language in the following "paragraph":
 
elseif( empty( $isOK )) {
   $_SESSION['VMCHECK'] = 'OK';
   $query_string = vmGet($_SERVER,'QUERY_STRING');
   if( !empty($query_string) && empty( $_POST )) {
    vmRedirect( $this->url( $mm_action_url . 'index.php?' .$query_string .'&vmcchk=1', true, false ));
   }
 
1. Add a line above "if( !empty($query_string).... that asks if "itemid=105" is in the "url" (105 is the item number for the Cookbooks for example), then "vmRedirect( $this->url( $mm_action_url . 'index.php?' .$query_string .'&vmcchk=1&itemid=105', true, false ));
 
2. This would allow it to go through the redirect, but would direct it where we want it to go instead of going to the default one.
 
3. Then, we would add the same thing over and over for all the categories (103-108) except for the one it defaults to now (PDF - Current Issues), which is "itemid=109".
 
4. That way, it gets to redirect as it is set up to do....
 
To me, it's just a matter of making the php language so that the computer follows the steps in logical fashion.
 
Anyway, let me know if you (or anyone) knows enough of php to take this on, and can write it properly.

My email is gomf@earthlink.net in case you need me to send a copy of the particular "ps_session.php" file that is on the site.

Macro Man

  • Beginner
  • *
  • Posts: 3
Re: Need fix for vmRedirect / vmcchk, which is most annoying.
« Reply #6 on: February 16, 2010, 00:22:46 am »
I figured it out! -- instead of linking directly to the VM category, I linked them all to the default category and then put in the reDirect code "vmcchk=1" and then put in the category I wanted it to go to. So, when it does the check, it sees that the original request is to the default category and that the redirect is from there. It works in every case on my computer.
 
Here's an example:
../index.php?option=com_virtuemart&Itemid=112&vmcchk=1&Itemid=104
"112" should be the item id for your VM default category.
"104" should be the item id for the VM category you want to go to.

In my opinion, you should be able to go directly, but that's not the way it's set up. This way works -- eureka!