VirtueMart Forum

VirtueMart 2 + 3 + 4 => 3rd party extension => Topic started by: PRO on January 31, 2012, 17:05:34 PM

Title: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on January 31, 2012, 17:05:34 PM
UPDATED:::: Compatible with J2.5.1 or greater.

Attached is a Redirect administrator component and system plugin that will 301 redirect urls based on product_id, category_id, and manufacturer_id


NOW using app=redirect instead of header redirect. BUT this was only made available in J2.5.1

A vmart 1.1 product that was in 10 categories could have 10 urls.
With this component, you only have to fill in 1 new url.
The plugin looks for
shop.product_details
shop.browse
shop.manufacturer_page

Then finds the ID, and searches the database for the new url, then redirects.

It does NOT redirect 1.1 links that are SEF.
It redirects to either sef, or non sef.

ALSO:: I have built an additional plugin to redirect links like /index.php?option=com_virtuemart&Itemid=134   via the itemid
In case you used the joomla menu system for categories.
The native redirect manager will not redirect this /index.php?option=com_virtuemart&Itemid=134   because it does not produce a 404.
PM for the plugin.

[attachment cleanup by admin]
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: 3D Web Design on March 23, 2012, 08:05:40 AM
Seo is important. Thank you for this component! When we update online shop with good link building this will be very useful.
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: VM-User on April 05, 2012, 03:44:32 AM
Does this only work in Joomla v2.5?

Install Problem:

        Error! Could not find a Joomla! XML setup file in the package.


Joomla v1.5.2
VM v2.0.2
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on April 05, 2012, 13:31:31 PM
Quote from: BanquetTables.pro on January 31, 2012, 17:05:34 PM
UPDATED:::: Compatible with J2.5.1 or greater.



^^^

Yes
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: JohnHunter on May 27, 2012, 15:39:11 PM
Exceptionally useful, thank you for putting this together...





Quote from: BanquetTables.pro on January 31, 2012, 17:05:34 PM
UPDATED:::: Compatible with J2.5.1 or greater.

Attached is a Redirect administrator component and system plugin that will 301 redirect urls based on product_id, category_id, and manufacturer_id


NOW using app=redirect instead of header redirect. BUT this was only made available in J2.5.1

A vmart 1.1 product that was in 10 categories could have 10 urls.
With this component, you only have to fill in 1 new url.
The plugin looks for
shop.product_details
shop.browse
shop.manufacturer_page

Then finds the ID, and searches the database for the new url, then redirects.

It does NOT redirect 1.1 links that are SEF.
It redirects to either sef, or non sef.

ALSO:: I have built an additional plugin to redirect links like /index.php?option=com_virtuemart&Itemid=134   via the itemid
In case you used the joomla menu system for categories.
The native redirect manager will not redirect this /index.php?option=com_virtuemart&Itemid=134   because it does not produce a 404.
PM for the plugin.
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: agrupe on June 07, 2012, 10:38:27 AM
Hi,

I need help as a product redirect is not working.

Old URL:
http://www.elko-verkauf.de/jupgrade/shop-bereich/24-elko-kits/40-flachbild-tv/115-netzteil-hersteller/116-fsp/368-elko-kit-grundig-26q-32q-und-weitere-mit-netzteil-fsp204-2f01.html

New URL:
http://www.elko-verkauf.de/jupgrade/shop-bereich/elko-kits/flachbild-tv/tv-netzteil-hersteller/tv-fsp/368-elko-kit-fuer-tv-netzteil-fsp204-2f01.html

My tabel entry is:
Old ID: 368   New URL: /shop-bereich/elko-kits/flachbild-tv/tv-netzteil-hersteller/tv-fsp/368-elko-kit-fuer-tv-netzteil-fsp204-2f01.hmtl

This ends up in the correct category (categories have been set correct, too) but says "404 Das gesuchte Produkt existiert nicht."

What have I done wrong?

Thanks

Andreas
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on June 07, 2012, 12:40:08 PM
Quote from: agrupe on June 07, 2012, 10:38:27 AM
Hi,

I need help as a product redirect is not working.

Old URL:
http://www.elko-verkauf.de/jupgrade/shop-bereich/24-elko-kits/40-flachbild-tv/115-netzteil-hersteller/116-fsp/368-elko-kit-grundig-26q-32q-und-weitere-mit-netzteil-fsp204-2f01.html

New URL:
http://www.elko-verkauf.de/jupgrade/shop-bereich/elko-kits/flachbild-tv/tv-netzteil-hersteller/tv-fsp/368-elko-kit-fuer-tv-netzteil-fsp204-2f01.html

