cancel
Showing results for 
Search instead for 
Did you mean: 

Product Url not generating perfectly

Product Url not generating perfectly

Hello All

 

I m facing one Issue as below

 

I have created 1 product and assign it to category id 4 and create one product without category when i call 2nd product model

in 1st product detail page then it gives url link http://yoururl/categoryid4/producturl.html. instead of http://yoururl/producturl.html.

 

I debug the code and found that it's a magento core functionaliy issue, it takes parent category id during fetching the url

 

If anyone has its solutions please help.

 

regards

Hitesh

 

 

 

 

 

 

 

 

 

 

 

 

 

2 REPLIES

Re: Product Url not generating perfectly

Re: Product Url not generating perfectly

Hello

 

Thanks for your reply but it is not my solutions

 

Do below steps in your fresh magento so you will get exact idea what i means to say

 

1) Create 2 Different Category like 1 is computer and 2nd is Mobile

2) Create 2 product and assign 1 product to Computer and 2nd to mobile category

3) open view.phtml and after $_product variable add below code

$product=Mage::getModel('catalog/product')->load(enter2ndproductidhere);

echo $product->getProductUrl();

4) Save view.phtml file

5) Open 1st Product Full Url with Category path like http://yoururl/computer/1stproduct.html

6) See 2nd Product url in your product detail page you wil get url like http://yoururl/computer/2ndproduct.html instead of

http://yoururl/mobile/2ndproduct.html

 

please let me know if any query.