![]() |
Passing Category Clean URL
Hello, I am having trouble getting the clean url of product category then pass it to a variable template.
here's my sample code in bread_crumbs.tpl: Code:
<span itemprop="url" url="{$http_location}/{$l.1}" title="{$l.0}">{$l.0}</span> I am getting Code:
<span itemprop="url" url="http://localhost/home.php?cat=12" title=Category name>Category name</span> instead of Code:
<span itemprop="url" url="http://localhost/category-name/" title=Category name>Category name</span> clean url are working if you use that in href tags |
Re: Passing Category Clean URL
I see several ways to get the clean URL, not sure which to advise you to use. For instance, on a category page we have:
{$php_url} - returns the whole string "http://yourdomain.com/this-category-url/" {$canonical_url} - returns just "this-category-url/" {$current_category.clean_url} - returns "this-category-url/" as well On the product page {$canonical_url} returns "this-product.html" and {$php_url} gives "http://yourdomain.com/this-product.html" Hope that helps. |
Re: Passing Category Clean URL
Those solution might work if I am on the category page, But since I am on the product page it would return the product clean url. What I want is get the clean URL on the bread_crumbs.tpl on which the product categories are located.
|
Re: Passing Category Clean URL
Okay. Now I understand. That is going to be difficult, I'm afraid.
You are going to have to query the DB, and assign the product's category's clean URL to an array. I think I can put you on the right track. On the product page, it looks like the $location array is being built near line 292, with this snippet of code: Code:
// Get category location |
Re: Passing Category Clean URL
I was able to get the clean url of categories by using func_clean_url_get function on my product page and then add an entry to my location array.
|
Re: Passing Category Clean URL
Chistian, thanks for providing your final solution. It would be even better if you shared the completed code.
|
All times are GMT -8. The time now is 02:52 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.