VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: uschmi on April 20, 2012, 15:38:12 PM

Title: How to get ride of ugly SEF-URLs?
Post by: uschmi on April 20, 2012, 15:38:12 PM
I´m not able to create nice looking SEF urls.
- Joomla 2.5.4
- VM 2.0.6
- Joomla SEF enabled
- URL Rewrite enabled
- VM SEF enabled
- Menu home item points to VM frontpage
- Menu item for each category and for each product created

My URLs look like "http://www.mydomain.de/products/my-category/my-product.html?virtuemart_product_id=143&virtuemart_category_id=2"
They should look like "http://www.mydomain.de/products/my-category/my-product.html"

How to solve this?
Title: Re: How to get ride of ugly SEF-URLs?
Post by: PRO on April 20, 2012, 16:10:57 PM
what happens when you change the home to a joomla article etc.

and leave the shop link to non-home?
Title: Re: How to get ride of ugly SEF-URLs?
Post by: AlexAkhremenko on April 20, 2012, 16:26:08 PM
Modify /components/com_virtuemart/router.php, line 130-135 from:

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
} else {


to

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
} else {


Simply added:
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
Title: Re: How to get ride of ugly SEF-URLs?
Post by: jjk on April 20, 2012, 16:34:00 PM
Quote from: uschmi on April 20, 2012, 15:38:12 PM
How to solve this?

This would be the normal url if you have 'SEO Disabled' checked in VM2 'Configuration' - 'SEO' tab. (No need to hack the code)
Title: Re: How to get ride of ugly SEF-URLs?
Post by: uschmi on April 20, 2012, 17:17:13 PM
Quote from: BanquetTables.pro on April 20, 2012, 16:10:57 PM
what happens when you change the home to a joomla article etc.

and leave the shop link to non-home?

this changes nothing for the product-urls...
Title: Re: How to get ride of ugly SEF-URLs?
Post by: uschmi on April 20, 2012, 17:20:08 PM
Quote from: AlexAkhremenko on April 20, 2012, 16:26:08 PM
Modify /components/com_virtuemart/router.php, line 130-135 from:

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
} else {


to

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
} else {


Simply added:
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);


This creates perfect urls!!! :)
Shouldn´t this be included into the source?
Title: Re: How to get ride of ugly SEF-URLs?
Post by: AlexAkhremenko on April 20, 2012, 17:36:39 PM
Quote from: uschmi on April 20, 2012, 17:20:08 PM
This creates perfect urls!!! :)
Shouldn´t this be included into the source?

I think, they should. But I don't know, how to do this. I'm from Belorassian and english is not my native.  I'm not versed with how to communicate with developers.
Title: Re: How to get ride of ugly SEF-URLs?
Post by: PRO on April 20, 2012, 17:53:25 PM
no, it shouldnt

THERE is something else in your setup wrong, or conflicting

