Author Topic: VM2 don't show 404 after changing aliases of menu items, but instead redirects.  (Read 3218 times)

AlexAkhremenko

  • Beginner
  • *
  • Posts: 9
    • Serenity



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

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

Code: [Select]
} 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:

Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9853
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
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 :-)
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AlexAkhremenko

  • Beginner
  • *
  • Posts: 9
    • Serenity
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.