Friday, October 21, 2011

Php Plugins for BlueBox2.0

Not many developers are aware that writing a plugin for BlueBox2.0 is as easy as it actually is.

By plugin, we are referring to an 'intercept function' that dove-tails into the current system process model built into BlueBox2.0.

Each time a standard class->method is called within the BB2 framework, a plugin can be inserted to handle the data passing through at that point.

Here is how...
  • Firstly, create a php file in portal/{database_name}/custom_modules called bb_plugins.php
  • The file should have the following format:

    <?php
    class bb_plugins extends baseclass{
       ...
    }
    ?>

  • Then add as many plugn functions as you require, naming them as class_name_plugin_name, ie

    function bb_sales_orders_post_add(){
    ...
    }

  • The format of the plugin is also important and should have at minimum, the following:

    function bb_sales_orders_post_add($conf=NULL){
           global $global,$class,$method;
           .....
           return($conf)
    }

  •  Standard intercept-nodes are:
    • pre_view
    • post_view
    • pre_viewlist
    • post_viewlist
    • pre_get
    • post_get
    • pre_add_form
    • post_add_form
    • pre_add
    • post_add
    • pre_edit_form
    • post_edit_form
    • pre_edit
    • post_edit
    • pre_delete
    • post_delete
    • pre_truedelete
    • post_truedelete

    And some special instances are:

    • bb_secure->pre_login
    • bb_secure->post_login
    • bb_datamerge->extra_data

  • And that's it... from there it is up to you. You can intercept data, call other functions, do whatever you require with the data that is passed into the function via $conf, just as long as you pass it back out with return $conf at the end...
  • As an extra feature, bb_plugins.php can also be used to set bbsettings dynamically.
    This is done by declaring a function as class_name_bbsetting_full_name, eg:

    function bb_sales_orders_bbsetting_display_name_template($conf=NULL){
          
    global $global,$class,$method;
           $value=$conf[name]." ".$conf[_id];
           return($value)
    }

Friday, October 14, 2011

New Module : BlueBox Financial Document Templates

This week we released a new module for BlueBox2.0 which allows you to template the header and lines for financial documents.

Similar to the Module Defaults module, this new module adds the functionality of being able to attach a number of pre-set lines to the template. Using this new module you will be able to set up 'standard' documents which are captured regularly, and specify which items, quantities and prices to apply automatically.

The templates are accessed via the DataFunctions menu, and if you have permission to add new templates a quick-link can be seen there as well.

Here is the process:

The new module can be accessed, added to and edited via it's direct link under the admin menu:

As easy way to access the Findoc Templates for a specific module is to click on DatabaseFunctions in the top menu for that module (ie SalesOrders). Click on New Findoc Template...

A new Findoc Template requires a name and a module_name. Optionally you can set header-defaults in the 'other variables' area... these are to be separated into new lines, with an = between the variable name and it's raw value.

Once added you can then add multiple lines to the template, at minimum you must add the item, with qty, price and description optional.

Finally, back in the SalesOrders module, if you click on the DatabaseFuntions menu you will now see the new template available for selection...clicking on it will apply the defaults to a new sales order.



Friday, September 23, 2011

New bbsettings for Image Thumbnails and Resizing Options

A new set of bbsettings has been added to the base code for BlueBox2.0 which allow the control of thumbnail image sizing as well as final image resizing at class/module level.

Previously this was controlled at 'global' level by the config file.

The new settings are:

bbsetting_skip_image_resize - ignores the global resizing parameters for all images in this module

bbsetting_image_resize_width - sets the width for image resizing for all images in this module

bbsetting_image_resize_height - sets the height (if left blank, height is proportional to width)

bbsetting_image_thumbnail_width - as above, but for the auto-generated thumbnails

bbsetting_image_thumbnail_height - as above

Friday, September 16, 2011

BB2.0 Server Statistics Report

New to BlueBox2.0 this week is a System Statistics Module.

This new module is still in it's infancy, and currently stores a history of the highest ram-consuming page in the past hour on the server. The obvious uses for this report are to monitor which users/pages/reports are causing ram/processor outages on the system. We used the memory_get_peak_usage() function in PHP for this. An interesting article on PHP memory usage can be seen here.

To find the report go to Admin->System Stats

Available bbsettings for this module are:

