• Home
  • Get help
  • Ask a question
Last post 9 hours 21 min ago
Posts last week 89
Average response time last week 30 min
All time posts 67739
All time tickets 10468
All time avg. posts per day 21

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#3007 – Other menus

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Sunday, 27 November 2016 18:24 UTC
miojamo
Hi,

How can sh404 fetch all the menus? I have menus but they not being fetched till published and visible on the site which I do not want as I create manual links e.g.

Main menu
- Product 1 [alias for product 1 features]

Second menu
- Product 1
- - Features


Second menu is not being seen. How can I tell sh404 to harvest the second menu without publishing it?

Thanks.


 
Monday, 28 November 2016 09:02 UTC
wb_weeblr
Hi

I don't understand this phrase:

I have menus but they not being fetched till published and visible on the site
How can a menu be viewed by users if it's not published?

What do you use to make them show when sh404SEF is disabled? Joomla itself will not show a menu that's not published.

Rgds
 
Monday, 28 November 2016 09:06 UTC
miojamo
Menu is published but menu module is not. It worked before sh404 activated.

Even if the menu module is not published on the site the menu still works and can be accessed by it's structure:

/product1/features

SH404 however does not see it I think it should see all the menus created even if not published.
Monday, 28 November 2016 09:13 UTC
wb_weeblr
Hi

OK, not sure I understand the problem: you said the problem was that the menu was not displayed? or something else?

can be accessed by it's structure:



/product1/features
Do you mean "can be accessed by this URL /products1/features"?

sh404SEF does not use menu items at all. So a "product" (or any page) cannot be accessed using whatever you used as menu items.

URLs are built with the articles names and categories (with many settings to choose the URL structure). But in general we absolutely do not use the menus.

Also, this is totally different depending on the type of content. For instance with Virtuemart, we sometimes used some menu items, but it's very rare.

WIth Joomla articles, categories, etc we simply do not use the menus to build URLs.

Rgds
 
Monday, 28 November 2016 09:26 UTC
miojamo
So do I need to publish all menu modules so sh404 can fetch all the links and than unpublish them?

I use custom php code to display menus within custom html module.

Is there anything else I can do? I do not want to create all links manually in sh404
Monday, 28 November 2016 09:45 UTC
wb_weeblr
Hi

I use custom php code to display menus within custom html module.
Well why is your custom code not displaying the menus?

Rgds
 
Monday, 28 November 2016 10:21 UTC
miojamo
Menus are being displayed however sh404 does not see them.
Monday, 28 November 2016 10:24 UTC
wb_weeblr
Hi

Menus are being displayed however sh404 does not see them.
sh404SEF does not "see" menus or anything.

Joomla API says that SEF URLs are created when non-sef links are passed through the JRoute::_() function. If you do not follow the Joomla API and do not pass non-sef links through JRoute::_() method, then it's normal and expected that SEF URLs are not created.

What code do you use to display links? do you follow the Joomla API and use JRoute?

Rgds
 
Monday, 28 November 2016 11:04 UTC
miojamo
Here is the code I use:

$app = JFactory::getApplication();
$menu = $app->getMenu();
$menu_items = $menu->getItems('menutype', 'mymenu');

$lastEl = end($menu_items);
foreach ($menu_items as $item):
if ($item->level == 2):
if ($item == $lastEl):
echo "<li><a href='" . $item->alias . "'> <i class=\"uk-icon-shopping-bag\"></i> " . $item->title . "</a><li>";
elseif ($item->type == 'url'):
echo "<a href='".$item->link."' target='_blank'>".$item->title."</a>";
else:
echo "<li><a href='".JURI::base().$item->route . "'>".$item->title . "</a><li>";
endif;
endif;
endforeach; ?>
Monday, 28 November 2016 11:27 UTC
wb_weeblr
Hi

<a href='".JURI::base().$item->route . "'


Yes, this is incorrect and is causing the behavior you are seeing. I would suggest you look at the original Joomla module code for the right way to display links (in /modules/mod_menu/helper.php). The quick way would be something like that:
if (strcasecmp(substr($item->link, 0, 4), 'http') && (strpos($item->link, 'index.php?') !== false))
					{
						$item->link = JRoute::_($item->link, true, $item->params->get('secure'));
					}
					else
					{
						$item->link = JRoute::_($item->link);
					}


This simplified code willl of course work only for a limited set of menu items, ie not nested menus, etc

We can't provide support for custom coding, but by looking at the original menu module, you should be able to fix the problem. Whatever code you use, using JRoute is totally mandatory anyway.

Rgds
 
Monday, 28 November 2016 11:29 UTC
miojamo
Thanks I will try this
Monday, 28 November 2016 12:59 UTC
miojamo
I works :) thanks a lot

I have another question:

URL's are build from the article alias. Is it ok so the articles have the same alias? eg.:

/product1/features
/product2/features

I've checked it and it works, however I'm not sure it is correct.






Monday, 28 November 2016 13:38 UTC
wb_weeblr
Hi

It doesn't matter as long as the entire URL is unique. From an SEO standpoint, and just basic operation, each page must have a unique URL.

So if 2 articles have the same alias, but are in different categories - and you choose to keep the categories in URLs, you're good. If you select to remove categories from URLs, you have to make sure you have different aliases.

Rgds
 
Monday, 28 November 2016 13:42 UTC
miojamo
thanks great support!
Monday, 28 November 2016 13:44 UTC
wb_weeblr
Hi

You're welcome... Closing this ticket now, feel free to open a new one as needed. If you do so, please mention this ticket number in the new one.

If you created any superadmin account for us, be sure to delete or block it now to avoid unnecessary risk in the future.

Be sure to also check out wbAMP, our new Accelerated Mobiles pages plugin for Joomla - the next big thing is SEO, direct from Google themselves!

Rgds
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.