Post by scott23 » Thu Apr 28, 2011 3:11 am

I'm working on changing a megamenu into a module to help with future updates and in the process thought it would be easier to place the link to the CSS and JS script in the controller file for the module. I have read several posts about doing this but it never seems to push those links into the header. Has anyone been able to get this to work?

Scott

User avatar
New member

Posts

Joined
Sun Feb 06, 2011 6:08 am

Post by Xsecrets » Thu Apr 28, 2011 3:39 am

are you putting in a module controller or one you made yourself. If it doesn't work it's generally because the child order is wrong, but this has been fixed in all the core files for several versions now.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by scott23 » Thu Apr 28, 2011 3:47 am

It uses a copy of the category.php file located in catalog\controller\common and is copied into catalog\controller\module with some edits done to show the correct format for the menu.

Scott

User avatar
New member

Posts

Joined
Sun Feb 06, 2011 6:08 am

Post by Xsecrets » Thu Apr 28, 2011 5:22 am

just check your childeren call with a that from a standard file from a recent version. basically the header has to be after the controller where the addstyle/addscript is called for instance if you call it in a module that is in the left column header would have to be after column_left in the childeren list.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by scott23 » Thu Apr 28, 2011 7:27 am

This menu is located in the header with a newly created module location. Attached is the controller file that I am trying to add it to, so where would you put the code in at?

User avatar
New member

Posts

Joined
Sun Feb 06, 2011 6:08 am

Post by Xsecrets » Thu Apr 28, 2011 7:32 am

that's not a mainpage controller. If you are adding it to the header and it's not working my guess is that you added your new module below the addscript and addstyle calls and it would need to be above for the call to get registered.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by scott23 » Thu Apr 28, 2011 10:04 am

I gotcha now. I guess I thought that those could be used directly in the module controller to keep from having to edit the core files. Thanks for the help.

User avatar
New member

Posts

Joined
Sun Feb 06, 2011 6:08 am

Post by Xsecrets » Thu Apr 28, 2011 10:26 am

scott23 wrote:I gotcha now. I guess I thought that those could be used directly in the module controller to keep from having to edit the core files. Thanks for the help.
they can, but from what it sounds like you have already edited the core files to add a module position in the header, but you didn't do it correctly, and the addscript from the module is not getting called until after the header has already set all the scirpts.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US
Who is online

Users browsing this forum: No registered users and 4 guests