12

Link manager and menu maker for osCommerce version 2.3.1

multimixer | work | Wednesday March 9 2011

Links are one of the most important parts on a online store. It’s basically the only way to get from one page to an other. Unfortunately, the default osCommerce doesn’t make it very easy to add new links. There is no other way than to type them directly into the php files. And there is just one box that is supposed to display links, the “information” box.

There are all the time questions from people about how to add a link here or there, questions about how to place it into the code and about the same amount of wrong links, for example links that do not hold the necessary session id.

So I thought why should this be so hard? Why not to be able just to type in any links to anywhere I like and then to display them easily on my webstore without having to alter any file? So first I went to the addon section of osCommerce to take a look. Yes, there are a couple of link managers, but they don’t do exactly what I want. They are all kind of “link exchange” orientated, and this was not my need. Then I saw Gary’s blog post about his own version of a link manager and this gave me the final motivation to start dong my own thing.

For the impatient readers, the result in short: What I did is a link manager and menu creator, completelly to manage from the osCommerce administration panel

  • Link manager I call the admin interface to create links and to organize them into groups. I can type in any links and I can create groups and subgroups of any depth, and to add to each group any type of links: links to internal osCommerce pages (eg privacy.php), link to external websites, links to product categories or links to products themselves.
  • Menu maker I call the various ways I got to display that links and link groups on the website, for example on the main navigation bar or in boxes. Here I have various configuration options to adjust the content, lay out and colors of the menus completely to the  needs of the website. Again, without having to touch any file.

Little more in detail now and first about the part to create and organize links, what I call “link manager”.

Link manager: Create and organize links

The whole setup is very similar to the way products and categories are created, just one difference. While products and categories are manage from one and only file (admin/categories.php), and that any product has to be part of a category, my link manager works different: There is one part just to enter links, something like a “link-pool”, and an other part to make the groups.

This comes from the simple conclusion, that a link can be a member of many groups, so it would be confusing to enter a link as part of a group and then to start to copy it to here and there. Much better to have such a link pool, where I can have a complete overview of all my links.

Such an overview look like this

Link manager: The link pool

The overview can be filtered to show only external or only internal links

How to add new links? Very easy. Links to internal osCommerce pages are added automatically. In case there are any new files, there is a button “update” that will add them. External links need to be added manually. There is no link exchange function and such. The store owner adds manually any link to any page he want to link to from his store. Simple and clean

