mattjt83

Admin header_tag modules

22 posts in this topic

Is there any interest in this? I have found it to be pretty handy in my shops admin. Very simple to implement.

1 person likes this

Share this post


Link to post
Share on other sites

Off course! Any examples?

Share this post


Link to post
Share on other sites

You must be reading my mind. While working on some changes that require javascript, I thought to myself, "Self; This admin needs a header tag system just like the front end"

Share this post


Link to post
Share on other sites

@@azpro

@@GLWalker

@@altoid

 

I'll put together a fork on github so you can guys can check it out. Very simple and seems to work well.

1 person likes this

Share this post


Link to post
Share on other sites

OK,

 

This might be a bit rough but I wanted to put it up so you guys can check it out and make any changes you see fit. It includes one generic module just so you can see that it works.

 

I also just put it all into footer_scripts for now but I guess it would make sense to include header ones as well for css additions etc. 

 

This is just first draft: https://github.com/mattjt83/Responsive-osCommerce/tree/Admin_header_tags

Share this post


Link to post
Share on other sites

@@mattjt83

 

Browsing the code, everything looks fine, I'll install it and test later in the day.

 

I do have some concerns with pulling the osCtemplate class from the catalog side - What are the chances of collusion due to some files that are present in both the admin and catalog side, such as index and login?

 

At present there would be no threat, but as the system is expanded to include header tags, even content, there could be some conflict.

 

Anyhow, I'll have a play with it and brainstorm a bit. As some know I did have a nice admin fork going, which I ultimately decided to stop because I realized that the admin would ultimately need to undergo further changes, at the time the PayPal App was introduced, which warranted some admin changes and I was under the impression that more changes further enhancing the admin would follow.

 

While a header tags/content system in the admin may seem like overkill as shop owners do not make changes to the admin the same as they would the catalog - I personally think it would help with code developers write and make installation of new addons easier for the shop owner - that coupled with the app system.

Edited by GLWalker

Share this post


Link to post
Share on other sites

Of course, and not only header tags. Admin side is not being updated since 2.3 version.

Share this post


Link to post
Share on other sites

@@GLWalker

 

We can just as easily pull the class from the admin. I did it that way to begin with but then figured it was OK to pull it from the shop side (like the hooks class is done).

 

I don't think admin header_tags is overkill at all. I have added lots of scripts/css to my shops admin, all of which had to be done with core code changes. This makes things much simpler to add/manage.

Share this post


Link to post
Share on other sites

Probably all modules are generating in admin site. Pls use separated module class group names everywhere.

 

$oscTemplate->getBlocks('admin_header_tags');

Share this post


Link to post
Share on other sites

@@Gergely

 

So do you mean just change the call for footer_scripts to:

echo $oscTemplate->getBlocks('admin_footer_scripts'); 

??

Share this post


Link to post
Share on other sites
$oscTemplate->getBlocks('admin_header_tags');

 

That seems very logical. Easy way of using what already exist, osC_template, and avoids conflicts.

Share this post


Link to post
Share on other sites

I think it would be a good thing to try to develop admin as an independent app - using as little code from front end as possible.

 

Will test later and give feedback!

Edited by azpro

Share this post


Link to post
Share on other sites

@@mattjt83

Finally had some time to get back to this. I have no issues running it so far. I am going to create a module for it that adds TinyMCE to the product and category description fields. Should now be able to do this with zero core changes -(outside of adding the osC_template class)

 

One question, admin/modules.php  - Line 140 - 143 What is the reason for changing include to include once?

 

@@azpro

 

Actually, there are a few files that could be shared both Admin and Catalog side. In doing so it would reduce the overall file size of the project. And it has been growing with the community build.

Share this post


Link to post
Share on other sites

@@Gergely

 

So do you mean just change the call for footer_scripts to:

echo $oscTemplate->getBlocks('admin_footer_scripts'); 

??

 

Thanks

 

(Maybe some "explorer" could copy shop header tags into admin)

Share this post


Link to post
Share on other sites

@@GLWalker

 

If you don't do that you will get the can't redeclare class error since the class is included with the header_tag and by the modules.php page. Any workaround you can think of for that page? It was the only page I had an issue.

Share this post


Link to post
Share on other sites

@@mattjt83

 

I actually redid everything to use the catalog side for modules - its probably just a preference thing, but my logic is that we're already accustomed to uploading modules to the catalog side, what exist in the admin already is just the dashboard modules, other available code such as the PayPal app makes use of the catalog side. So that's the route I took.

 

In doing so I changed back the include to original and it works well. I also removed the query for the admin_header_tags module and its running fine using the existing code in modules. I do have some kinks I'm still ironing out though after changing things, so should have my branch updated in a day or 2, time permitting.

Share this post


Link to post
Share on other sites

@@GLWalker

 

I guess my line of thinking is that these are exclusively being used in the admin (like dashboard modules) so just put them in the admin directory. I also like having a separate section under modules for modules that are for the admin area. I agree that these are just preferences that we disagree on. Either way works :)

 

I like that you change a bit less code but it's not enough to make me want to do it that way for the reasons I mentioned. I have a feeling that this as well many other cool things will never see the light of day in the "Core code" such as it is.

 

I look forward to seeing what you come up with!

Share this post


Link to post
Share on other sites

I was just  playing with this and found an incompatibility. When you access modules->content the messagestack from the shop side is being executed, and being different to the one in the shop side it throws an error:

Fatal error: Call to undefined method messageStack::size() in E:\_responsive_admin\includes\modules\content\header\cm_header_messagestack.php on line 37

A patch to avoid it may be adding an empty size() method to the admin class for now, but more incompatibilities might raise.

 

@@mattjt83 @@GLWalker did you keep working on it? Did you found something else?

Share this post


Link to post
Share on other sites

I was just  playing with this and found an incompatibility. When you access modules->content the messagestack from the shop side is being executed, and being different to the one in the shop side it throws an error:

Fatal error: Call to undefined method messageStack::size() in E:\_responsive_admin\includes\modules\content\header\cm_header_messagestack.php on line 37

A patch to avoid it may be adding an empty size() method to the admin class for now, but more incompatibilities might raise.

 

@@mattjt83 @@GLWalker did you keep working on it? Did you found something else?

I still use my version of this and have not had that error come up. 

Share this post


Link to post
Share on other sites

@@mattjt83 thanks, I'll re-install again with a blank database, maybe that's the problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now