Jump to content
piernas

[Addon] Content modules improved admin page

Recommended Posts

I took some time to practice with modules and made this time-saver when configuring content modules:

 

http://addons.oscommerce.com/info/9458

 

post-181458-0-88810800-1459099669_thumb.jpg

IMPROVED CONTENT MODULES ADMIN FOR 2.3.4 RESPONSIVE
===================================================

This is a direct replacement for modules_content.php.

- Each module group has his own tab, so no more inspecting huge lists in search of a content module.
- You can see both installed and uninstalled modules in one group at once.
- You can see module descriptions without clicking on each one.
- You can check fast if a module is enabled or not without accessing his configuration.
- You can enable or disable modules directly if the module has the appropiate methods (see below).

I had the intention of adding a couple of improvements, like a graphical interface to move up/down modules and graphically change its width and position on the page, but currently there's not a standard for bootstrap module width property. One module can, for example, have a "half width/full width" property while another can offer the choice of "width=6/width=12".

Also, to enable/disable them without accessing his configuration would require the module to expose public methods like these:
 

<?php
    function isEnabled() {
      return $this->enabled;
    }
    
    function enable() {
            tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'True' where configuration_key = 'MODULE_THIS_MODULE_STATUS'");
            $this->enabled = (MODULE_THIS_MODULE_STATUS == 'True');
            

    }
    function disable() {
            tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'False' where configuration_key = 'MODULE_THIS_MODULE_STATUS'");
            $this->enabled = (MODULE_THIS_MODULE_STATUS == 'True');

    }
?>

If these are not present, you can easily add them to a module by changing MODULE_THIS_MODULE_STATUS for the appropiate constant.
If you do this or the module already suplies these methods, yoou will see the enable/disable button in this module.

post-181458-0-88810800-1459099669_thumb.jpg

Edited by piernas

Share this post


Link to post
Share on other sites

I love it!!! Absolutely agree. Yes, it is a great time saver when your are testing about different aspects for your shop, modules, configurations and positions. 

 

Just a question. Could you give us a real example of how to insert that code for  enabling/desabling modules, as you say in instructions? I mean, if you can include here a module (the one that you prefer) with that code inserted in the right place for that purpose. 
Sorry, I'm not a coder, but with an example I can have an idea an try to do it with the rest of modules I have installed.

Anyway, many thanks for your effort and congrats for your work!


Shopowner, not coder, experienced copypaster  :D

Share this post


Link to post
Share on other sites

Hola Tito, it's great you found it of good use.

 

I don't have a samle right now, but for example let's take the cm_footer_account.php.

 

You'll find this line under function install ():

      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Account Footer Module', 'MODULE_CONTENT_FOOTER_ACCOUNT_STATUS', 'True', 'Do you want to enable the Account content module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

MODULE_CONTENT_FOOTER_ACCOUNT_STATUS is, in this case, the configuration key that stores the status of the module.

 

So if we want the module to expose methods for enabling/disabling it you have to add these two functions in the class:

    function enable() {
            tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'True' where configuration_key = 'MODULE_THIS_MODULE_STATUS'");
            $this->enabled = (MODULE_CONTENT_FOOTER_ACCOUNT_STATUS == 'True');
            

    }
    function disable() {
            tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'False' where configuration_key = 'MODULE_THIS_MODULE_STATUS'");
            $this->enabled = (MODULE_CONTENT_FOOTER_ACCOUNT_STATUS == 'True');

    }

Share this post


Link to post
Share on other sites

Hey! Gracias @@piernas !!!
Going for it right now!

 

Regards


Shopowner, not coder, experienced copypaster  :D

Share this post


Link to post
Share on other sites

I've just also installed your Horizontal CSS menu for admin 2.3.4 and BS

Really, really great!!! I strongly recommend to everybody to install it.

 

As you well said, very much confortable for controlling, modifying  and/or consulting your eShop in this times of smartphones and tablets.

Gracias Juanma! You made my working life easier...  :lol:


Shopowner, not coder, experienced copypaster  :D

Share this post


Link to post
Share on other sites

Hallo Juanna

Its a wonderful addon 

I mad your Instructions on The cm_footer_account.php

I see the Button Disabled but the Button is not working (Click on Disable and nothing happens)

After that I thought that you forget something or make a mistake in the code and I changed the code (marked with Red Color) but I can Fix it Nothing happens Again

Here is the Changed Code:

---------

function enable() {
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'True' where configuration_key = 'MODULE_THIS_MODULE_STATUS'");
$this->enabled = (MODULE_CONTENT_FOOTER_ACCOUNT_STATUS == 'True');
 
    }
    function disable() {
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'False' where configuration_key = 'MODULE_THIS_MODULE_STATUS'");
$this->disable = (MODULE_CONTENT_FOOTER_ACCOUNT_STATUS == 'False');
 
    }
--------
Edited by Pelvis

Share this post


Link to post
Share on other sites

Hi all,

Can someone make this @piernas addon work in Frozen or in some pre-Frozen EDGE version where the file names are hardcoded paths?

Any help is welcome !!.

Thank you!!

Valqui


Setting up a new Frozen site with so many nice addons available on the market and waiting to be admitted to Phoenix club!

Community Oscommerce fan :heart:

 

Share this post


Link to post
Share on other sites

Test before using on live shop as I have never used add-on before, but installs and runs on BS4 Frozen fine. There is very little if any change in admin side from 2.3.4 to CE so you should have a go at making some of these small changes.😊

 

image.thumb.png.83a8b8998e1680b8f99d40be79d5b685.png

oscom-improved-content-modules-admin-for-CE FROZEN.zip


 

Share this post


Link to post
Share on other sites
Posted (edited)

Hello Zahid, @JcMagpie

I just try the attached file on my new Frozen test site and it works correctly. Thank you !!!

Would it be nice to update that addon in the market?

Best regards

Valqui

Edited by valquiria23

Setting up a new Frozen site with so many nice addons available on the market and waiting to be admitted to Phoenix club!

Community Oscommerce fan :heart:

 

Share this post


Link to post
Share on other sites

Sorry not my add-on the files are posted for anyone to use if they need them. Plus would require much more testing to add to market. Don't actualy remember doing it? 🙄


 

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

×