VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: malibu2792 on April 11, 2012, 22:06:23 PM

Title: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: malibu2792 on April 11, 2012, 22:06:23 PM
I am wanting to make my url's as SEF as possible. I would like to reword the "/component/virtuemart/" in the URLs. How do I do this?

SEF is enabled.

Joomla! 2.5.4
Virtuemart 2.0.4
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: patrik60 on April 12, 2012, 10:57:37 AM
Did you also enable SEF in VM configuration (last tab in VM config)?
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: jjk on April 12, 2012, 19:56:01 PM
Quote from: malibu2792 on April 11, 2012, 22:06:23 PM
... reword the "/component/virtuemart/" in the URLs. How do I do this?

Is your site multilingual?
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: SamF on April 12, 2012, 20:14:38 PM
Quote from: malibu2792 on April 11, 2012, 22:06:23 PM
I would like to reword the "/component/virtuemart/" in the URLs. How do I do this?

Easy enough. Assign Virtuemart Front Page to any menu item.
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: PRO on April 12, 2012, 20:17:29 PM
Quote from: malibu2792 on April 11, 2012, 22:06:23 PM
I am wanting to make my url's as SEF as possible. I would like to reword the "/component/virtuemart/" in the URLs. How do I do this?

SEF is enabled.

Joomla! 2.5.4
Virtuemart 2.0.4


For best urls

Create 1 menu to vmart frontpage layout


THEN, create menu links to the categories
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: patrik60 on April 12, 2012, 21:56:02 PM
QuoteCreate 1 menu to vmart frontpage layout

I always read this here in the forum. I don't understand what it means. A menu can't be assigned to a layout. You can assign menu links to layouts, categories, articles etc. So what does it really mean? It's a difference between creating menus or menulinks, isn't it?
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: PRO on April 12, 2012, 22:04:12 PM
Quote from: patbe60 on April 12, 2012, 21:56:02 PM
QuoteCreate 1 menu to vmart frontpage layout

I always read this here in the forum. I don't understand what it means. A menu can't be assigned to a layout. You can assign menu links to layouts, categories, articles etc. So what does it really mean? It's a difference between creating menus or menulinks, isn't it?

Please see image



[attachment cleanup by admin]
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: patrik60 on April 12, 2012, 22:15:55 PM
Thank you, I know about this magic. But this is not "creating a menu". For sure every Joomla and VM user is creating menu links in order to see his shop in the frontend. So I thought you mean something special. Or isn't it the same to create a menu link to the frontpage layout of VM as creating menu links to VM categories?  ???
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: SamF on April 13, 2012, 08:45:22 AM
Quote from: patbe60 on April 12, 2012, 22:15:55 PM
to see his shop in the frontend.

The VM frontpage becomes the site frontpage only if you set certain menu item as "default".

Create the new menu for VM, set the menu item for VM frontpage, and do not create the front page module for this menu: you will not see your shop in the frontend (if you don't want to:).  Even more, you will not see VM in visible links on your page.

But you will get beautiful SEF links to VM pages.
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: dmbart on May 10, 2012, 11:05:18 AM
Quote from: BanquetTables.pro on April 12, 2012, 20:17:29 PM
Quote from: malibu2792 on April 11, 2012, 22:06:23 PM
I am wanting to make my url's as SEF as possible. I would like to reword the "/component/virtuemart/" in the URLs. How do I do this?

SEF is enabled.

Joomla! 2.5.4
Virtuemart 2.0.4


For best urls

Create 1 menu to vmart frontpage layout


THEN, create menu links to the categories

Thanks this did it for me.
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: lipes on March 08, 2013, 00:59:02 AM
If we use VM product module (random, featured, etc..) in frontend Index.php with SEF -> ON ... we will see the "/component/virtuemart/" when someone click in the product  of that module.. it's bad ...
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: PRO on March 08, 2013, 19:33:56 PM
lipes, I do not get that.
Because I have menu links to every top level category
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: lipes on March 09, 2013, 00:49:00 AM
Sorry BTPro!  I didnt remember that i've changed the router.php some months ago, because i need that to work with the product category filter module.

I also got menu links for every categories in Joomla 'Menu' > 'Mainmenu' Menu Item Type links ( VirtueMart » Category Layout ) and others to ( VirtueMart » VirtueMart Categories Layout ) @ ( /administrator/index.php?option=com_menus&view=items&menutype=mainmenu )

If visitor goes by Main Menu works perfect! Like you said :) For example: "Image and Sound" > "HiFi" the visitor will see: http://localhost/template/image-and-sound/hifi