SEF urls work great with 2.0++
Title: Re: How to get ride of ugly SEF-URLs?
Post by: AlexAkhremenko on April 20, 2012, 18:00:48 PM
QuoteTHERE is something else in your setup wrong, or conflicting
Do you realy test this issue?  >:(
I also encountered this problem and looking for a solution.
Title: Re: How to get ride of ugly SEF-URLs?
Post by: jjk on April 20, 2012, 18:23:19 PM
Quote from: AlexAkhremenko on April 20, 2012, 18:00:48 PM
I also encountered this problem and looking for a solution.
If you see an URL that includes EXACTLY the same as what has been marked in red in the first post (ids might be different of course), then you probably have "SEO disabled" activated in VM2 configuration.
If you configured everything correctly, Joomla 2.5.x/VM2.0.x produces URLs like domainname/categoryname/productname.details (or .html if you changed the suffix)
Title: Re: How to get ride of ugly SEF-URLs?
Post by: uschmi on April 20, 2012, 18:26:31 PM
Quote from: jjk on April 20, 2012, 18:23:19 PM
Quote from: AlexAkhremenko on April 20, 2012, 18:00:48 PM
I also encountered this problem and looking for a solution.
If you see an URL that includes EXACTLY the same as what has been marked in red in the first post (ids might be different of course), then you probably have "SEO disabled" activated in VM2 configuration.
If you configured everything correctly, Joomla 2.5.x/VM2.0.x produces URLs like domainname/categoryname/productname.details (or .html if you changed the suffix)

Sorry, but I have to answer back: I had this issue in all VM 2.0.x versions, even with standard Joomla installation a.s.o. And VM2 SEF is definitely configured "SEF enabled" (the SEF-disabled option not checked).
Title: Re: How to get ride of ugly SEF-URLs?
Post by: AlexAkhremenko on April 20, 2012, 18:38:04 PM
Quote from: uschmi on April 20, 2012, 15:38:12 PM
I´m not able to create nice looking SEF urls.
- Joomla 2.5.4
- VM 2.0.6
- Joomla SEF enabled
- URL Rewrite enabled
- VM SEF enabled
- Menu home item points to VM frontpage
- Menu item for each category and for each product created

My URLs look like "http://www.mydomain.de/products/my-category/my-product.html?virtuemart_product_id=143&virtuemart_category_id=2"
They should look like "http://www.mydomain.de/products/my-category/my-product.html"

How to solve this?

Read carefully, please!
He says: "VM SEF enabled" and "Menu item for each product created". In this example ".html" is not a VM-suffix, it is Joomla SEF suffix, that is set in Joomla SEF configuration.
Try this and you will see!
Title: Re: How to get ride of ugly SEF-URLs?
Post by: Milbo on April 22, 2012, 20:22:36 PM
Quote from: AlexAkhremenko on April 20, 2012, 18:38:04 PM
"Menu item for each product created". In this example ".html" is not a VM-suffix, it is Joomla SEF suffix, that is set in Joomla SEF configuration.
Try this and you will see!

I think this is exactly the difference to the normal use of this view. I am going to add your fix.
Title: Re: How to get ride of ugly SEF-URLs?
Post by: tepublico on April 24, 2012, 13:49:44 PM
Quote from: uschmi on April 20, 2012, 17:20:08 PM
Quote from: AlexAkhremenko on April 20, 2012, 16:26:08 PM
Modify /components/com_virtuemart/router.php, line 130-135 from:

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
} else {


to

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
} else {


Simply added:
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);


This creates perfect urls!!! :)
Shouldn´t this be included into the source?

At my web site:

http://lentillas-de-colores.com/
Have the same problem with the friendly url in the products,

I think the solution is very good, but the last point:

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
} else {


i don´t know what file have to modify.

Title: Re: How to get ride of ugly SEF-URLs?
Post by: uschmi on April 24, 2012, 14:09:22 PM
Tepublico,
modify /components/com_virtuemart/router.php, line 130-135
Title: Re: How to get ride of ugly SEF-URLs?
Post by: incineratorbg on June 21, 2012, 10:34:26 AM
Quote from: AlexAkhremenko on April 20, 2012, 16:26:08 PM
Modify /components/com_virtuemart/router.php, line 130-135 from:

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
} else {


to

case 'productdetails';
$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
} else {


Simply added:
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);



Hello,

I`ve added this lines to router.php but nothing happend on my site . http://atraktivna.com/component/virtuemart/97/14/tuniki/tunika-moli-detail?Itemid=0

Can you help, please?
Title: Re: How to get ride of ugly SEF-URLs?
Post by: jjk on June 21, 2012, 12:54:39 PM
That fix is as well as another router fix is included in the latest 2.0.7g version, but as mentioned in another post already, it might be a problem with your GA e-sport template menu. Maybe you should describe your problem to Gavick support. SEF Urls work fine with other templates.

However, first check if your Joomla and VM2 SEF is enabled. At present your site looks like there is no SEF enabled at all.
Title: Re: How to get ride of ugly SEF-URLs?
Post by: Dokho on June 25, 2012, 16:29:17 PM
Excelent solution, I have SEF disable because the HTTPS solution give me for BanquetTables.pro only works without SEF (thanks a lot), so when I disabled this option, enabled the virtuemartRedirect and I added this code to router.php my site begin to work so good.

Excuse me about my english : ).