Author Topic: How to get ride of ugly SEF-URLs?  (Read 9356 times)

uschmi

  • Jr. Member
  • **
  • Posts: 108
How to get ride of ugly SEF-URLs?
« 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?

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10369
  • VirtueMart Version: 3+
Re: How to get ride of ugly SEF-URLs?
« Reply #1 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?
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

AlexAkhremenko

  • Beginner
  • *
  • Posts: 9
    • Serenity
Re: How to get ride of ugly SEF-URLs?
« Reply #2 on: April 20, 2012, 16:26:08 pm »
Modify /components/com_virtuemart/router.php, line 130-135 from:

Code: [Select]
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

Code: [Select]
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:
Code: [Select]
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3524
  • using Matomo instead of Google Analytics
Re: How to get ride of ugly SEF-URLs?
« Reply #3 on: April 20, 2012, 16:34:00 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)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

  • Jr. Member
  • **
  • Posts: 108
Re: How to get ride of ugly SEF-URLs?
« Reply #4 on: April 20, 2012, 17:17:13 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...

uschmi

  • Jr. Member
  • **
  • Posts: 108
Re: How to get ride of ugly SEF-URLs?
« Reply #5 on: April 20, 2012, 17:20:08 pm »
Modify /components/com_virtuemart/router.php, line 130-135 from:

Code: [Select]
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

Code: [Select]
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:
Code: [Select]
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);

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

AlexAkhremenko

  • Beginner
  • *
  • Posts: 9
    • Serenity
Re: How to get ride of ugly SEF-URLs?
« Reply #6 on: April 20, 2012, 17:36:39 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.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10369
  • VirtueMart Version: 3+
Re: How to get ride of ugly SEF-URLs?
« Reply #7 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++
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

AlexAkhremenko

  • Beginner
  • *
  • Posts: 9
    • Serenity
Re: How to get ride of ugly SEF-URLs?
« Reply #8 on: April 20, 2012, 18:00:48 pm »
Quote
THERE 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.

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3524
  • using Matomo instead of Google Analytics
Re: How to get ride of ugly SEF-URLs?
« Reply #9 on: April 20, 2012, 18:23:19 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)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

  • Jr. Member
  • **
  • Posts: 108
Re: How to get ride of ugly SEF-URLs?
« Reply #10 on: April 20, 2012, 18:26:31 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).

AlexAkhremenko

  • Beginner
  • *
  • Posts: 9
    • Serenity
Re: How to get ride of ugly SEF-URLs?
« Reply #11 on: April 20, 2012, 18:38:04 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!

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9943
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: How to get ride of ugly SEF-URLs?
« Reply #12 on: April 22, 2012, 20:22:36 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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

tepublico

  • Beginner
  • *
  • Posts: 2
  • Tepublico.es diseño web y publicidad en internet
    • http://tepublico.es
Re: How to get ride of ugly SEF-URLs?
« Reply #13 on: April 24, 2012, 13:49:44 pm »
Modify /components/com_virtuemart/router.php, line 130-135 from:

Code: [Select]
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

Code: [Select]
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:
Code: [Select]
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:

Code: [Select]
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.


uschmi

  • Jr. Member
  • **
  • Posts: 108
Re: How to get ride of ugly SEF-URLs?
« Reply #14 on: April 24, 2012, 14:09:22 pm »
Tepublico,
modify /components/com_virtuemart/router.php, line 130-135