Reputation: 159
In Magento I have this to get the the url of a category from its ID
$categoryLink = Mage::getModel("catalog/category")->load(10)->getUrl();
It works but at the end of url there is ?SID=somenumber
.
I know I could remove it from
System > Configuration > Web > Session Validation Settings > Use SID on Frontend
But I want to keep it active, so how can i get the url of category without the ?SID=somenumber
?
Upvotes: 2
Views: 3903
Reputation: 767
$params = array(
'_nosid' => true
);
$url = Mage::getUrl('*/*/*', $params);
Upvotes: 6
Reputation: 4564
You can configure this from admin panel :
Go to Admin == System == Configuration == Web == Session Validation Settings
and disable
config Use SID on Frontend = No
Upvotes: 1
Reputation:
Try this:
$categoryLink = Mage::getModel("catalog/category")->load(10)->getUrl();
$pos = strpos($categoryLink, '?');
$categoryLink = ($pos>0) ? substr($categoryLink, 0, $pos) : $categoryLink;
Upvotes: 4