Try the Demo

Magento

eCommerce Software for Online Growth

Magento Forum

Our new hosted solution for small & emerging businesses
   
Product URL rewrite
 
jsx7
Jr. Member
 
Total Posts:  9
Joined:  2008-08-11
 

Hello All,

usually we can see a product in magento with two URLs: htp://mysite.com/some-category/some-product.html or htp://mysite.com/some-product.html. I need to have all products visible by URL like htp://mysite.com/products/some-product.html. Most obvious way is to add a category ‘products’ and link all products to this category, but we have a few thousands of products in the catalog, so I’d like to do it in some programmatic way. Please give me a suggestion in which way I could do it? Now my idea is to overload class Mage_Core_Model_Url_Rewrite but I’m not sure if it is good idea.

Thanks in advance,
Alexander

 
Magento Community Magento Community
Magento Community
Magento Community
 
mpatel1748
Jr. Member
 
Total Posts:  17
Joined:  2009-07-01
 

Hey

I am also looking out for same but i didn’t find any solutions...please if any buddy got solutions for above post kindy help me to sort it out

 
Magento Community Magento Community
Magento Community
Magento Community
 
butterbrot
Member
 
Total Posts:  51
Joined:  2008-10-26
 

Hmm maybe have a play around with the function

Mage_Catalog_Model_Url::generatePath();
at if (’request’ === $type) {...}

on line 571 at

return $this->getUnusedPath($category->getStoreId(), ‘product/’ . $categoryUrl . ‘/’ . $urlKey . $productUrlSuffix,
$this->generatePath(’id’, $product, $category)
);

not tested or anything but give it a try, you have to refresh your rewrites under admin->system->cache

 
Magento Community Magento Community
Magento Community
Magento Community
 
dannygerst
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2010-09-10
 

Hi,

does anyone have a solution for that. My products are shown like http://www.uphive.de/call-of-duty-2-pc.html but I like that there are look like this http://www.uphive.de/videospiele/pc/call-of-duty-2-pc.html, meaning adding the category. I looked into the URL rewrite Management and I found three rules for that product.

call-of-duty-2-pc.html
videogames/call-of-duty-2-pc.html
videogames/pc/call-of-duty-2-pc.html

I like to set the last rule active for all kind of products. Putting the categories before the product urlkey

Any ideas?

Thanks in advanced,

Danny

 
Magento Community Magento Community
Magento Community
Magento Community
 
dannygerst
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2010-09-10
 

I wonder that there is noone who can answer this question. I saw a lot of people complaining that our problem is their solution. By default magento should present the products like we want it with the category url key, but on my site this does not work.

The product name is without the category url even I selected it in the admin menu. Why is that so?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagentoECG
Magento Team
 
Avatar
Total Posts:  189
Joined:  2011-02-25
Worldwide
 

Hi all.
The problem is that 1 product can belong to several categories at once, that’s why if we can’t be sure that we are now in the category scope (I mean product listing), we can’t add category key to product url, because we don’t know exactly which one.
I also faced with this problem before, and I saw only one solution - get collection from all url rewrites which is related to current product and take the first one which has category_id != null. But it looks like hack smile because, in fact, we are getting “random” product url (if we have more than 1)
So, if you fit such kind of solution and you have a questions how to do that, please, write, I’ll try to help.

<DS>

 Signature 

The Magento Expert Consulting Group’s mission is to help users get the most from their Magento installation. To learn more about the Magento Expert Consulting Group and our activities in the forum visit http://www.magentocommerce.com/boards/viewannounce/221910_2/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
© Copyright 2012 Magento Inc.
Privacy Policy|Terms of Service
Magento Community Count
697453 users|1829 users currently online|496729 forum posts