Jump to content
Dan Cole

[Addon] iBar Dashboard Modules

Recommended Posts

This addon is designed to add small information modules to your 2.3+ administration dashboard.

Four modules are included in the initial release.

iBar New Customers Module - Compares the number of new customers for a specified period with the prior period.

iBar New Orders Module - Compares the number of new orders for a specified period with the prior period.

iBar Reviews Module - Alerts you to pending reviews.

iBar Order Status Module - Allows you to monitor a particular order status.

More modules and upgrades are planned for future releases.

The development thread can be found here.

A number of community members helped move the development along and in that regard I would like to express my appreciation and thanks to:

Bill aka ecommunlimited
Scott aka greasemonkey
Omar aka Omar_one
Juanma aka piernas
Carine aka Bruyndoncx

The iBar Dashboard Modules package will be posted in the addons area and the link to it will be posted here shortly.

Dan

Share this post


Link to post
Share on other sites

@@Dan Cole

Hi Dan

 

Just thought I'd give this addon a go and see what happens.

 

One thing I noticed (probably due to something I haven't done) Is that where the "New customer last 30 days" If I click on the link it takes me to the custonmers.php page. I thought maybe it would take me to a page where I could see who the new customers were in the last 30 days. Maybe I have misunderstood.

 

Looks great.

 

Cheers

Grandpa

Share this post


Link to post
Share on other sites

Haven't done that yet John but I did something similar for the Order Status iBar....here is a zip file of that if you'd like to have a look.  If  something like that for the customer iBar would be worthwhile let me know and I'll add it to my today list.  Keep in mind though that there is already a Stock Customer Dashboard that shows you the most recent 6 or 7 customers....maybe that should be reworked to add some of the flexibility that was build into the iBar Order Status Table module.   Here you go...

 

More Modules.zip

 

Let me know what you think.  At this point I consider it complete, subject to whatever issues might arise as folks test it. 

 

Dan

Edited by Dan Cole

Share this post


Link to post
Share on other sites

@@Dan Cole

 

Hi Dan

 

 

Looks good although I'm not sure what to expect from it. As at the moment the the complete box is empty. Ive tried various settings in the admin to see what happens but so far nought. Maybe there's something I haven't done, even made a "dumby" order

 

Look forward to your comments.

 

Cheers

John

Share this post


Link to post
Share on other sites

Morning John....you'll definitely need some orders in order to see anything.  As far as the settings are concerned, there are three you need to be concerned with...

Order Status to Monitor
27

Skip Last # of Days
3 Day

Maximum # of Orders to Display
5

The Order Status to Monitor...enter the id for the orders you want to display on the list.  If you are not sure what the number is, go to your Localization -> Orders Status tab.  Click on the Status you want to monitor and then look at the URL in the browser location window.  You'll see "oID=<number you want>" and enter that number in your order status module.

Skip Last # of Days
I couldn't think of a better way to word it but let me give you the concept.   The idea is that I just wanted to see the items that are x days old....in other words if they need my attention I want to see them. I don't want to see the ones from today or yesterday or perhaps even a few days before so the Skip Last # of Days is the setting for that.  If I set it for 3 days it should just show me the items that are 4 days or older.   Hopefully that makes sense.  

Maximum # of Orders to Display
This one is easy...how many orders do you want to display?

Try those settings and make sure you have some orders with the Order Status you selected.   Let me know how it goes.  If I can be of any further help please let me know that also.

Dan

Share this post


Link to post
Share on other sites

@@Dan Cole

 

Hi Dan

 

Now things make sense, and works well. Great explanation.

Just wondering (remember I don't have a clue about coding) that maybe, could there be a drop down menu, or a wee explanation regarding Order status to monitor

 

Well done

 

Grandpa

Share this post


Link to post
Share on other sites

@@grandpaj Good idea regarding the drop down list John and one I thought about when I was working on it.  I opted not to do that since the number of order statuses that I had would make for a rather long list.  If I dig into that module again I'll have another look at it since it could be very helpful.  In the meantime hopefully my post will suffice.

 

Dan

Share this post


Link to post
Share on other sites

I've just added the first update for the iBar Modules. 

 

This update adds:

1. A supporting Customer Table that is linked to from the iBar Customers Dashboard Module
2. A new iBar Products Module
3. A supporting Products Table that is linked to from the iBar Products Dashboard Module
4. A supporting Orders Status Table that is linked to from the iBar Orders Status Dashboard Module

Along with several improvements and fixes to the original Dashboard Modules.  To update your iBar modules simply upload the individuals files to the appropriate directories and then uninstall and reinstall any modules you'd like to update.  For the new modules you simply need to install them.  Also be sure to update/replace the iBar.css files since there have been several updates to that file.  

 

You'll find it here.

 

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

 

If you have any questions or discover any issues please post here.

 

Dan

 

Share this post


Link to post
Share on other sites

@@Dan Cole

 

Hi Dan,

 

Gave this a shot today to check it out. I found an error in d_iBar_customer_table.php that causes a mySQL error.

 

This:

$customers_query = tep_db_query("select c.customers_id, c.customers_lastname, c.customers_firstname, ci.customers_info_date_account_created from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id order by ci.customers_info_date_account_created desc limit " . MODULE_ADMIN_DASHBOARD_IBAR_ORDER_STATUS_TABLE_MAXIMUM . "");

Needs to be:

$customers_query = tep_db_query("select c.customers_id, c.customers_lastname, c.customers_firstname, ci.customers_info_date_account_created from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id order by ci.customers_info_date_account_created desc limit " . MODULE_ADMIN_DASHBOARD_IBAR_CUSTOMER_TABLE_MAXIMUM);

Matt

Share this post


Link to post
Share on other sites

@@mattjt83  That's interesting Matt...I assume it is a php or mySQL version issue since both your suggested change and my original code work fine on my set up.  My server software is a bit on the old side so I'll use your code going forward, assuming it'll solve a problem I'll bump into sooner or later. 

 

Thanks for pointing it out.  It might help others before I bump into it or release my next update.  I appreciate it. 

 

Dan 

Share this post


Link to post
Share on other sites

@@Dan Cole

 

The problem was that the constant was not defined. 

 

You might have MODULE_ADMIN_DASHBOARD_IBAR_ORDER_STATUS_TABLE_MAXIMUM defined somewhere else in your code and/or database though so it wasn't failing for you. Maybe it's used by one of the other modules in the iBar set?

 

When you install this module from scratch though you add MODULE_ADMIN_DASHBOARD_IBAR_CUSTOMER_TABLE_MAXIMUM for that particular module and that's what the sql query needs to function properly.


Matt

Share this post


Link to post
Share on other sites

In general I like the look and idea of this addon. I'm not sure how I feel about how it looks on my setup since I did not alter my admin/index.php page besides to add the css/js code required.

 

Also, I wondered if you meant for us to install all of the modules or were some of them optional? The reason being is that some of the modules have links in them which point to nothing if you don't install some of the table modules.


Matt

Share this post


Link to post
Share on other sites

@@Dan Cole

 

The problem was that the constant was not defined. 

 

You might have MODULE_ADMIN_DASHBOARD_IBAR_ORDER_STATUS_TABLE_MAXIMUM defined somewhere else in your code and/or database though so it wasn't failing for you. Maybe it's used by one of the other modules in the iBar set?

 

When you install this module from scratch though you add MODULE_ADMIN_DASHBOARD_IBAR_CUSTOMER_TABLE_MAXIMUM for that particular module and that's what the sql query needs to function properly.

 

That  makes more sense and I can see this issue...I'll fix it and put my query back....to me it is a bit more logical the way I had it.  

 

Thanks for the update.

 

Dan

Share this post


Link to post
Share on other sites

In general I like the look and idea of this addon. I'm not sure how I feel about how it looks on my setup since I did not alter my admin/index.php page besides to add the css/js code required.

 

Also, I wondered if you meant for us to install all of the modules or were some of them optional? The reason being is that some of the modules have links in them which point to nothing if you don't install some of the table modules.

 

Are you not loading Bootstrap?  It'll probably look funny without it.

 

Regarding the tables...I assumed if you added the iBar dashboard module you'd want the associated table added as well but maybe that's not a good assumption.   My idea was to place those tables lower down on the page, perhaps collapsed and out of sight, and allow you to link to them as desired.  I'll chew on that a bit as I try to sort out the bootstrap collapse/accordion/card columns issue being discussed in the iBar Module development thread.

 

Thanks again for the input Matt.

 

Dan

Share this post


Link to post
Share on other sites

@@Dan Cole

 

On a standard setup you can't get the icon modules to be in a nice little row like in the screenshots. I decided to code up a hook and display the iBar modules on their own at the top of the page instead of altering my index page to accommodate them.

 

on admin/index.php under this:

$adm_array = explode(';', MODULE_ADMIN_DASHBOARD_INSTALLED);

I added this:

//BOF iBar
echo $OSCOM_Hooks->call('index', 'indexiBarOutput');
//EOF iBar

Then I created a hook file catalog/includes/hooks/admin/index/iBar.php

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2017 osCommerce

  Released under the GNU General Public License
*/

  class hook_admin_index_iBar {
    
    function listen_indexiBarOutput() {
        global $adm_array, $language;
        
        if ( is_array( $adm_array ) && sizeof( $adm_array ) > 0 ){
            $iBar_array    = array();
            $new_adm_array = array();
            
            foreach ( $adm_array as $key => $value ){
                
                if ( strpos( $value, 'iBar' ) !== false ) {
                    $iBar_array[] = $value;
                }else{
                    $new_adm_array[] = $value;
                }
                
            }//eof foreach
            
            //set new $adm_array without iBar modules included
            if ( sizeof( $new_adm_array ) > 0 ){
                $adm_array = $new_adm_array;
            }
            
            //build iBar modules output here
            if ( sizeof( $iBar_array ) > 0 ){
                $iBar_output = '<!-- BOF iBar additions -->
                                <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
                                <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
                                <link rel="stylesheet" type="text/css" href="includes/iBar.css">
                                <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
                                <!-- EOF iBar additions -->';
                $iBar_output .= '<tr><td colspan="2"><div class="row">';
                
                for ( $i=0, $n=sizeof($iBar_array); $i<$n; $i++ ) {
                    $adm = $iBar_array[$i];

                    $class = substr($adm, 0, strrpos($adm, '.'));

                    if ( !class_exists($class) ) {
                        include(DIR_WS_LANGUAGES . $language . '/modules/dashboard/' . $adm);
                        include(DIR_WS_MODULES . 'dashboard/' . $class . '.php');
                    }

                    $ad = new $class();

                    if ( $ad->isEnabled() ) {
                        $iBar_output .= $ad->getOutput();
                    }
                }
                
                $iBar_output .= '</td></tr></div>';
                
            }
            
            return $iBar_output;
        }
        
    }
        
  }    
?>

Also don't forget to call the index page hooks with this before the output of the hook:

$OSCOM_Hooks->register('index');

Matt

Share this post


Link to post
Share on other sites

@@mattjt83

 

@@Dan Cole

 

On a standard setup you can't get the icon modules to be in a nice little row like in the screenshots. I decided to code up a hook and display the iBar modules on their own at the top of the page instead of altering my index page to accommodate them.

 

on admin/index.php under this:

$adm_array = explode(';', MODULE_ADMIN_DASHBOARD_INSTALLED);

I added this:

//BOF iBar
echo $OSCOM_Hooks->call('index', 'indexiBarOutput');
//EOF iBar

Then I created a hook file catalog/includes/hooks/admin/index/iBar.php

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2017 osCommerce

  Released under the GNU General Public License
*/

  class hook_admin_index_iBar {
    
    function listen_indexiBarOutput() {
        global $adm_array, $language;
        
        if ( is_array( $adm_array ) && sizeof( $adm_array ) > 0 ){
            $iBar_array    = array();
            $new_adm_array = array();
            
            foreach ( $adm_array as $key => $value ){
                
                if ( strpos( $value, 'iBar' ) !== false ) {
                    $iBar_array[] = $value;
                }else{
                    $new_adm_array[] = $value;
                }
                
            }//eof foreach
            
            //set new $adm_array without iBar modules included
            if ( sizeof( $new_adm_array ) > 0 ){
                $adm_array = $new_adm_array;
            }
            
            //build iBar modules output here
            if ( sizeof( $iBar_array ) > 0 ){
                $iBar_output = '<!-- BOF iBar additions -->
                                <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
                                <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
                                <link rel="stylesheet" type="text/css" href="includes/iBar.css">
                                <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
                                <!-- EOF iBar additions -->';
                $iBar_output .= '<tr><td colspan="2"><div class="row">';
                
                for ( $i=0, $n=sizeof($iBar_array); $i<$n; $i++ ) {
                    $adm = $iBar_array[$i];

                    $class = substr($adm, 0, strrpos($adm, '.'));

                    if ( !class_exists($class) ) {
                        include(DIR_WS_LANGUAGES . $language . '/modules/dashboard/' . $adm);
                        include(DIR_WS_MODULES . 'dashboard/' . $class . '.php');
                    }

                    $ad = new $class();

                    if ( $ad->isEnabled() ) {
                        $iBar_output .= $ad->getOutput();
                    }
                }
                
                $iBar_output .= '</td></tr></div>';
                
            }
            
            return $iBar_output;
        }
        
    }
        
  }    
?>

Also don't forget to call the index page hooks with this before the output of the hook:

$OSCOM_Hooks->register('index');

 

Screen shot?

 

Malcolm


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

@@Dan Cole

 

I kind of felt like this was a separate module than the standard dashboard modules which is why I separated it out from them in the hook.

 

I think I'll add it to my live site and see how I like it  :)


Matt

Share this post


Link to post
Share on other sites

@@mattjt83  I really like the concept of dashboards and I think this has a ton of potential...Frank has a script to read from Gmail and I can think of another 4 or 5 modules I want to add so it should be a good way to keep an eye on what's important to shop owners.   Glad you like it so far.  :thumbsup:

 

Dan

Share this post


Link to post
Share on other sites

@@mattjt83

 

Do you have a link to the gmail script?

 

I don't actually have the script but have a look at this post and the one by Gary that follows it in the iBar development thread.   If your interested google imap_open and it should give a good idea about coding it.  Frank will likely share his code too, if you ask him nicely. 

 

Dan

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

×