The problem it's in Router.php ... if the visitor clicks in any product will see this kind of link: http://localhost/template/component/virtuemart/?view=productdetails&virtuemart_product_id=729&virtuemart_category_id=15
So i've decided to dont use vm products module because i get this problem

BtW here's my actual (not perfect) router.php file
<?php

function VirtuemartBuildRoute(&$query) {
  
$db =& JFactory::getDBO();
$segments = array();
  
$category_id = (isset($query['category_id']))? $query['category_id'] : '';
  
$product_id = (isset($query['product_id']))? $query['product_id'] : '';
  
$manufacturer_id = (isset($query['manufacturer_id']))? $query['manufacturer_id'] : '';
  
  
// category
  
if (isset($query['page']) && $category_id) {
    if (
$query['page'] == 'shop.browse') {

      
//lookup category name set as segment
      
$sql "SELECT category_name FROM #__vm_category WHERE category_id = " $category_id;
      
$db->setQuery($sql);
      
$category_name $db->loadResult();
      if (
strlen($category_name)) {
        
$category_name strtolower($category_name);
        
$category_name str_replace(' ''-'$category_name);
        
$category_name str_replace('/''-'$category_name);
        
$entities = array('%21''%2A''%27''%28''%29''%3B''%3A''%40''%26''%3D''%2B''%24''%2C''%2F''%3F''%25''%23''%5B''%5D');
        
$category_name str_replace($entities''urlencode($category_name));
        
$segments[] = $category_name;
      }

      unset(
$query['page']);
      unset(
$query['category_id']);
    }
  }
  
  
// manufacturer
  
if (isset($query['page']) && $manufacturer_id) {
    if (
$query['page'] == 'shop.browse') {

      
//lookup category name set as segment
      
$sql "SELECT mf_name FROM #__vm_manufacturer WHERE manufacturer_id = " $manufacturer_id;
      
$db->setQuery($sql);
      
$manufacturer_name $db->loadResult();
      if (
strlen($manufacturer_name)) {
        
$manufacturer_name strtolower($manufacturer_name);
        
$manufacturer_name str_replace(' ''-'$manufacturer_name);
        
$manufacturer_name str_replace('/''-'$manufacturer_name);
        
$entities = array('%21''%2A''%27''%28''%29''%3B''%3A''%40''%26''%3D''%2B''%24''%2C''%2F''%3F''%25''%23''%5B''%5D');
        
$manufacturer_name str_replace($entities''urlencode($manufacturer_name));
        
$segments[] = $manufacturer_name;
      }

      unset(
$query['page']);
      unset(
$query['manufacturer_id']);
    }
  }

  
// product details
  
if (isset($query['page']) && $product_id) {
    if (
$query['page'] == 'shop.product_details') {
    
      
//prevent duplicate urls by chosing the category id with the highest list order
      
$sql "SELECT #__vm_category.category_id
              FROM #__vm_product
                INNER JOIN #__vm_product_category_xref 
                  ON (#__vm_product.product_id = #__vm_product_category_xref.product_id)
                INNER JOIN #__vm_category 
                  ON (#__vm_category.category_id = #__vm_product_category_xref.category_id)
              WHERE (#__vm_product.product_id = " 
$product_id "
                AND #__vm_category.category_publish = 'Y')
              ORDER BY #__vm_category.list_order ASC
              LIMIT 0,1"
;
      
$db->setQuery($sql);
      
$category_id $db->loadResult();

      
//lookup category name set as url segment
      
$sql "SELECT category_name
                FROM #__vm_category
                WHERE category_id = " 
$category_id;
      
$db->setQuery($sql);
      
$category_name $db->loadResult();
      if (
strlen($category_name)) {
        
$category_name strtolower($category_name);
        
$category_name str_replace(' ''-'$category_name);
        
$segments[] = $category_name;
      }

      
//lookup product name and set as url segment
      
$sql "SELECT product_name FROM #__vm_product WHERE product_id = " $product_id;
      
$db->setQuery($sql);
      
$product_name $db->loadResult();
      if (
strlen($product_name)) {
        
$product_name strtolower($product_name);
        
$product_name str_replace(' ''-'$product_name);
        
$product_name str_replace('/''-'$product_name);
        
$entities = array('%21''%2A''%27''%28''%29''%3B''%3A''%40''%26''%3D''%2B''%24''%2C''%2F''%3F''%25''%23''%5B''%5D');
        
$product_name str_replace($entities''urlencode($product_name));        
        
$segments[] = $product_name;
      }

      if (isset(
$query['flypage'])) unset($query['flypage']);
      unset(
$query['page']);
      unset(
$query['product_id']);
      unset(
$query['category_id']);
      unset(
$query['manufacturer_id']);

    }
  }
  
  
// unique id
  
$unique_id = (strlen($category_id)) ? $category_id '';
  
$unique_id .= (strlen($product_id)) ? "-" $product_id '';
  if (
strlen($manufacturer_id && !strlen($unique_id))) {
    
$unique_id "m" $manufacturer_id;
  } 


  
$segments[] = $unique_id;

  unset(
$query['option']);
$query['option'] = 'com_virtuemart';
return $segments;
}

function 
VirtueMartParseRoute($segments) {
  
  
$vars = array();
  
$segment_count count($segments);
  
$category_id '';
  
$product_id '';
  
  
// categories
  
if ($segment_count == 2) {
    if (
strstr($segments[1], "m")) { // manufacturer
      
$vars['manufacturer_id'] = str_replace('m'''$segments[1]);
    } else { 
// category
      
$vars['category_id'] = $segments[1];
    }
    
$vars['page'] = 'shop.browse';
  }

  
// product details
  
if ($segment_count == 3) {
    
$vars['page'] = 'shop.product_details';
    list(
$category_id$product_id) = explode(":"$segments[2]);
    
$vars['product_id'] = $product_id;
  }

  return 
$vars;
}


?>

Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: PRO on March 09, 2013, 04:35:27 AM
are you using the newest version?
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: lipes on March 09, 2013, 06:17:18 AM
yet in the 2.0.18b but  that router.php file it's an old file that as been used to filter work with SEF...
i've did once again the search and now remember where i've found... the file was taken from this website: http://paulmason.name/item/search-engine-friendly-sef-urls-for-virtuemart
(in fact it's an old post, but it's working until now... only miss the correct name call of the VM frontend Modules..)

If i use the actual version of router.php the product filter doesnt work with SEF "On" but works with SEF off ..
maybe this file could solve some forum members problems

best regards
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: PRO on March 10, 2013, 17:50:47 PM
Quote from: lipes on March 09, 2013, 06:17:18 AM
yet in the 2.0.18b but  that router.php file it's an old file that as been used to filter work with SEF...
i've did once again the search and now remember where i've found... the file was taken from this website: http://paulmason.name/item/search-engine-friendly-sef-urls-for-virtuemart
(in fact it's an old post, but it's working until now... only miss the correct name call of the VM frontend Modules..)

If i use the actual version of router.php the product filter doesnt work with SEF "On" but works with SEF off ..
maybe this file could solve some forum members problems

best regards


which product filter?
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: lipes on March 10, 2013, 18:38:55 PM
ChP
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: PRO on March 10, 2013, 23:54:29 PM
cpb?

sounuds like its not coded correctly. Have you reported this to them,?
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: lipes on March 11, 2013, 01:23:05 AM
yep, i've talked some times with Maks .. but the support for my old version is over :-/
also got the last router.php in the website to download but now it's only for the new versions...

I will have to made some more tests to try to find a way to combine this old router.php file and the new one (2.0.18c) to discover a way to call the correct SEF name from the frontend modules..
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: lipes on March 12, 2013, 11:50:02 AM
humm..
The problem it's related with having "&Itemid=" or not... (with this "&Itemid=" the SEF link works good, like i got in the top menu that is assined for every VM category)...

and by the other hand in the frontend index.php with Virtuemart Products Module .. the links doesnt have the "&Itemid="  ...
So thats the problem in router.php...
so maybe it's needed to find where is the "damm" php code that call all the frontend VM product module links and maybe put any kind of "&Itemid=" to see if works..
i'll go crazy....

edit.. (I think that it's related with this code lines) from the new Router that works:
if ($helper->edit) return $segments;

/* Full route , heavy work*/
// $lang = $helper->lang ;
$view = '';

$jmenu = $helper->menu ;

if(isset($query['langswitch'])) unset($query['langswitch']);

if(isset($query['view'])){
$view = $query['view'];
unset($query['view']);
}


and this lines from the old router..:
if ( isset($query['virtuemart_category_id']) ) {
if (isset($jmenu['virtuemart_category_id'][ $query['virtuemart_category_id'] ] ) )
$query['Itemid'] = $jmenu['virtuemart_category_id'][$query['virtuemart_category_id']];
else {
$categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
if ($categoryRoute->route) $segments[] = $categoryRoute->route;
if ($categoryRoute->itemId) $query['Itemid'] = $categoryRoute->itemId;
}
unset($query['virtuemart_category_id']);
}

Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: badvoicila on March 19, 2013, 23:45:16 PM
help
Befor pot a Review

http://www.ex.com/cercei/cercei-fimo/floricica-orange-detalii.html


After post a Review

http://www.ex.com/component/virtuemart/floricica-orange-detalii.html



?????
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: PRO on March 22, 2013, 01:54:05 AM
After you hit submit?
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: franzpeter on April 14, 2013, 12:02:04 PM
Can someone explain me, what SamF means? As far as I do understand, it is good to create a Joomla menu entry for the VM frontpage. The menu entry should not receive a front end module or should not be visible in a front end menu module, but it should be set as default page or start page. So the start page is the VM frontpage but not represented in a Joomla module. What difference does it make to create a visible menu entry as start page with VM frontpage and call it for example Home or so? Is it better for crawlers or SEO to not officially use the VM frontpage? I do not understand why it should be useful to hide the start page entry (VM frontpage as homepage) in a mainmenu, because the VM frontpage is still the default start page, even if not represented in a visible menu entry. But maybe someone can explain it!

I do see the /component/virtuemart/ too, but it only occurs if an action like add to cart takes place and than with the continue shopping button. I did deactivate the add to cart from the Virtuemart front page, so the problem remains hidden. I think the true problem has to do something with not retrieving the root entry for VM from Joomla menu. It does not happen while adding a product to cart from a category page and then going to cart and click there on 'continue shopping'. Here VM redirects to the correct category to list products or add something to cart. It only happens if there is no category available, as from the VM frontpage (featured, newest ... products). Selecting a product there without add to cart actions goes to the product page with correct path, only the add to cart from the VM frontpage produce problems.
Title: Re: How Do I remove "/component/virtuemart/" or rename in the URLS??
Post by: pietrek on May 05, 2014, 10:34:10 AM
Hello,

J. 2.5.14
VM 2.6

I created couple of menu items, some of them have nice short links but some of them not.
Short links:
http://www.dompaneli.pl/sensual
http://www.dompaneli.pl/aroma

ugly links:
http://www.dompaneli.pl/com-virtuemart-menu-configuration/excellence
http://www.dompaneli.pl/com-virtuemart-menu-configuration/solution
and others...

Each link is a top level category. It looks to me, as it works properly/wrong depending on menu-module, but I don't see differences between menus settings, other than css classes.

I did not change any settings in configuration etc. when I was adding new menu items.
I've read this topic (initially I didn't have special menu for VM with its front page layout menu item.) followed the instructions, and nothing changed...
Is there any other place/option to make changes and have nice short addresses?
Regards, Pietrek