For a new link you can add a link name, a link description (that will be the title) and of course the url (without any http://). Next you can decide if you want the link to be active or not, and also to what visitor group in should be visible: To registered users, not registered users or all users. Thats necessary for links to pages like login.php or logoff.php. Any link, internal or external can be edited any time of course. The screen look like this

Add and edit links

Thats it regarding creating links, nothing else to do. Next step is to organize this links into groups. For that there is an other page respnsible, called “link groups”. The overview here look like this

Link groups overview

Much similar to categories, not? Here you can create as many groups and sub groups you like. You can also delete that groups, you can move them and you can copy them. And of course you can add links to them ! The screen to add links to groups look like this

Add links to link groups

All links of the link pool are available. You can set for each link if you want it to open in the same or in anew window. An other thing you can do is to add product categories, and you can also decide what category you want to add.

An other thing you can do is to add a url to the group title. That means to make the group title to be a link it self. This makes a sense if the group is going to be part of a larger menu

Add a url to the link group title

Again you have all links available, you can decide if you want the link to open in the same or in a new window, and you can also have the category to be the link target, in case the link group include product categories

Next step is to display the links, thats the job of the menu creator

Menu creator: Display your links in a nice way

There are many areas where links could be displayed, for now I set up 2 areas: The main navigation bar and the “link boxes”.

  • The main navigation bar will display the links in a drop down way
  • The “link boxes” will do the same, using a fly out effect

Both do use the “superfish” jQuery script, I plan to add more display ways, like tree, accordion etc. Also more areas to display the links, like the footer and whatever else I will think of

Let’s concentrate on what is now. And what is now are really many configuration options, like everything somebody could think of when setting up a menu. The point here: Everything is done per mouse click in the administration panel of osCommerce. The interface for the navigation bar for example has more than 30 different configuration options the image is too large to post it here.

For example you can decide to show the “search” in the header or not, to show products in the menu or not, you can decide if you want the width of the top level menu items to be set automatically or manually (to adjust to vary long or very short items), you can set the height and width of the menu tabs on top level and the sub levels, you can decide to use “supersubs” or not (that’s to adjust  the width of the submenus to it’s content automatically), you can set colors about anything you can imagine and so on.

Here are some screenshots of the main navigation bar

Categories in the main navigation bar

Full width and thick navigation bar

Very thin navigation bar showing categories only and no search

Same of course you can do with the vertical fly out menus. This you can use also to create separate menu boxes per category

Separate menus per category

Configuration options are like unlimited too

Redmond blue style menu

Matching pepper menu

I hope you noticed that the vertical menu can fly out to the left or to the right depending on where the box is located.

If you are interested in more details you can read here about.

And you can see it in action here

The link manager and menu maker is installed by default into mini template system as a core feature, but I could also imagine it as a standalone solution for any osCommerce store, I just don’t know if there is any interest for this.

Well, that’s all nice and fine, what I want to do now is to tell you a little about what caused some headache when developing this system

  • To make an order to all that ul’s and li’s that have to open and close in the right moment. That’s not that hard if you have just categories or just link groups in a menu, but it is getting more and more complicated if you want to have them all “link groups, direct links, product categories and products. I can tell you, I spend some time looking at the source code of my site trying to analyze the output. Kind of “ulitis” I got (no need for a dentist for this, a beer is much better)
  • To get the cPath always correctly. That’s not an issue if you display the categories from the top level, but what is if you want to display just the sub “dvd movies” or  its sub level “action” and this either on top level or somewhere in the menu jungle? There is of course a function available to get this, but this is querying the database, so this got solved in an other way without a single query
  • To avoid queries in general: First time I checked, a single menu was causing 740 queries ! Total disaster. Finally to display the categories needs less queries than the default osCommerce categories box
  • To get the “left-right” fly out: Yes, this was a problem, specially after involving the “subersubs” thing, but thats also gone now, solved, past and forgotten
  • To get the “auto” width feature for the navigation bar: Basically what happens is to count the top level parts and then to find the percentage for each. Thats all fine, if you have just to items (50% x2) or 4  items (25% x4) etc. But what is if you have 3, 6 or 7 items? Browsers do interpret the decimals in a different way, that can result to a disaster for your menu. Only way, back to the pixels, and because the width is also not fixed (can be 960 or 1200 for example) and because there can be a search or not, this all needs to be calculated correctly.

Well people, I hope you take a look and tell me what you think.

Click +1 to recommend this to your friends when they search.

multimixer

follow multimixer on Twitter

Follow me on twitter. I'm not tweeting all day long and guaranteed no spam and no advertising.

If you like what you read and if you think it will help you in your online business, then please consider a donation.

There is no obligation to do so and all information provided here is free to use.

It will however help to keep this blog alive, free of advertising and full of content.

  • OSCommerce SEO 20/03/2011 at 00:07

    An excellent, well written article on this add-on; thanks for sharing this.

  • Isabella 14/05/2011 at 12:03

    Very interesting article, thanks for posting this George. One thing I didn’t quite get, is this link addon available only through the mini template system? in other words, could one install your links addon WITHOUT the mini template system?

  • multimixer 15/05/2011 at 09:01

    Hi Isabella, thank you for your comment.

    Link manager and menu maker are part of mini template system and not available as a separate independent addon. This has not any technical reasons, it is just that I didn’t thought about to “release” it as a standalone package.

    Mini template system is an addition to osCommece touches the core code of osCommerce very decently. Any part of it, like the link manager and menu maker can be installed and will work on any osCommerce store without any problems

    Concrete:

    1) Link manager: This is an almost 100% “drop on top” solution, there is only 1 core osCommerce file that need to be modified and this is because you need to place the link to the link manager pages somewhere in admin. Anything else are new files, the database changes are also done “automatically”, so there are no sql queries to “run”. There are absolutely no problems to install it on osCommerce even without having mini template system installed.

    The point is now that the links and link groups, created with the link manager, need to be outputted somewhere on the store front. This is what the menu maker is doing

    2) Menu maker: Both of the menu maker modules (main navigation bar and link boxes – there are more types of modules planned, like for example a “footer manager”) work in the same way as other osCommerce modules do, so basically they can be used anywhere. They would need to be, lets say “downgraded”, to be able to fit on a default store, in the meaning that some of the functions used in that modules will not work.

    For example a link box “know” if it is placed on the left or on the right and adjust the flyout direction accordingly. This happens because it get some basic information “passed over” from the active template. In default osCommerce there is no such information available, so this function would not work and would be taken out.

    Things like this, and others, would need to be set and fixed in the files, and any future modification would also need to be done in the file, for example in the case you decide to place a link box to the right column instead of the left, or in case you decide to change the store width or column width.

    All in all a little more trouble than to use it within mini template system, but very well possible. Things that would be “downgraded” do affect display settings and not the core functionality. As said, the reason why it doesn’t exist as standalone is not a technical one.

    I don’t know, do you think it would be a good idea to pack this together for a default osCommerce installation?

  • Isabella 15/05/2011 at 10:48

    Hi George,

    Thanks for the indepth reply.

    Personally I think it would be good to release this as a standalone addon, just my opinion.
    I’m thinking that a lot of people may be interested in this particular addon (and any others you have coded) but not necessarily in the mini template system as a whole, I’m thinking of people that already use a template or those that simply don’t want the mini template system for whatever reason.

    Perhaps you could have a section here that sells standalone addons?

    So basically you would have 2 things:

    1. your mini template system integrated with all the addons.

    2. the standalone addons that would work on a default osCommerce.

  • Gax 29/08/2011 at 12:41

    Please is this applicable to Oscommerce 2.2? Thanks

  • multimixer 29/08/2011 at 15:14

    Hi Gax

    Mini template system is designed for osCommerce version 2.3.1 and will not work on any other older osCommerce version.

    Same for the link manager and menu maker

  • Tom 16/01/2012 at 06:35

    Hi I love these ideas and would gladly pay for them as addons, the mini template system is out of my pockets reach at the moment as now living in Turkey and wages are very low. If you would do these as addons then contact me please.

    Your tips here are awesome keep going :-)
    Tom

  • multimixer 16/01/2012 at 11:33

    Hi Tom. merhaba

    Yes, this is one of the future plans, to do some nice things as separate addons, I don’t know if link manager will be one of the first, but you can expect some nice things for sure

  • RUSSELL 31/10/2012 at 23:50

    is your link manager available for v. 2.3.3

  • Leo 28/11/2012 at 08:33

    Can I purchase this system for use on my existing website? Where can it be purchased? I need the ability to add external links & change existing product links to external links.

    Thank you
    Leo

  • multimixer 28/11/2012 at 09:31

    Hello Leo

    Link manager is not available as a standalone addon, only as part of mini template system