Marc,
here is what I modified, it's about 2-3lines of code (and a couple of hours searching what goes wrong...).
I noticed, by looking at the url when pointing my cursor above the right/left arrows in the product flypage, that it prepares a url which did not contain anything about category (ie the category id). When the product belongs to just 1 category, no problem, next/previous browsing worked fine. But in the multiple ctgry case, the categories and pathway consequently were randomly switching between those categories that the next product falled into. So I thought that if I added to the url the category id, then it would force it to stay on the chosen ctgry (by the user).
I searched all files that seemed relevant, and found shop.product_details.php in administrator/components/com_virtuemart/classes/html directory. I saw where it builds up the code for the url for neighbour products, as it is called in there (line 164). as you can see, there is nothing about category_id

when it builds up the $url_parameters. I added at line 177 :
else
{
if( $category_id ) {
$url_parameters .= "&category_id=" . $category_id;
}
}
so this way the categoryid is propagated from product flypage to product flypage, as you browse the products of the
chosen category!
Then I did the same for the previous product, a few lines below, and that's it

In the file, you may correct the identation, the '
else' should be below the
if ( keyword !='')
to be more readable, it needs a TAB. I believe this is because when somebody has used a keyword to search and browse, then there is no category involved, so it's either keyword, or category, but not both! So they mutualy exclude each other, that is why the else is needed.
I hope this will help you, it was time for me to give something back to this forum, I got so much info last 2 weeks I am trying to put up my first J/VM site, and I am happy to help you.
Best regards and please keep in touch!

tell me if it works for you!
darenGR
[attachment cleanup by admin]