VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: otaks on May 12, 2016, 21:22:32 PM

Title: Url Joomla 1.5 and Url Joomla 3 (Urls changed)
Post by: 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?
Title: Re: Url Joomla 1.5 and Url Joomla 3
Post by: PRO on May 12, 2016, 21:32:03 PM
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
Title: Re: Url Joomla 1.5 and Url Joomla 3
Post by: otaks on May 13, 2016, 18:17:26 PM
hi, thank you...can you explain me?
Title: Re: Url Joomla 1.5 and Url Joomla 3 (Urls changed)
Post by: PRO on May 17, 2016, 19:37:34 PM
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
Title: Re: Url Joomla 1.5 and Url Joomla 3 (Urls changed)
Post by: 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?
Title: Re: Url Joomla 1.5 and Url Joomla 3 (Urls changed)
Post by: 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
Title: Re: Url Joomla 1.5 and Url Joomla 3 (Urls changed)
Post by: otaks on May 18, 2016, 09:40:17 AM
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
Title: Re: Url Joomla 1.5 and Url Joomla 3 (Urls changed)
Post by: PRO on May 19, 2016, 13:36:30 PM
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);
}
?>