My tabel entry is:
Old ID: 368   New URL: /shop-bereich/elko-kits/flachbild-tv/tv-netzteil-hersteller/tv-fsp/368-elko-kit-fuer-tv-netzteil-fsp204-2f01.hmtl

This ends up in the correct category (categories have been set correct, too) but says "404 Das gesuchte Produkt existiert nicht."

What have I done wrong?

Thanks

Andreas


Quote from: BanquetTables.pro on June 04, 2012, 21:49:28 PM
agrupe,

PLEASE keep in mind, the redirect component I made ONLY does NON-SEF links for 1.1

because it grabs the product_id   etc out of the url


^^^^^^^^^^^^^^^^^^^^^

shop.product_details & shop.browse    HAVE to be in the REQUESTED   URL for this plugin to work.


IF you cannot use this plugin, I would use the standard joomla redirect component. You can import a spreadsheet into the database to make it easier
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: JohnHunter on June 10, 2012, 17:11:07 PM
Thanks BanquetTables.pro

Works great in Joomla! 2.5.4 and VM 2.0.6a stable
Very much appreciated
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: RedJohn on July 04, 2012, 10:33:32 AM
I change something.

iw works with settings:

Joomla! 2.5.6:
Search Engine Friendly URLs: yes
Use URL rewriting: yes
Adds Suffix to URL: no
Unicode Aliases: no

vm:2.0.8a:
SEO Disabled - NO
Seo Suffix - .html
Translate Strings - NO
Use Product and Category IDs - NO


i chage file: virtuemartredirect.php on your plugin:




<?php
defined
('JPATH_BASE') or die;
//Author Alex @ BanquetTables.pro
//@copyright Banquet Tables Pro LLC
//@license GNU General Public License version 2 or later


jimport('joomla.plugin.plugin');


function 
find_category_category($cat_id)
{

$db JFactory::getDBO();
$query 'SELECT category_parent_id FROM `#__virtuemart_category_categories` WHERE `category_child_id`='.$cat_id;
$db->setQuery($query);
//echo $query;

$myResult $db->loadAssocList();
foreach($myResult AS $row) {
$cat $row["category_parent_id"];
}
  
  
return $cat;
  
}

function 
find_product_category()
{
$legacythis JRequest::getInt('product_id'0);

$db JFactory::getDBO();
$query 'SELECT virtuemart_category_id FROM `#__virtuemart_product_categories` WHERE `virtuemart_product_id`='.$legacythis;
$db->setQuery($query);


$myResult $db->loadAssocList();
foreach($myResult AS $row) {
$cat $row["virtuemart_category_id"];
}
  return $cat;
}

function 
find_categoty_name($cid){
  
$db JFactory::getDBO();
$query 'SELECT slug FROM `#__virtuemart_categories_pl_pl` WHERE `virtuemart_category_id`='.$cid;
$db->setQuery($query);


$myResult $db->loadAssocList();
foreach($myResult AS $row) {
$slug $row["slug"];
}
  return $slug;  
  
}


function 
find_path($cat){
  
$main_cat $cat;
  
  
$path find_categoty_name($main_cat);
  while (
find_category_category($main_cat) > 0)
  { 
    
    
$main_cat find_category_category($main_cat);
    
$path find_categoty_name($main_cat).'/'.$path;
  }
  
 return 
strtolower($path); 
  
}

if ( 
JRequest::getVar('page')=='shop.product_details') { 
$legacythis JRequest::getInt('product_id'0); 
$db JFactory::getDBO();
$query 'SELECT slug FROM `#__virtuemart_products_pl_pl` WHERE `virtuemart_product_id`='.$legacythis;
$db->setQuery($query);

$myResult $db->loadAssocList();
foreach($myResult AS $row) {
$pro_new_url find_path(find_product_category()).'/'.$row["slug"].'.html';
}
        
        
$app JFactory::getApplication();
$app->redirect('http://'.$_SERVER['SERVER_NAME'].'/'.$pro_new_urlnullnulltruetrue);
}

if ( 
JRequest::getVar('page')=='shop.browse' AND (JRequest::getVar('keyword')!='' OR JRequest::getVar('keyword1')!=''))  { 

$key JRequest::getVar('keyword');
$key1 JRequest::getVar('keyword1');

$new_url 'http://'.$_SERVER['SERVER_NAME'].'/search?keyword='.$key.$key1.'&option=com_virtuemart&view=category';
$app JFactory::getApplication();
$app->redirect($new_urlnullnulltruetrue);
}

