News:

Looking for documentation? Take a look on our wiki

Main Menu

Url Joomla 1.5 and Url Joomla 3 (Urls changed)

Started by otaks, May 12, 2016, 21:22:32 PM

Previous topic - Next topic

otaks

Hi everyone, I have migrated Virtuemart 1 (Joomla 1.5) to Virtuemart 2 (Joomla 3.5), but there's a problem. These are my old urls:

index.php?page=shop.browse&category_id=45&option=com_virtuemart&Itemid=71

While the new ones now are...

index.php?option=com_virtuemart&view=category&virtuemart_category_id=45&lang=it

Is there a way to avoid this problem?

PRO

Quote from: otaks on May 12, 2016, 21:22:32 PM
Hi everyone, I have migrated Virtuemart 1 (Joomla 1.5) to Virtuemart 2 (Joomla 3.5), but there's a problem. These are my old urls:

index.php?page=shop.browse&category_id=45&option=com_virtuemart&Itemid=71

While the new ones now are...

index.php?option=com_virtuemart&view=category&virtuemart_category_id=45&lang=it

Is there a way to avoid this problem?

there is a new url structure that cannot change.

but with a little coding you can get the redirects automated

otaks

hi, thank you...can you explain me?

PRO

Otaks,


do you have a way to test this?

IF YOU ARE NOT USING SEF URLS

those code should redirect old CATEGORY urls to new CATEGORY urls. (it can be tested by putting in template etc.)


<?php
$safebase=JURI::base();
$jinput = JFactory::getApplication()->input;
$pageis = $jinput->get('page', '0');
if ( $pageis =='shop.browse') {
   $legacythis = $jinput->getInt('category_id', '0');
   $item=$jinput->getInt('category_id', '0');
$category_new_url='index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$legacythis.'&Itemid='.$item;
   $app = JFactory::getApplication();
   $app->redirect($safebase.$category_new_url,true);
}
?>


the product urls also changed, but this code is for category

otaks

#4
I'm sorry, I've just read your message.Great the code works...And what about the URLs of the products?

PRO

Quote from: otaks on May 17, 2016, 19:50:21 PM
I'm sorry, I've just read your message.Great the code works...And what about the URLs of the products?

give me the new url to your products

I use SEF urls, so I dont know it

otaks

Quote from: PRO on May 17, 2016, 20:29:13 PM
Quote from: otaks on May 17, 2016, 19:50:21 PM
I'm sorry, I've just read your message.Great the code works...And what about the URLs of the products?

give me the new url to your products

I use SEF urls, so I dont know it

New url:
index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=489&virtuemart_category_id=87&lang=it

very thank

PRO

test this.

ALSO: this corrects the first code. The Item ID code was wrong.


<?php
$safebase=JURI::base();
$jinput = JFactory::getApplication()->input;
$pageis = $jinput->get('page', '0');
if ( $pageis =='shop.browse') {
   $legacythis = $jinput->getInt('category_id', '0');
   $item=$jinput->getInt('Itemid', '0');
$category_new_url='index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$legacythis.'&Itemid='.$item;
   $app = JFactory::getApplication();
   $app->redirect($safebase.$category_new_url,true);
}
if ( $pageis=='shop.product_details' || $pageis=='shop.ask'){
   $legacythis = $jinput->getInt('product_id', '0');
   $cat = $jinput->getInt('category_id', '0');
   $item=$jinput->getInt('Itemid', '0');
$pro_new_url='index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$legacythis.'&virtuemart_category_id='.$cat.'&Itemid='.$item;
   $app = JFactory::getApplication();
   $app->redirect($safebase.$pro_new_url, true);
}
?>