VM2 don't show 404 after changing aliases of menu items, but instead redirects.

Started by AlexAkhremenko, April 19, 2012, 20:49:33 PM

Previous topic - Next topic

AlexAkhremenko




English isn't my native.
I use Joomla 2.5.4 and VM 2.0.6, standart joomla and vm SEF.
See this screenshot.
At first, I maked 4 levels of menu items (all are vm categories such as in virtuemart):

katalog
  vse-dlya-remonta
    dveri
      metallicheskie


And the result was a link of category "metallicheskie": http://serenity.by/katalog/vse-dlya-remonta/dveri/metallicheskie/

Now I changed second and fourth aliases:

katalog
  stroitelstvo-i-remont
    dveri
      vkhodnye


And received a link: http://serenity.by/katalog/stroitelstvo-i-remont/dveri/vkhodnye

Using the old link, I should get 404 page, but I turn to page http://serenity.by/katalog/vse-dlya-remonta/dveri/metallicheskie/, that is actually a page http://serenity.by/katalog/ (see the title in the source of page!). Google has already indexed that links, and I can't make 301 redirect to new links! And this situation changed with all links! Help me, please!

AlexAkhremenko

I have studied router.fp file and concluded that the function virtuemartparseroute() does not handle non-existent links.
At this block (about line 480):

} elseif (!$helper->use_id && ($helper->activeMenu->view == 'category' ) )  {
$vars['virtuemart_category_id'] = $helper->getCategoryId (end($segments) ,$helper->activeMenu->virtuemart_category_id);
$vars['view'] = 'category' ;
}


page just redirects to the link http://serenity.by/katalog/ (in my example), and the segments "vse-dlya-remonta", "dveri" and "metallicheskie" are ignored. But if I check:

if ($vars['virtuemart_category_id'] == $helper->activeMenu->virtuemart_category_id) {
JError::raiseError(404, JText::_('JERROR_LAYOUT_PAGE_NOT_FOUND'));
return $vars;
}


I get 404 for non-existent links. This is a rough patch, but so far it works

Milbo

Hmm, did you read the source code of the page, which comes up? When vm2 is not finding a product or category it is going to an upper level, but sending a 404 to google. I am quite sure about this, please recheck.
Besides this, I do not really understand your fix, sry. Keep the good reports :-)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AlexAkhremenko

Quote from: Milbo on April 22, 2012, 20:28:06 PM
Hmm, did you read the source code of the page, which comes up? When vm2 is not finding a product or category it is going to an upper level, but sending a 404 to google. I am quite sure about this, please recheck.
Besides this, I do not really understand your fix, sry. Keep the good reports :-)

But Google-bot indexed this pages.

About my fix: now my wm isn't going to an upper level, but just showing standart joomla 404 page.