News:

Support the VirtueMart project and become a member

Main Menu

How to get ride of ugly SEF-URLs?

Started by uschmi, April 20, 2012, 15:38:12 PM

Previous topic - Next topic

uschmi

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

what happens when you change the home to a joomla article etc.

and leave the shop link to non-home?

AlexAkhremenko

#2
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']);

jjk

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)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

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...

uschmi

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?

AlexAkhremenko

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.

PRO

no, it shouldnt

THERE is something else in your setup wrong, or conflicting

SEF urls work great with 2.0++

AlexAkhremenko

#8
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.

jjk

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)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

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).

AlexAkhremenko

#11
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!

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

tepublico

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.


uschmi

Tepublico,
modify /components/com_virtuemart/router.php, line 130-135