if ( 
JRequest::getVar('page')=='shop.browse') { 
$legacythis JRequest::getInt('category_id'0);

$category_new_url 'http://'.$_SERVER['SERVER_NAME'].'/'.find_path($legacythis);

$app JFactory::getApplication();
$app->redirect($category_new_urlnullnulltruetrue);
}



if not work check in ypur database table:

virtuemart_categories_pl_pl
virtuemart_products_pl_pl

it can looks like:

virtuemart_categories_en_gb
virtuemart_products_en_gb

or something, then change in the code above.

PS. Sory for my english, i know it is not good. I hope You understand.



Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: lliseil on April 01, 2013, 23:16:16 PM
First let me thank you BanquetTables.pro for this great component. It works fine with VirtueMart 2.0.18 on Joomla! 2.5.9
A quick question though.
If you add standard non-seo URLs (for dev and portability purpose) they will stay non-seo when redirected.
That is even with Joomla and VM2 SEO activated, and the plugin placed after Joomla SEO plugin.
Is it by design or am I missing something?
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on April 02, 2013, 00:42:58 AM
Quote from: lliseil on April 01, 2013, 23:16:16 PM
First let me thank you BanquetTables.pro for this great component. It works fine with VirtueMart 2.0.18 on Joomla! 2.5.9
A quick question though.
If you add standard non-seo URLs (for dev and portability purpose) they will stay non-seo when redirected.
That is even with Joomla and VM2 SEO activated, and the plugin placed after Joomla SEO plugin.
Is it by design or am I missing something?


system plugins run BEFORE components, so this can never happen the way you want.

Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: lliseil on April 28, 2013, 02:27:15 AM
So it's the component that takes care of the redirection and not plg_system_virtuemartredirect, hay hay.
Thank you for clarifying this.
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: kacper1972 on December 23, 2014, 11:55:55 AM
Hello

I tray to use it on joomla 3 i vm 3 but it no working, when i want to open component i see white screen any idea about it

regards
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: otaks on May 17, 2016, 18:17:32 PM
HI, this plugin work with virtuemart 3.0?
I have migrate virtuemart 1.1 to virtuemart 3
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on May 17, 2016, 19:38:04 PM
otaks,
I responded to your other thread. if you are not using SEF urls, no need to use this component
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: otaks on May 17, 2016, 19:47:36 PM
Quote from: PRO on May 17, 2016, 19:38:04 PM
otaks,
I responded to your other thread. if you are not using SEF urls, no need to use this component

Thank you for your answer! However, The problem is that I would like to migrate my site from Virtuemart 1 to Virtuemart 3 without losing the SEO. In Virtuemart 3 with Joomla 3 I would like to activate SEF URLs...
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on May 17, 2016, 20:33:18 PM
I have attached my version I am using now, it has a lot more than you need though.

Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on May 17, 2016, 20:35:10 PM
then the plugin attached

KEEP IN MIND, THIS IS TO GO FROM NON-SEF URLS TO SEF URLS
Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: AH on June 01, 2016, 21:51:08 PM
Big thumbs up to Pro (yet again)

I was wondering how to move from a VM1 to VM3 site with as little seo impact as possible and this was really holding things back.

Nightmare to try and do manually with thousands of items - great to do when Pro has provided the starting point and inspiration!! :) :) :)

Old urls were base VM1 and categories used a Vm category menu module

Giving the old urls that looked like:-

index.php?page=shop.browse&category_id=17&option=com_virtuemart&Itemid=7
index.php?page=shop.product_details&flypage=flypage.tpl&product_id=1184&category_id=17&option=com_virtuemart&Itemid=7


New system will be VM3:-
Categories will be linked using Joomla menus (manually created - for more control)
SEF Urls will be on for VM and Joomla

The key to making things relatively simple is when migrating - keep the existing category_id's and product_id's - without that - expect a lot of manual data entry!

If you are able to keep id's the same, it is then a short step and hop to use your own plugin that will automatically 301 the old non sef product and category urls to the new sef urls.

Once again Pro - THANKS!!!!!  :) :) :)





Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: PRO on June 02, 2016, 18:58:13 PM
Keep in mind the new component also does


Vmart 3   product slugs to new url.(if you delete a product) IF I give you the code. I have the code if you need it

Then the article ID and ITEM id redirects take separate plugins.
I have them, but MUCH care needs to be taken  to use them.

Title: Re: Virtuemart 1.1 to 2.0 301 Redirect Component
Post by: AH on June 02, 2016, 21:57:18 PM
Pro

Thanks for the heads up - I will be able to develop what I have to meet my specific needs at the present time.