News:

Support the VirtueMart project and become a member

Main Menu

Virtuemart 1.1 to 2.0 301 Redirect Component

Started by PRO, January 31, 2012, 17:05:34 PM

Previous topic - Next topic

PRO

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]

3D Web Design

Seo is important. Thank you for this component! When we update online shop with good link building this will be very useful.
3D Web Design

VM-User

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

PRO


JohnHunter

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.

agrupe

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

PRO

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

JohnHunter

Thanks BanquetTables.pro

Works great in Joomla! 2.5.4 and VM 2.0.6a stable
Very much appreciated

RedJohn

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.




lliseil

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?
- A thread solved is a thread [SOLVED]! (a memo for myself)

PRO

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.


lliseil

So it's the component that takes care of the redirection and not plg_system_virtuemartredirect, hay hay.
Thank you for clarifying this.
- A thread solved is a thread [SOLVED]! (a memo for myself)

kacper1972

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

otaks

HI, this plugin work with virtuemart 3.0?
I have migrate virtuemart 1.1 to virtuemart 3

PRO

otaks,
I responded to your other thread. if you are not using SEF urls, no need to use this component