Magento : menu items order
Posted by lhe | Posted in Coding, Databases, E-Commerce, Magento, MySQL, PHP | Posted on 19-10-2010
5
We have been working on some Magento e-shops and it needs to be said, its a nice enough system.
However, it is not a CMS. This means that when you create pages, you dont have all the freedom you would enjoy when using Drupal or WordPress for example.
You can create pages and they will appear in the main menu. But then you start looking at the sort order of those menu items.
Guess what, nothing to be found in the admin interface to control it. So you go ” NOOOOOOOOOOoooooooooo….”……
No panic! Stay calm… with some minor db data changes and a little coding we can get it all to work.
First of all, let’s ask the obvious question “Why on earth is it not a standard admin function to be able to manipulate the page order?”
No idea, but it is foreseen in the database.
In the table
cms_page
you will find a collumn called
sort_order
. You can use this collumn to decide on the order.
Go refresh your page… Nothing changed, right? Hehe, well you need to do one more thing.
Open this file :
magento/app/design/frontend/default/maried/template/catalog/navigation
Find this line (should be line number 60):
$cms_pages->getSelect()->where('is_active = 1');
And add the sortorder so the line becomes :
$cms_pages->getSelect()->where('is_active = 1')->order('sort_order');
Now go and refresh your page… TADA!!!


