Categories view link to categories with existing menu item
Posted: 19 Feb 2016, 03:18
Hello.
Thanks for this great component!
I've got some categories (name, othername) that I am showing with their own category view menu items. They have URLs of 'domain.com/product/name/gallery', 'domain.com/product/othername/gallery'. I also have some categories that do not have a category view menu item.
I also have a categories menu item, and on categories menu item page the link to a category with an existing menu item (as above) does not show the same link as above, but rather it adds '/category/id-name', '/category/id-othername' to the end of the link. I'd like to stop this from happening to eliminate duplicate URLs.
I've attempted with a template override in categories/default_categories.php
I looked at the Link on the menu item (in the Joomla Admin CP) of one of the categories above which has URL of 'domain.com/product/name/gallery'' and it's Link is 'index.php?option=com_phocagallery&view=category&id=1'.
I looked at the raw URL in $cv->link in the view. For categories with an existing menu item (as above) it is 'index.php?option=com_phocagallery&view=category&id=1:name&Itemid=181'. For categories without a menu item it is 'index.php?option=com_phocagallery&view=category&id=1:name'
I have used string manipulation to strip the ':name&Itemid=181' off the end of the URL (if Itemid parameter exists) to make the URL match exactly the same as the Link found on the menu item in the Joomla Admin CP. I thought that this would link the categories with existing menu items to the same URL as the menu item, however it does not.
Can anyone explain why this does not work?
Thanks for any advice.
Thanks for this great component!
I've got some categories (name, othername) that I am showing with their own category view menu items. They have URLs of 'domain.com/product/name/gallery', 'domain.com/product/othername/gallery'. I also have some categories that do not have a category view menu item.
I also have a categories menu item, and on categories menu item page the link to a category with an existing menu item (as above) does not show the same link as above, but rather it adds '/category/id-name', '/category/id-othername' to the end of the link. I'd like to stop this from happening to eliminate duplicate URLs.
I've attempted with a template override in categories/default_categories.php
I looked at the Link on the menu item (in the Joomla Admin CP) of one of the categories above which has URL of 'domain.com/product/name/gallery'' and it's Link is 'index.php?option=com_phocagallery&view=category&id=1'.
I looked at the raw URL in $cv->link in the view. For categories with an existing menu item (as above) it is 'index.php?option=com_phocagallery&view=category&id=1:name&Itemid=181'. For categories without a menu item it is 'index.php?option=com_phocagallery&view=category&id=1:name'
I have used string manipulation to strip the ':name&Itemid=181' off the end of the URL (if Itemid parameter exists) to make the URL match exactly the same as the Link found on the menu item in the Joomla Admin CP. I thought that this would link the categories with existing menu items to the same URL as the menu item, however it does not.
Can anyone explain why this does not work?
Thanks for any advice.