bbsetting_system_stats_enable_storage : defaults to 1 (on) but can be disabled with a 0
bbsetting_system_stats_store_for_days : deafults to 7, number of days before 'old data' is deleted from the cache

In future this module will be used to store slow SQL queries, peak-usage stats etc.

Sunday, September 4, 2011

Quicker Access to bbsettings in BlueBox2.0

For those of you who use bbsettings a lot in the configuration of your BlueBox2.0 systems, you will relate to the time-consuming frustration of having to go to the admin->module_settings menu item, then having to select the relevant module from the long list of 100's... etc.

Recently added is a contextual menu item within each module which automatically takes you directly to the Module Settings module and auto-loads the correct module for you... enjoy:


Cashbook Error Reduction in BlueBox2.0

A quick, little update to the Cashbook Module in BlueBox2.0 has been the introduction of the archivedYN flag.

This field, which is set in the bb_cashbooks table, determined whether a cashbook can be selected for manual cashbook entry. If not, it will not appear in the dropdown list.

Note: this setting does not stop automated entries from posting to the nominated cashbook.


Thursday, September 1, 2011

Introducing BlueBox2.0 WebClicks Tracker

Released with today's code update for BlueBox2.0 is a nifty new module called the WebClicks Tracker.

As a web development agency we often get asked to assist customers with Google, Yahoo, Facebook etc Pay-Per-Click ad-campaigns, and invariably, these are then followed on with monthly feedback on the progress and status of the various campaigns we are running for them.

All too often, the stats we garner from Google Analytics or engines like Google Adwords, are too generic and don't offer the sort of in-depth drilldown analysis that would make the answer to 'who is clicking on our ads' or 'what pages are they viewing' or 'how many of them leave immediately' etc etc.

Given, an experienced eye cast of the Google Analytics report for each client would provide them with lots of info, but this is very time consuming and requires a lot of hand-holding.

What we decided was necessary was a stats engine that:
  • stored ONLY the click-throughs from your priority engines, ie: traced the clicks you were paying for
  • allowed you to analyse the clicks in groups per user-experience, not as separate page-stats
  • sent you a daily or weekly automated email summary of your site, to keep you in the loop
Our WebClicks Tracker does just that. You can edit a pre-defined list of 'accepted' referring domains, initially set to Google, Yahoo and Bing, and only traffic originating from these domains will be tracked. You can determine the frequency and recipients of an automated email which sends you all the info at regular intervals. And most importantly, you can get to view each user-session in a click-by-click manner, seeing which engine they came through, what keywords they were searching for and where they landed on your site. From there you get to see the pages they clicked on, and, if the cookie that is created by this process isn't deleted, you will see every page they come back to during the report period, even if they leave the site and return later.

The module is found under the Publishing menu, and configuration options are a set of bbsettings that can be configured by going to Admin->Module Settings:
  • bbsetting_webclicks_tracker_maxmind_apikey
    This setting is optional, and if you have a web-service key from MaxMind.com the system will translate your visitor IP addresses into country codes.

  • bbsetting_webclicks_tracker_search_domains
    This defaults to 'google.', 'yahoo.' and 'bing.' You can add more, just remember to leave the domain at the period (.) as this will allow traffic from all their country sites as well as the .com's

  • bbsetting_webclicks_tracker_searchphrase_variables
    This defaults to 'p' and 'q' as the top 3 engines all store their search queries in either &p=my+query or &q=my+query. If any of your extra sites store their search phrases in alternate GET variables, put them in here.

  • bbsetting_webclicks_tracker_email_recipients
    This is blank by default (ie no emails will be sent). It can contain an unlimited list of email recipients, separated by semi-colons (;). The email engine will only send one email every x days (where x is the value in the next bbsetting). To force the email script to send an email you can add the following to the URL of any page in you BB2 site... &global[force_webclicks_tracker_email]=1

  • bbsetting_webclicks_tracker_email_frequency
    This defaults to 7, which means that the above email function will send an email to all recipients every 7 days for the previous 7 day period. To change this simply put s different number in.
Finally, and most importantly, to enable this module you will need to put the following BB2.0 tag into your page.template:

<!--:class:bb_webclicks_tracker:track:-->

As part of an ongoing enhancement of this module, we intend to integrate it with Google Adwords so that the origin adverts and their CPC details can be included in the reports.

That's it! Have fun!