Monday, 31 December 2012

Adobe indesign CS6 can i fade and object

After 'placing' and image in Indesign I was left asking the question of whether I could 'fade' that object.  The answer is 'yes' and there's a heap of other features that can be added to an object too.

goto > object > Effects > Transparency  and then changes the percentage.

it's worth a peak at the other things in Effects as well.

Sunday, 30 December 2012

Google Ads showing on Wordpress Website - DF Marine Template

On the df_marine template there is code on there to display Google adverts for the template designer.

This is on  wp-content/themes/df_marine/index.php

FIND



< script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">



You can make changes here to make this section look different.

Wednesday, 19 December 2012

Wordpress 3.4.2 posts missed schedule heart internet

If you have Wordpress website hosted on Heart Internet then you may have a problem using Scheduled posts and are getting a 'missed schedule' message next to your posts.
This is linked to my Wordpress Twitter Widget Pro doesn't update - Heart Internet issues  post.

If you host on Heart Internet and use Wordpress then you need to install this plugin to fix the missed schedule issue WP Missed Schedule Fix Failed Posts

How to make Joomla Tweet Display Back Module into a Speech Bubble

After  solving this problem Easy Twitter Status no longer works on Joomla 1.5 websites
I wanted to change the look so that the tweet showed in a speech bubble like this .

Check the Escape Surfboards Surf Report site to see it live.

Here's what I did .  Don't forget if your doing this kind of work then using Firebug is a awesome tool.

>  drew a line around the box that contains the tweet.  Adding a rounded corner effect too.

-moz-border-radius: 15px;
border-radius: 15px;

border: 1px solid #333;



>  make a image that will go at the top to make it look like speech.

I put this image in the folder modules/mod_tweetdisplayback/media/images





>  in the Tweet Display Back Template that your changing you need to add the following < div > to appear above the Tweet Box .



For me this was on line 79 of modules/mod_tweetdisplayback/tmpl/default.php  (take out the spaces from the HTML !)

     < div class="TDB-tweet-speech-img">< img src="/speech.gif" border="0"></ div>





>  lastly you need to position that and change the position of the box below so it all looks right.


.TDB-tweet-speech-img  {
display: block;
position: absolute;
margin-left: 25px;
}

.TDB-tweet-container {
float: left;
margin-top: 19px;
}

table.tweetouter {
    margin-bottom: -15px !important;
 
}

   





Tuesday, 18 December 2012

Easy Twitter Status no longer works on Joomla 1.5 websites.

Easy Twitter Status no longer works on Joomla 1.5 websites.

The solution is that you can use Tweet Display Back extension -  the only problem here is that you can no longer find the download for Joomla 1.5 from Joomla.org   .  Here's a link to the downloads you can use for Tweet Display Back

Monday, 17 December 2012

Joomla 2.5 Virtuemart 2 Shipping not being added to the order

Our shopping cart at www.escapesurfboards.com  has suddenly started not adding the shipping amount to the order. 

The solution was to go into administrator .

>  'components'

>  'virtuemart'

> on the left handside click on  Shop >> 'Shipment Methods'

>  Click on the Shipment Method you want to change

> Click on the 'Configuration' tab

> at the bottom change the amount for 'Minimum Amount for Free Shipment'



joomla virtuemart 2 no shipment method matches when using checkout as guest

The problem :

When checking out using the 'checkout as guest' button


what was happening next is that we are getting this message at the shipment page

'We are sorry, no shipment method matches the characteristics of your order.'

 The solution to this is that in Administrator the '-anonymous-'  group needs to be added in Shipment and also in Payment



How to get a RSS feed back from Twitter

This method works as we speak, but Twitter are constantly moving the goal posts on this one.

https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=YOURTWITTERUSERNAME





Fix wordpress RSS feed error XML Parsing Error: XML or text declaration not at start of entity Location: */feed/ Line Number 3, Column 1:

I was getting the following error when trying to access the RSS feeds on a website I had built using the 'df_marine' template. Sea this World - Conservation Website

The inspiration for the solution was take from this blog 'Wordpress feed XML errors'

Here' what I needed to do exactly

> BACKUP YOUR SITE
> install the plugin Fix RSS Feed
> in 'wp-admin' > go to 'settings' > 'fix rss feed' and follow the instructions here. >

DONT FOGET to return the permissions to what they where for you own security.

Make sure you finish your website with some .htaccess and robot.txt House Keeping.

After just finishing the website mitweb.co.uk I've a little house keeping to do which I feel is worth documenting The .htaccess file * here I want to achieve a couple of things > make sure any calls to the admin folder goes to a https version > direct any links in search engines to the new relevant pages Here's the code to be added that solves these problems ######################################## RewriteCond %{HTTPS} off RewriteRule ^(wp-admin/.*)$ https://www.mitweb.co.uk/$1 [R=301,L] Redirect 301 /home-heating-oil-devon-cornwall/ http://www.mitweb.co.uk/services/home-heating/ Redirect 301 /agricultural/ http://www.mitweb.co.uk/services/agricultural/ ######################################### ETC ETC Robot.txt I want to disallow robots ( search engine robots ) from the Admin area. ########################################## User-agent: * Disallow: /wp-admnin/

Monday, 10 December 2012

Changing the Gallery on Wordpress site built with Company template and Lightbox Gallery

I've made a short movie for adding images and changing text etc.  Basically its done in the admin->portfolio section.


Also if you need to change the size of the image displayed you go to

> plugins
> Lightbox gallery
> Settings

At the bottom of the page find 'In case that you would like to set the default lightbox size:'

and add a figure here.  ie '800'

Friday, 7 December 2012

Disappearing Plugins inside widgets on Wordpress installation.

After adding a widget space to Wordpress I found a weird problem where the Widget would at first display correctly .  However when going back into wp-admin and viewing the widget the plugins would have disappeared.  As pictured here.

At this point the widget would still display on the website ok.  However once I saved anything in the widgets then the Plugins would also disappear from the website .  The problem was in the naming convention of my items in the sidebar.   So for example I changed ' formBox' to 'formbox'

Thursday, 6 December 2012

how to unzip .tar.gz in windows 8

Free unzip tar.gz files for windows 8

how to unzip .tar.gz in windows 8

Check out 7-zip at http://sourceforge.net/projects/sevenzip/files/7-Zip/9.20/7z920.exe/download?use_mirror=heanet

The only thing here was that I needed to add the application after right clicking and going to 'open with' and 'choose applications'

Go to the folder where '7-zip' is installed and select the '7zFM' application.

Hey presto.

Slider not showing Excerpt text on Wordpress Company template by template Square

When i first set up this template it worked fine.  However after a few weeks of changes the excerpts that go with the slides aren't displaying.  As pictured here.






To sort this out this is what I did.

OPEN.

wp-content/themes/company/slider.php

FIND around line 55 

[code]  if($sliderDisableText!=true){
                               $output .='
';
                                if(!empty($post->post_title )){
                                $output .='

'.$excerpt = get_the_title().'

';
                                }
                                $post_excerpt = $post->post_excerpt;
                                $output .=''.$excerpt = get_the_excerpt().'
';

[/code]








REPLACE with:

   if($sliderDisableText!=true){
                               $output .='
';
                                if(!empty($post->post_title )){
                                $output .='

'.$excerpt = get_the_title().'

';
                                }
                                $post_excerpt = $post->post_excerpt;
                            //    $output .= var_dump($post);
                               $output .='
'.$post_excerpt.'
';
                              




Friday, 30 November 2012

Hupso Share buttons shows on posts but not pages in Wordpress

Ok I hunted around the internet a bit for this one.  Here's the searches I made.

how to get Hupso Share Buttons  to show on pages as well

wordpress how to get Hupso Share Buttons  to show on pages

wordpress hupso share buttons for pages and posts

wordpress plugin shows on one template but not another

wordpress plugin shows posts but not page

wordpress plugin works on posts but not pages


However I didn't find anything but managed to hack a quick fix, so here it is. 

I checked the outputted HTML for both my posts and pages.  On comparing I found that posts had this code.


Social Share Toolbar   


So I then opened the page.php from my template  -> wp-content/themes/company/page.php

and pasted the above code where I wanted the plugin to show and hey presto I have it working as I wish.  !!!

Thursday, 29 November 2012

Slick Social Share Buttons file permissions error

Slick Social Share Buttons A file permissions error has occurred. Please check the permissions on the script and the directory it is in and try again.


This is for installing the Slick Social Share Buttons plugin on to Wordpress.

I had to chmod the following files to 644 ; this solved the issue.

wp-admin/options-discussion.php
wp-admin/options-general.php
wp-admin/options-head.php
wp-admin/options-media.php
wp-admin/options-permalink.php
wp-admin/options-privacy.php
wp-admin/options-reading.php
wp-admin/options-writing.php
wp-admin/options.php



Monday, 26 November 2012

Drivers for the BT Voyager 1065

If you need the installation disk for the BT Voyager 1065 you may be finding some issues with finding this sofware online.  For some reason many of the links on the internet are broken. 

At the time of writing this link page works though BT Voyager 1065 drivers  

Wednesday, 21 November 2012

How to draw multiple circles on your Google Map.

The problem:  I have a Wordpress website and I want to display a map with multiple placemarkers and have circles displayed over the placemarkers.


The solution. 

Firstly I installed this plugin on my Wordpress installation

Google Maps V3 Shortcode Multiple Markers for Wordpress .  This plugin enables you to put multiple placemarkers on your Google Map.  

In adding the circles to the placemarkers I found this example code a great help . 
Example of how to place Circles on Placemarkers in Google Maps

The key code is here
[code]
// Add a Circle overlay to the map.
        var circle = new google.maps.Circle({
          map: map,
          radius: 3000000 // 3000 km
        });
circle.bindTo('center', marker, 'position');

[/code]

So now all we need to do is intergrate that into the plugin .  Although you'll probably want to turn down the size of that radius.  Here's what I did to the site I'm working on.

After you've installed the plugin as I've recommended above then .

OPEN wp-content/plugins/google-maps-v3-shortcode-multiple-markers/Google-Maps-v3-Shortcode-multiplemarkers.php

there are 2 instances of

$returnme .=' var marker = new google.maps.Marker({

look for the code

$returnme .= ' html: site[2] });
   ';


underneath those commands.  After this add

[code]

    //  adding the circle code // littleripples.com
     $returnme .= "// Add a Circle overlay to the map. - // start
        var circle = new google.maps.Circle({
          map: MultipleMarkerMapDemo,
          radius: 50000 // 3000 km
        });/**/
        circle.bindTo('center', marker, 'position');";

   

[/code]


SAVE -> UPLOAD

and thats it :)  




Friday, 16 November 2012

I want to add Dropdown menus to my Wordpress Theme Dfmarine.

In the end I did this by adding a widget space and using the plugin Dropdown Menu Widget   This method means you still build the menus as you would in 'appearance > menus'  but would call the menu up from the Widget.

wordpress drop down menu not working

wordpress how to make my template use dropdown menus



Tuesday, 13 November 2012

wordpress menu link Forbidden You don't have permission to access /index.php on this server.

After getting the above issue the answer for me was as simple as this.

> I went to Settings > Permalink Settings

and click on 'Default' instead. 

>  then I checked the website and my menu links worked fine.

> on going back to > Settings >Permalink Settings  > Common Settings

and reset the selection to 'Post Name'  and by some sort of miracle the menu's work again. :)

Friday, 9 November 2012

Wordpress Twitter Widget Pro doesn't update - Heart Internet issues

The first problem here was with the Wordpress Plugin - Twitter Widger Pro not updating.  I eventually found the cause of this to be with Heart Internet.  Check here for the fix  Twitter Widget Pro Not Updating Fix for Heart Internet. 

Although this fix at first seemed to work fine I found that it would only work intermittently; and kept showing a 'No Tweets Available' message. 

The following code is probably a ugly hack; but to be fair at this point my experience of the Wordpress framework and logic is very basic.  However it does now work; so feel free to use.

OPEN twitter-widget-pro/wp-twitter-widget.php

FIND

if ( count( $tweets ) == 0 ) {


REPLACE this with the following IF statment


        if ( count( $tweets ) == 0 ) {
        global $wpdb;
    // here I'm going to check the database for any old results
//$tweet_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '%_transient_twp_%' " ) );
 $tweet_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '%%_transient_twp_%%' ;" ) );
// echo"$tweet_count
";

    if($tweet_count==0){
        $widgetContent .= '
  • ' . __( 'No Tweets Available', $this->_slug ) . '
  • ';
    } else {
    $lasttweetrow = $wpdb->get_row("SELECT * FROM $wpdb->options WHERE option_name LIKE '%_transient_twp_%'
    ORDER BY option_id DESC
    LIMIT 1;");

    $options = $lasttweetrow->option_value;   
    $options_array = explode(';', $options);
    $tweetrow = $options_array[11];       
    $tweet_array = explode(':', $tweetrow);
    $tweet = $tweet_array[2];
    $tweet = str_replace("\"", "", $tweet);

    $tweetusernamerow = $options_array[34];       
    $tweetusername_array = explode(':', $tweetusernamerow);
    $tweetusername = $tweetusername_array[3];
    $tweetusername = str_replace("\"", "", $tweetusername);

    $tweetcreatedrow = $options_array[52];       
    $tweetcreated_array = explode(':', $tweetcreatedrow);
    $tweetcreated = $tweetcreated_array[3];
    $tweetcreated = str_replace("\"", "", $tweetcreated);




    $args['title'] = "Twitter: $tweetusername";

            $args['title'] = apply_filters( 'twitter-widget-title', $args['title'], $args );
            $args['title'] = "Twitter";
            $widgetContent .= $args['before_title'] . $args['title'] . $args['after_title'];
           

    $widgetContent .= "

  • $tweet



  • ";

        }

            }


    Wordpress and a search to the database inside the code

    Hi

    Here's a couple of tips when starting out with a bit of Wordpress development.  What I need to do is add a check within a plugin.  Take a look here How to connect to the database from inside Wordpress for the code you need.

    Here's a couple of tips that I've had to find out. 

    * firstly you may  need to declare the $wpdb; object above your call to the database

    Secondly

    why cant i use % in wpdb prepare statement

    why cant i use percentage sign in wpdb prepare statement


     in a LIKE statement just double up the %% 

    ie

    $tweet_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '%_transient_twp_%' ;" ) );


    will be

    $tweet_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '%%_transient_twp_%%' ;" ) );

    Thursday, 8 November 2012

    Twitter Feed Widget works intermittently .

    Twitter Feed Widget works intermittently .


    I wondering how this effects the mysql and if theres a way I can make sure the MySQL  doesn't update if a null result.

    >  the above doesn't seem possible as there are tweets in the MySQL but they're not being included.

    >  on line 571 of wp=twitter-widget.php then you'll see the code

    if ( count( $tweets ) == 0 )

    which runs the 'No Tweets Available' message.


    line 555 .

    $tweets = $this->_getTweets( $args );


    line 737

        private function _getTweets( $widgetOptions ) {
            $key = 'twp_' . md5( $this->_getFeedUrl( $widgetOptions ) );
            return tlc_transient( $key )
                ->prevent_background()
                ->expires_in( 5 ) // cache for 5 minutes
                ->updates_with( array( $this, 'parseFeed' ), array( $widgetOptions ) )
                ->get();
        }



    I can't find anywhere that writes to the database - having said I can see the tweets come up in 'wp_options'  listed under '_transient_twp_'


    if I do a search for most recent and

    SELECT *
    FROM `wp_options`
    WHERE `option_name` LIKE '%_transient_twp_%'
    ORDER BY `option_id` DESC
    LIMIT 1

    this will bring back the result I want.


    $lasttweetrow = $wpdb->get_row("SELECT * FROM $wpdb->wp_options WHERE `option_name` LIKE '%_transient_twp_%'
    ORDER BY `option_id` DESC
    LIMIT 1");



    Which has made the if ( count( $tweets ) == 0 )  code into.

        if ( count( $tweets ) == 0 ) {
        // here I'm going to check the database for any old results
    $lasttweetrow = $wpdb->get_row("SELECT * FROM $wpdb->wp_options WHERE `option_name` LIKE '%_transient_twp_%'
    ORDER BY `option_id` DESC
    LIMIT 1");

    $options = $lasttweetrow->option_value;  
    $options_array = explode(';', $options);
    $tweetrow = $options_array[11];      
    $tweet_array = explode(':', $tweetrow);
    $tweet = $tweet_array[2];

    }

    Tuesday, 6 November 2012

    Wordpress Plugin Twitter Widget Pro has stopped updating

    The following solution is for the above problem if you have Heart Internet; however it is possible the same problem may effect other hosts as well.

    The solution you need is on this page; Twitter Widget Pro not updating.  
    I would note though that not only did I first need to delete the plugin I also needed to delete it from the MySQL data base.  I recommend doind a search for your twitter username in MySQL and make sure all details are deleted ( BACKUP FIRST )

    Tuesday, 30 October 2012

    Where to stick a function in your MVC Joomla Module

    The situation was this:  I had some code copied from a website that I want to put in the output of the module.

    Even if I wanted to ( which I don't ) I wouldn't be able to copy and paste it into the tmpl/default.php file; as some of the code is built into function. 

    Here's what you can do with the functions; so that you can use them from this file or anywhere else in the module. 

    OPEN your helper.php  or controller.php file and put the function before the closing }


    you can then call up this function with something like.

    TheNameOfHelperControllerClass::functionName($value1)



    Monday, 29 October 2012

    Renewal for SSL Certificate hasn't worked

    If your SSL certificate renewal hasn't been automatically done then it's probably because you haven't replied to the email that has been sent to you at admin@yourwebsite.com.   look for it and reply. 



    Friday, 19 October 2012

    Wordpress - Add a Widget space to a template and add a widget to it.

    This is a simple task that any developer making changes to a Wordpress template will need to know.


    It's pretty simple; theres two elements to it. Firstly to make sure it's picked up in your admin then edit function.php  - and add it to the template itself.

    in function.php ( in your template folder )

    the code here for me was


    if 

    ( function_exists('register_sidebars') )
        register_sidebar();



    ?>


    and the call up in the template is


    
    

    to use multiple widget areas I changed function.php to


    if ( function_exists('register_sidebars') ){
        register_sidebar(array(
        'name' => 'Right Sidebar',
        ));
        register_sidebar(array(
        'name' => 'Top Middle',
        ));
    }
    ?>

    and the call up needs to be changed to - if you get the gist.

                                           if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Top Middle') ) : endif;                    ?>






    Adding a Twitter Feed to your Blogga Wordpress Theme

    Phew !  Well this ended up being a real struggle in the end. 

    My simple aim was to get the Twitter feed working in my Blogga theme. 

    At first my issue was to get the Plugin to work at all.  I thought it may well to with the Twitter RSS Feed API changes

    After making the changes in TwitterBundle in the theme folder, I could still not get it to work.  So I then installed a whole heap of other Twitter plugins to see if I could get them to work.  To no avial.

    After reading comments about Twitter Widget Pro and seeing that others have it working since these changes I loaded the plugin on a clean installation of the same version of Wordpress.  It worked ! 

    Telling me that it must be a conflict. ! 

    I then tried turning off all other Widgets - which didn't effect anything.

    The solution was to go into my theme; through the left hand side menu in wp-admin/

    > click on 'twitter & RSS'   and change 'Enable Twitter' to NO.



     This gets the plugin working - but it doesn't look so great .


    Check out Customise Twitter Widget Pro but BACKUP first as these changes blew up on me a couple of times.

    However in the end I got it to look like this




    I've included my CSS underneath  and I also made this change to code added to display a twitter bird instead of the customers image.

    OPEN wp-content/plugins/twitter-widget-pro/wp-twitter-widget.php

    comment out

    $img = $this->_api_url . 'users/profile_image';
            $img = add_query_arg( array( 'screen_name' => $user->screen_name ), $img );
            $img = add_query_arg( array( 'size' => $args['avatar'] ), $img );

    and replace with

    $img = 'http://www.hardycarpets.net/images/chirpChirp.jpg';

    or whatever your image is .

    Wednesday, 17 October 2012

    Twitter feeds not working in Wordpress anymore - October 2012

    wickett twitter Error: Twitter did not respond. Please wait a few minutes and refresh this page.

    And other Wordpress Twitter Plugins seem to have the same issue.  

    I found this post Fix for twitter feed error

    For the plugin Wickett Twitter Widget  -  I fixed it by changing this line of code.

    OPEN
    wp-content/plugins/wickett-twitter-widget/wickett-twitter-widget.php

    find ( around line 200 )

    $instance['account'] = str_replace('http://www.twitter.com/', '', $instance['account']);


    REPLACE WITH

    $instance['account'] = str_replace('http://api.twitter.com/1/', '', $instance['account']);

    What adds the Page content to the page in a Wordpress theme - Developer level

    Ok here's the issue.  On the Wordpress theme I'm using ( Blogga ) they have a page which calls up dynamic code to display team members .  However I'd also like to use text underneath to this page.

    Here's what you need to do .  At the top of the page add


    the_post();

    ?>

    and where you want to show the page content add



    you can take a look at this page at Team Page Modified.

    Sunday, 14 October 2012

    A blogger .com andriod app test

    If youve found this blog then I wonder why!  as its my most pointless post I've written to date.  If you are reading this then it at least shows that the Blogger Android App works.  i've attached a random picture too, to see if that works.

    Check my website little ripples for a blog later tonight.

    This is blogged from Newquay but the picture is from the camel trail,


    Thursday, 11 October 2012

    Changing the layout of the Content page in Blogga Theme for Wordpress

    This is another hack to the theme 'Blogga' on the contact page.  The original Contact page wasn't good enough for what I need to do as the company the website is for has 2 addresses.

    To display the map I used the Google maps embed code but I also needed to do a bit of deleting and swapping over of sections of the page. 

    The page you need to edit for this is

    themes/blogga/template_parts/contact-sidebar_right.php

    Here's how I got out page to look



    Wednesday, 10 October 2012

    Changing the font sizes and layout of Wordpress Plugin Ebay Feeds

    After installing the Wordpress Plugin Ebay Feeds I wanted to make a few changes to the look of the widget.


    Some things I could change through the CSS; some I found it harder to get to the CSS of the value.   So made some changes in the display.  Of which was a bit of a hack; as follows.

    OPEN wp-content/plugins/ebay-feeds-for-wordpress/ebay-feeds-for-wordpress.php

     FIND

    $newdescription = str_replace('target="_blank"', '', $item->get_description());

    ADD UNDERNEATH

        $newdescription = str_replace('
    Buy it now', '
    Buy it now', $newdescription);
        $newdescription = str_replace('BST', '', $newdescription);
        $newdescription = str_replace('', '
    ', $newdescription);
        $newdescription = str_replace('Buy it now', '
    Buy Now
    ', $newdescription);
       



    Here's the CSS changes I used as well.


    li.widget_ebay_feeds_for_wordpress_widget h2{
    display: none;
    }

    .widget_ebay_feeds_for_wordpress_widget{
    padding-left: 20px;
    }

    .ebayfeed {
        -moz-border-bottom-colors: none;
        -moz-border-left-colors: none;
        -moz-border-right-colors: none;
        -moz-border-top-colors: none;
        background-color: #F7E89C;
        border-color: #F5DF8C #F5DF8C -moz-use-text-color;
        border-image: none;
        border-style: solid solid none;
        border-width: 1px 1px 0;
        position: relative;
        width: 240px;
        text-replace: "£" "£";
    }

    h4.ebayfeedtitle a {
     color: #002398;;
        text-decoration: none;
        font-size: 80%;
    }

    h4.ebayfeedtitle a:hover {

        text-decoration: underline;
        font-size: 80%;
    }

    h4.ebayfeedtitle a:visited {
     color: #663399;;
        text-decoration: none;
        font-size: 80%;
    }

    .ebayprice{

    }

    div.ebayfeed table tr td div span strong{
    font-size: 200% !important;
    }

    div.ebayfeed table tr td div{
    font-size: 80%;
    }
    h4.ebayfeedtitle{
    text-align: center;
    }

    div.widget-acx-social-icons-widget-3-widget {
    padding-top: 15px;
    padding-bottom: 15px;
    }

    div.ebayfeed table tr td div div div{
    display: none;
    }

    div.buyprice {
    display: none;
    }

    Friday, 5 October 2012

    Adding 'Find Out More' Here text to the Info button in Folio Two Wordpress Theme

    In the Folio Two theme it was mentioned by some that the Info button in the Project slides wasn't very easy to find.  So what we need was some text showing us the way.

    The solution to this wasn't that straight forward; as the page moves dynamically when enlarged or decreased ( mean a static CSS placement would be useless )  and also as the info button is created in Javascript many changes would need to be made to the css to accommodate this.  The following code uses a '-' value may not work in every browser; however as far as I've tested it works in every browser supported by Folio Two.


    Here's what our image looks like now on www.wisemonkeymedia.co.uk



    OPEN  wp-content/themes/folio-two/js/fulldivgal-v2.js


    on line 23

    var fdgInfo = $('Info')


    CHANGE TO

    var fdgInfo = $('
    Info')



    SAVE 



    OPEN  wp-content/themes/folio-two/style.css 

    ADD 


    div.clickhere{
        background: url("images/skins-items/Find-out-more.png") no-repeat scroll 0 0 transparent;
        height: 34px;
        margin-left: -185px;
        margin-top: 20px;
        position: fixed;
        width:  199px;
    }


    SAVE



    Feel free to make your own PNG and change the CSS values as needed.

    Tuesday, 2 October 2012

    Developer Notes on my Joomla Payroll system.


    I have now blogged about the features and have made the code I have written this far in, available at


    Problems and issues.

    Firstly the component works in conjuction with Community Builder. 

    To add shifts you'll need at least this mysql table from CB .



    CREATE TABLE IF NOT EXISTS `#__comprofiler` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `user_id` int(11) NOT NULL DEFAULT '0',
      `firstname` varchar(100) DEFAULT NULL,
      `middlename` varchar(100) DEFAULT NULL,
      `lastname` varchar(100) DEFAULT NULL,
      `hits` int(11) NOT NULL DEFAULT '0',
      `message_last_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
      `message_number_sent` int(11) NOT NULL DEFAULT '0',
      `avatar` varchar(255) DEFAULT NULL,
      `avatarapproved` tinyint(4) NOT NULL DEFAULT '1',
      `approved` tinyint(4) NOT NULL DEFAULT '1',
      `confirmed` tinyint(4) NOT NULL DEFAULT '1',
      `lastupdatedate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
      `registeripaddr` varchar(50) NOT NULL DEFAULT '',
      `cbactivation` varchar(50) NOT NULL DEFAULT '',
      `banned` tinyint(4) NOT NULL DEFAULT '0',
      `banneddate` datetime DEFAULT NULL,
      `unbanneddate` datetime DEFAULT NULL,
      `bannedby` int(11) DEFAULT NULL,
      `unbannedby` int(11) DEFAULT NULL,
      `bannedreason` mediumtext,
      `acceptedterms` tinyint(1) NOT NULL DEFAULT '0',
      `cb_employmentlevel` mediumtext,
      `cb_gender` mediumtext,
      `cb_telephone` varchar(255) DEFAULT NULL,
      `cb_mobile` varchar(255) DEFAULT NULL,
      `cb_address` mediumtext,
      `cb_postcode` varchar(255) DEFAULT NULL,
      `cb_mystrengths` mediumtext,
      `cb_traveldistance` varchar(255) DEFAULT NULL,
      `cb_usertype` mediumtext NOT NULL,
      `cb_employmentstatus` mediumtext NOT NULL,
      `cb_nameofemployer` varchar(255) DEFAULT NULL,
      `cb_addressline1` varchar(255) DEFAULT NULL,
      `cb_addressline2` varchar(255) DEFAULT NULL,
      `cb_addressline3` varchar(255) DEFAULT NULL,
      `cb_addressline4` varchar(255) DEFAULT NULL,
      `cb_resume` varchar(255) DEFAULT NULL,
      `cb_bankname` varchar(255) DEFAULT NULL,
      `cb_payeename` varchar(255) DEFAULT NULL,
      `cb_PayType` int(1) NOT NULL,
      `cb_bankaccountnumber` int(11) DEFAULT NULL,
      `cb_sortcode` varchar(255) DEFAULT NULL,
      `cb_riscemployeeno` int(11) DEFAULT NULL,
      `cb_insurancerate` decimal(10,2) DEFAULT NULL,
      `cb_accountancyFees` decimal(10,2) NOT NULL,
      `cb_loan` decimal(10,2) NOT NULL,
      `cb_loanRepaymentWeeks` int(5) NOT NULL,
      `cb_loanWeekAmount` decimal(10,2) NOT NULL,
      `bumber` varchar(50) NOT NULL,
      `cb_accountfeeslstdte` int(12) NOT NULL DEFAULT '0',
      PRIMARY KEY (`id`),
      UNIQUE KEY `user_id` (`user_id`),
      KEY `apprconfbanid` (`approved`,`confirmed`,`banned`,`id`),
      KEY `avatappr_apr_conf_ban_avatar` (`avatarapproved`,`approved`,`confirmed`,`banned`,`avatar`),
      KEY `lastupdatedate` (`lastupdatedate`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;


    If you haven't got Community Builder then a solution for dealing with Employee information will need to be create. 

    If you do have CB then I heavily changed CB core file to get that component to do what I wanted it to.

    Here's that file to download Comprofiler changes for my Payroll System

    ###############


    Secondly the front end is the backend; if you get my drift !  I made the system to look like the customers previous software solution.  As the system is on a intranet; then I see no issue with this .  However if it we're to be connect to the internet I would think I would have made this component part of 'Administrator' instead.

    The component was originally an adaption of 'com_projectfork' - and in that regards is not as clean as it should be.  There's a lot of unnecesary code in this component.  However it works, and a lot of effort has gone into to it to get it to this point !  Feedback and thoughts are welcome.

    Feature List of my Joomla Payroll System

    I'm just writing down a few notes for my official blog on this; that will appear on my main website later today.

    Here' s the feature list for the Joomla 2.5 Payroll System that I have made. 


    Customer Front End Admin Area

    > View Current Employees

    * Views a list of all Current Employees
    * Allows editing of
    First Name   
    Middle Name   
    Last Name   
    TelePhone   
    Mobile NO   
    Post Code   
    Addressline1   
    Addressline2   
    Addressline3   
    Addressline4   
    Bank Name   
    Account Number   
    Sort Code   
    Insurance Rate   
    Accountancy Fees   
    Loan   
    Loan Repayment Weeks   
    Weekly Amount (the last week will be the remaining amount)   
    PAYE
    * Employees can also be sent to 'Archive' and will then not appear on the

    major drop down.

    > Create Staff Invoices.
    * select a start date, end date and invoice date.
    * creates Excel document with all Employee addresses - shifts - deductions

    and calculations.

    > View Current Locations -  Edit details and check the history of of your

    Locations.  These details are available to edit.

    Venue Name* :   
    Venue Location* :   
    Company* :    
    Address Line 1* :   
    Address Line 2:   
    Address Line 3:   
    Address Line 4:   
    Post Code* :   
    Telephone No* :   
    Account Reference* :   

    > Add new venue.  Adding the details above.

    > Print location list.  Get a list of all Venues.

    > Create Location Invoicing. 

    * select a start date, end date and invoice date.
    * Create invoices for each loaction. 
    * Listing times and shifts for all work there between dates selected.
    * Prints out Excel pages and does calculations on the page.

    > Edit Company

    * As well as Employee and Locations.  You can then also group by Company. 

    For example 'X' company may control a handful of 'locations'  which then has

    'x' amount of staff working there.

    > Print cover sheets


    * this function is retrieve data for previous invoice dates that may be

    requested by the 'Company'

    > Compile BACS report

    * this is run first for any date period of shifts.
    * enter start date and end date
    * the results will then print out a list of Employee, BACS number and the total

    they need to be paid.  With all deductions taken off.
    * HTML and Excel version is produced.
    * the BACS run for any date can only be added once.

    > View Timesheets.

    * select by employee and/or date and/or location.
    * select by employee and between selected dates.
    * show and edit the following information.
    Staff Member
    Venue
    Shift Date
    Start Time
    End Time
    Pay Rate
    inv Rate
    Post Date Shift
    Post Date Shift Expire Date
    Hours
    Pay Total


    > Add Timesheets

    * add this information

    Staff Member :    
    Venue :    
    Task :    
    Shift Date :    
    Start Time :    
    End Time :    
    Or Hours :    
    Hourly Rate :   
    Invoice Rate :   
    Post Date Shift:

    > Latest timesheets -
    * view and edit the last 20 shifts.

    > Add Multiple Timesheets

    > Add Alterations -

    * add or minus amounts
    * state a reason
    * Bacs and invoices will all include this calculation.

    * Add upto 10 shifts.
    * For any location where the shifts are done on the same date.

    Friday, 28 September 2012

    Playing your SoundCloud files on Folio Two Wordpress Theme.

    If you follow the instructions the same as you would for you You Tube or Vimeo files then it doesn't work.  What you need to do in the case of SoundCloud is to input all the Embed Code.  You can find this by using the 'share' button from your files soundcloud page. 

    Here some instruction if you need it.

    http://www.youtube.com/watch?v=jfWwGkKPqJw

    Tuesday, 25 September 2012

    CB Connect Module

    If your looking for the CB Connect Module that should go with the CB Connect Plugin for Community Builder; then look now longer as you don't need it.

    What you need to do is use the 'CB Login' module that comes packed with CB Subs and at the bottom of the Module setting; where it says 'CB Plugins integration'  click on 'yes'  .  Here's a quick vid of this. 

    http://www.youtube.com/watch?v=udXW0AbXbhw&list=UUFiGANCNI3UOa9wn7k3vFMg&index=1&feature=plcp

    Thursday, 20 September 2012

    Infinite loop detected in JError - Joomla 2.5 transfer

    This is a common error line when transferring a Joomla 2.5 website .

    The answer this time in my case was to double check the MySQL database information that I had saved in the configuration.php file - in root.

    Wednesday, 19 September 2012

    Wordpress Gallery isn't showing my Vimeo Video

    And I get this message

    'Sorry

    There was a problem loading this video'


    Here's the solution that I found.  The address I was trying to enter for the film was

    https://vimeo.com/45162153

    if I change this to

    http://vimeo.com/45162153

    and take off the SSL it now works.

    Tuesday, 18 September 2012

    Transfer wordpress folio two template website

    After transfering a Wordpress website with Folio Template I was getting 2 problems.

    > Firstly a blank page intoduction page.

    > Secondly all links go to the old site.

    The solution to this is to open MySQL and go to the 'wp_options' table.

    Search for your old domain name in this table. And edit those cells. 

    ############################

    folio two template transfer black first page

    folio two template transfer gallery links to previous site

    Wednesday, 12 September 2012

    Changing the right hand navigation and Social Buttons on Folio Two Wordpress Theme

    Here's the mission I'm looking to change the navigation that

    currently looks like this .




    What I want to do is change the background colour and

    change the Social Media buttons.

    To change the background OPEN

    wp-content\themes\folio-two\style.css

    around line 677  FIND


    .gal-v2 #fdgNav span#fdgPrev{background:url(images/skins-

    items/sprite-gal-handlers.png) no-repeat 0 -43px #000;}


    here you need to change the color before the closing ';}'  - to

    what ever you want . 

    Also change the colour in all the following CSS commands that

    start with

    .gal-v2 #fdgNav span#

    i've chose to swap the white with #60bb46
    and black with #93cc79

    !! Now to the Social Media buttons.  The images themselves

    need to swapped in

    wp-content/themes/folio-two/images/social/

    but if your images are a different size like mine then you'll also

    need to change some css.

    swap the background image we're pointing to on line 689

    I made a new speach bubble and labelled it 'bubble-background'  - you may also need to changes the height and margins in the following CSS

    .gal-v2 #fdgNav #fdgSocialOptions{display:block;float:left;width:310px;height:60px;background:url(images/skins-items/bubble-background.png) no-repeat 0 0;margin:4px 4px 0 -255px;margin-top:-13px \9;display:none;}

    Monday, 3 September 2012

    Google Base Datafeed for Joomla 2.5 and Virtuemart 2.0

    UPDATED 31 October 2012: 
    I used to use RedMystic to help write me Google Base Datafeed but at the time of working there's no upgrade for virtuemart 2 and Joomla 2.5 .  So I written a backend component that outputs a Xml file you can write to a file and upload. 


    This component is basically just a component button in administrator that will then take you to a page that has the text with the xml on. 
    You then need to copy and paste this text into a .xml file that you'll need upload from your Google Merchant account.
    Product Mapper for Virtuemart 2.0 on Joomla 2.5

    I've made some improvements to my Product Mapper Component which moves it to version 0.9.

    Rather than having an on screen output for the product.xml file it now gives you a download, meaning less sorting of invalid values afterwards .

    Here's the change - I added this function to the controller in adiministrator area.

    function sendToFile($xmlfile) {
    $fp = @fopen('products.xml','w');
    if(!$fp) {
        die('Error cannot create XML file');
    }
    fwrite($fp,$xmlfile);
    fclose($fp);
    }



    However at this stage this Product Mapper component is still not ready for a full release . 
    What it needs is to take your Category names and do a match with Google Categories. 
      What I would like to do is make a manual selection feature which saves this information for you in mySQL.
    Hopefully I will add this at the next development. Please contact me on dj@lrip.eu if you would like this feature added quickly. 

     Unfortunatley for now you will need to download your XML file below and open it with your favourite editor; adding the google_product_category yourself.

    I'll try and get round to this change next month.



    You can get this information from Google Merchant Category



    Feel free to use and copy this code as you wish; but let me know of any improvements as its quite likely I'd like to use an updated version myself. 


    Google Base Datafeed for Joomla 2.5 and Virtuemart 2.0 Version 0.9

    Google Base Datafeed for Joomla 2.5 and Virtuemart 2.0 Version 0.8

     Here's a video of how it works.

    http://www.youtube.com/watch?v=pEOlWbKEbSM

    Friday, 31 August 2012

    joomla getListQuery limit 20 problem

     JModelList::getListQuery - How to expand limit.

    I'm using the following code in my Component Model to retrieve my database array

    protected function getListQuery()
            {
                    // Create a new query object.          
                    $db = JFactory::getDBO();
                    $query = $db->getQuery(true);
                    // Select some fields
                    $query->select('product_id,product_sku,product_s_desc,product_thumb_image');
                    // From the virtuemart product table
                    $query->from('#__vm_product');
                    $query->where('product_in_stock >0','product_publish =1');
                    $query->limit('0,40');
                    return $query;
            }


    the problem with this is that it's only return me 20 results at a time.  And I need this to be unlimited.   The solution for this I found in this post JModelList::getListQuery  limits to 20 only
    What you need to do is add this code above the function getListQuery
    protected function populateState()
    {
            $this->setState('list.limit', 0);
    }


    and it'll work like magic :)

    Thursday, 30 August 2012

    Building an Administration based Component for Joomla 2.5

    Using the Hello World as a basis for a component, found at Joomla 2.5 Hello World Component Example [http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Adding_a_view_to_the_site_part]

    There's a couple of things missing on this page and that's the examples for

    admin/sql/updates/index.html and admin/sql/updates/mysql/index.html are missing. 

    You can find the example code for that at http://tutsforu.com/using-database-in-components.html

    which is to put

      DROP TABLE IF EXISTS `#__productmapper`;
        CREATE TABLE `#__productmapper` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `greeting` varchar(25) NOT NULL,
        PRIMARY KEY (`id`)
        );
        
        INSERT INTO `#__productmapper` (`greeting`) VALUES
        ('DB Hello World!'),
        ('DB Good bye World!');

    in both files. 

    The other thing that's missing is the zip files for the project.   Here's mine for the very basic starting point of the component.  Mine has been relabelled 'productmapper' 

    Download Basic Joomla 2.5 component here

    Wednesday, 29 August 2012

    Keeping a record of Deductions for retrieval in Staff Invoicing

    Joomla 2.5 Payroll System

    Here are some notes on how deductions are retrieved and displayed in Staff Invoicing .

     open components/com_projectfork/models/bacs.php

    line 187

    $sumvalues = $sumvalues - $tot_accountancy_fees;


    for loans code is under line 194


    #####

    line 235 we do an insert into  #__alterations_bacs_amount

    I think we can enter here and retrieve by user_id .  but really could do with a date check as well to cross ref against.




    Tuesday, 21 August 2012

    PHP excel $objPHPExcel limit to 2 decimal places

    this is what  worked for me

    $objPHPExcel->getActiveSheet()->getStyle('H'.($current_row + 28))->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);

    php excel ->getNumberFormat()->setFormatCode

    what does PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00 mean









    I've seen other solutions but the above worked perfectly for me.

    Monday, 20 August 2012

    how to check for empty Left Join values where 3 tables are joined in Mysql

    If you've found this post then you'll probably done quite a specific search for a problem.  I'll explain what I've solved here and you can see if it's relevant to what your trying to achieve.


    I have 3 tables

    Shifts
    Projects
    and User

    What I need to do is run a check and see if I have any shifts that hasn't got user details attached to it.  And then return the details of this with some information from the Project table also

    Here's the solution

    SELECT tt.id, tt.project_id, tt.cdate, tt.start_time, tt.end_time, cp.user_id, cp.firstname, cp.lastname, pj.title, pj.location
    FROM vfvi7_pf_time_tracking AS tt
    LEFT JOIN vfvi7_comprofiler AS cp ON tt.user_id = cp.user_id
    LEFT JOIN vfvi7_pf_projects AS pj ON tt.project_id = pj.id
    WHERE cp.user_id IS NULL

    the tricks here are this

    * I've used LEFT JOIN twice

    in previous mysql queries I've used the syntax

    LEFT JOIN (
    vfvi7_comprofiler AS cp, vfvi7_pf_projects AS pj
    ) ON ( tt.user_id = cp.user_id
    AND tt.project_id = pj.id )

    but this didn't work.

    *  ALSO using IS NULL

    'WHERE cp.user_id IS NULL'  - it's as simple as that; this will let me know the shifts that haven't got a user assigned.

    Here's some phrases I used to search for this problem

    how to check mysql for a column with no left join

    mysql left join produces no results

    mysql find rows that have no left join

    Thursday, 16 August 2012

    javascript to check O (zero) is in decimal format

    I've been having a little problem with one of my input boxes in a form .  It seems that my code doesn't like '0' being entered.  Zero does not equate to '0.00' in PHP and this must be throwing an error somewhere. 

    However other number are fine; like '1' does not need to be entered as '1.00' . 

    php 0 to 0.00 conversion problems

    php 0 does not equal 0.00


    joomla component development how to force decimal input

    php force decimal input in form


    The quickest way to solve this problem for me was to write a bit of javascript takes that input box - and if the entered value is '0' - then change it to '0.00'  .  Here's the code.

    var x=document.forms["myForm2"]["hourly_rate"].value;
    if (x==0)
      {
      document.forms["myForm2"]["hourly_rate"].value='0.00';
      return;
      }



    with the form being something like

    < form name="myForm2" method="post">
    Hourly Rate* :
    < /form>

    Wednesday, 15 August 2012

    PHPExcel setting up the pages in a Workbook to print easily

    Tomorrow morning I need to visit the client and help set things up so that they can easily print the pages from a Workbook .  Here are some notes taken from PHPExcel Cheat Sheet

    How to add pagebreak view with PHPExcel
    $objPHPExcel>setBreak('A4', PHPExcel_Worksheet::BREAK_ROW);

    how to use $objPHPExcel>setBreak to make the page A4 sized

    how to set orientation in PHPExcel
    $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation


    Setting printing breaks on a row or column

    To set a print break, use the following code, which sets a row break on row 10.

    $objPHPExcel->getActiveSheet()->setBreak( 'A10' , PHPExcel_Worksheet::BREAK_ROW );

    The following line of code sets a print break on column D:

    $objPHPExcel->getActiveSheet()->setBreak( 'D10' , PHPExcel_Worksheet::BREAK_COLUMN );


    Setting a worksheet’s page orientation and size

    Setting a worksheet’s page orientation and size can be done using the following lines of code:

    $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);

    $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);

    Note that there are additional page settings available. Please refer to the API documentation for all possible options.

    After visiting the office it seemed that the main thing that needed doing was to scale to fit the page.

    The code I used here is .

         $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
                                $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
                                $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);


    the one thing you need to watch out for here is the the object for Active Sheet has been created.  So therefore put the above code under this code.

     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());

    and all will be good.

    Allow access to 2 IP addresses only

    What I'm looking to do here is to make my website that has a Payroll System on it only accessible to myself and the clients office.
    .htaccess will only allow certain ip . So this it the method I'm using.  Create or edit a .htaccess file.  ADD

    order deny,allow
    deny from all
    allow from 888.888.888.888
    allow from 888.888.888.881





    Find out my IP Address here


    Thank you to IP to Access for the .htaccess information

    Monday, 13 August 2012

    Why does my Joomla articles look wrong.

    Here's the Question posed.

    Everytime I upload an article on the website but it's the wrong format, is it possible for me to write the article in any format and then insert the HTML text in the HTML section?

    This is the one he said was wrong:



    But if I could use the above code in the correct format could I then use that on any article I create….?
    The HTML the page is controlled by a style sheet.  Which then applies the formatting to the whole site and therefore keeps continuity that we can easily change .  

    for example the code you just sent to me






    to achieve this on the css file I would use the code.

    div {
    color: #333333;
    font-family: Tahoma, Helvetica, Arial, sans-serif;
    font-size: 100%;
    margin-top: 8px;
    margin-right: 8px;
    margin-bottom: 8px;
    margin-left: 8px;
    background-image: initial;
    background-attachment: initial;
    background-origin: initial;
    background-clip: initial;
    background-color: #ffffff;
    line-height: 1.3em;

    }


    This way all you then need in the article for this to work is

    My text here


    And all the formatting is done for you. The easy way to do this is to use Wordpad or Notepad.   Using Word or other editors copies over loads of HTML garbage that we don't need.   I'm not sure what the best editor to use is on the mac, if you find out please let me know http://www.youtube.com/watch?v=a0-nXk2MzVU&feature=plcp  .  The other thing is not only will this HTML make the text look rubbish but can break the page.

    Here's a quick video I made showing a demonstration of this


    Tuesday, 7 August 2012

    Joomla 2.5 how to add a button with action to my module in the MVC format

    Here's the answer to a fairly simple task - which is how to add a form and button inside a module.  Keeping within our nice MVC format.

    Here's some of the searches I've done to research the solution for this.

    joomla should a mysql UPDATE query be in MODEL of Controller

    joomla development how to use a POST form in module

    Retrieving Data for GET & Post - Joomla Development

    my module has these files

    modules/mod_PRSwarnings/tmpl/default.php
    modules/mod_PRSwarnings/tmpl/index.php
    modules/mod_PRSwarnings/mod_PRSwarnings.php
    modules/mod_PRSwarnings/mod_PRSwarnings.xml
    modules/mod_PRSwarnings/helper.php
    modules/mod_PRSwarnings/index.php

     MODEL - this goes in  helper.php

    Inside your CLASS bracket add

         public function setCancelWarnings($shift_id){
          $db = &JFactory::getDBO();

          $query  = "UPDATE #__pf_time_tracking ";
          $query .= "SET `dShftChked` = '1' ";
          $query .= "WHERE id =$shift_id ";
          
          $db->setQuery($query);
          $db->query();
          echo "
    QUERY:$query
    ";
         
        }


    CONTROLLER - this goes in modules/mod_PRSwarnings/mod_PRSwarnings.php

    !! enter below the current code on your contoller page.

    $edit_warnings = JRequest::getVar('edit_warnings');
    // echo "EDIT - $edit_warnings
    ";

    if($edit_warnings=='Cancel Warninig'){
               
                $shift_id = JRequest::getVar('shift_id', '', 'POST');
                $setCancelWarnings = ModPRSwarnings::setCancelWarnings($shift_id);
                }


    VIEW  - this goes in tmpl/default.php

    put this where you want the form to be displayed

     echo "

         
       
       
    ";



    Although the code above is specific to my website I think it will be useful to others. As it shows a good demonstration of the logic of MVC in Joomla.  I welcome any discussion you may have on this.  Would you have done it differently.

    Mysql - Can I use WHERE and HAVING in the same query

    Yes is the quick answer .  It's just about the order that you call the 'HAVING' or 'WHERE' up. 

    Have a look at this webpage  How to call up HAVING and WHERE in the same MYSQL query  

    So with the following statement

    select id, user_id, cdate, start_time, end_time, count(*)
      from vfvi7_pf_time_tracking
      group by user_id, cdate
      having count(*) >1



    I cannot put my WHERE clause at the end but need to put it before the GROUP BY; like this


    select id, user_id, cdate, start_time, end_time, count(*)
      from vfvi7_pf_time_tracking
      WHERE dShftChked !=1
      group by user_id, cdate
      having count(*) >1



    Friday, 3 August 2012

    Mysql - Grouping Row and Counting them

    The problem:  I am printing out shifts done at certain venues.  And what I want to do is on some shifts rather than print out every shift; if the shift is done at the same time on the same date then these can be grouped together .  Also though I'll need to know how many shifts have been grouped together to refer to later in my code.

    Question : can I group by 3 different columns.

    Yes. and this gives me less row results - so if I can get a count of how many rows have been grouped then I'm on to a winner.

    Question:  How Can i get a count of how many rows have been grouped together by GROUP BY in MySQL

    By using count(*) as count in the select .  this gives me a column with how many times some rows have been grouped

    Here's the original mysql call .


    SELECT * FROM vfvi7_pf_time_tracking
    WHERE vfvi7_pf_time_tracking.cdate >=1339974000
    AND vfvi7_pf_time_tracking.cdate <=1340578800
    AND vfvi7_pf_time_tracking.project_id =7


    and the new mysql call is

    SELECT *, count(*) as count
    FROM vfvi7_pf_time_tracking
    WHERE vfvi7_pf_time_tracking.cdate >=1339974000
    AND vfvi7_pf_time_tracking.cdate <=1340578800
    AND vfvi7_pf_time_tracking.project_id =7  GROUP BY vfvi7_pf_time_tracking.cdate, vfvi7_pf_time_tracking.start_time, vfvi7_pf_time_tracking.end_time

    Thursday, 2 August 2012

    Joomla Frontpage Slideshow - Ordering Problem

    Being able to get your slides in order isn't as straight forward as it seems for the Joomla component Frontpage Slideshow;  So yesterday I made a short video for a client explaining how to do this.

    joomla development how to make a menu item for your component

     Here's a real quick one.  I'd made a component and couldn't find it in the menu selection in administrator. 

    To make sure your component is added to the menu selections then follow the instructions here.
     
    Joomla Development - Add a Component Menu Item

    My mistake was really simple though and that was that I was already using the same title  !!


    Friday, 27 July 2012

    Combning firstname and lastname as name in Mysql Query

    I had the following mysql statement that I thought I could simpify.

    $query = "SELECT #__users.id,#__users.name FROM #__users,#__comprofiler where #__users.id=#__comprofiler.user_id order by name ";
     

    this has become

    $query = "SELECT #__comprofiler.user_id as id, CONCAT(#__comprofiler.firstname,' ',#__comprofiler.lastname)AS name FROM #__comprofiler ORDER BY name ";


    which uses CONCAT and AS to use two colums and return as one; with a space in the middle also

    virtuemart 2.0 Paypal payment method not working

    After setting up my Virtuemart 2.0 store ; and setting up a payment method of Paypal - it wasn't working.


    The solution was to fill in all the min max details ( i also changed the group to 'default' ) and it now works.


    Thursday, 19 July 2012

    Adding PAYE and NON-PAYE ordering and message to the Bacs report.

    This is working in the Joomla Payroll System component I am developing.   I have already added a tick box to the employee area and now I need to add conditions to the BACS report so firstly the ordering is done by the Pay Type.  and then secondly I need to pick up when the change over happens in the table that is out putted.

    The details actually pass in and out of two tables when calculated.

    OPEN components/com_projectfork/models/bacs.php

    in the Query on line 50 that gets the details from the shifts - get the info from the column #__comprofiler.cb_PayType that had been added.

    on line 88 that information is picked up again with

    $PayType=$hrs->cb_PayType;


    and passed into the #__time_diff  row.  Which I've again set up the respective column.


    line 107  - information retrieved from #__time_diff . This time as well as filling the array with  the #__time_diff.PayType column; we also use the column to ORDER BY .  So that all the nonPAYE comes first and PAYE second.

    ORDER BY #__time_diff.PayType



    on line 151 we add the details to yet another table in

    , '$datares->PayType'



    It's from this table that's called up in the page

    OPEN components/com_projectfork/views/bacs/tmpl/default.php


    on line 82 the following code deals with whether or not to tell the frontend that the PAYE & NON PAYE columns have started.

    $PAYEorNOT = $ids->PayType;



    if ($lastPAYE != $PAYEorNOT ){

    echo ' ';


    if($PAYEorNOT == '0'){

    echo 'NON PAYE';
    }


    elseif($PAYEorNOT == 1 )
    {

    echo 'PAYE';


    }


    echo '';


    $lastPAYE = $PAYEorNOT;

    }

    FOR THIS TO WORK YOU ALSO NEED THE TABLE CELLS


    #__time_diff.PayType
    #__comprofiler.cb_PayType
    #__ alterations_bacs_amount.PayType

    Wednesday, 18 July 2012

    Virtuemart 2.0 Related Products Css

    Just a quick fix here to get all the related products on one line and get rid of the filename - without having to change any code.

    just paste this into your css file

    span.product-field-display{
    float: left;
    }

    span.product-field-display a:link, span.product-field-display a:visited, span.product-field-display a:hover{
    color: #666666;
        font-weight: bold;
    }

    span.vm-img-desc {
    color: #fff;
    }
    If anyone goes further and make changes to the layout of Related Products itself I'd be interested to know as I couldn't find where the code for this was



    Monday, 16 July 2012

    Virtuemart 2.0 Joomla 2.5 upgrade - related products information not transferred.

    On the old Virtuemart the table 'jos_vm_product_relations' is used for the product relations information.

    And in Virtuemart 2.0 the table 'j25_virtuemart_product_customfields' is used .  this table also contains dates and time of the entry.  So you may want to change this in the script I have written here.

    You'll need to put you mysql details in a /includes/config.php file .

    Apart from that it should help you as long as all the product id's have stayed the same in your transfer.

    #######


    echo "hello world

    ";

    include ("includes/config.php");




    // now i need to do a database call and get the list of related products from Virtuemart
    $query = "SELECT *
    FROM  `jos_vm_product_relations` ";
    ;
    $result = mysql_query($query)
    or die ("1 st Query failed");
    $customfield_id = '1';
    while ($row = mysql_fetch_array($result))
    {

    $product_id = $row['product_id'];
    $related_products = strip_tags($row['related_products']);
    $related_products_array = explode("|", $related_products);

    foreach ($related_products_array as $related_product){

    echo "('$customfield_id', '$product_id', 1, '$related_product', NULL, '', 0, '2012-07-15 22:10:01', 62, '2012-07-15 22:10:01', 62, '0000-00-00 00:00:00', 0, 0),
    ";
    $customfield_id++;
    }

    }

    echo "
    finished;";





    ?>

    Friday, 13 July 2012

    Compare Value in Mysql - using count arguement inside the query

    What I was trying to achieve here was to be able to check for duplication of images.   In this scenario I'm looking for  users 'Employee'  who have been put down as doing 2 shifts at exactly the same time .   Ideally I want the mysql query to be doing as much work as possible.

    For this task I'm running 2 queries in total . 

    1.  the first one makes a count of employees who have shifts on the same day.
    2. Secondly to run through those employees and see if there shifts clash.

    I'm pretty sure that there might be a one query solution here somewhere and when I get a chance I may well come back to this and have a look.  Programming can be a bit like playing Soduko sometimes and you have to stare at the problem for a while before it comes to you.

    Anyway to those two queries, the trick in the first one is using HAVING over using WHERE enabling me to use COUNT as a WHERE clause inside the mysql query.   Take a look at this example.


    $query  = "select ";
          $query .= "id, user_id, cdate, start_time, end_time, count(*) ";
          $query .= "from #__pf_time_tracking ";
        $query .= "group by user_id, cdate having count(*) >1 ";


    This returns to me the rows of all Employees that have more than one shift on that day.

    Then with those rows I iterate through them to see if there is a time clash.  The trick here using BETWEEN as the comparison operator.   It calculates whether the shift being iterated through has at any time in the shift got a time that collides with the start time of the shift we are checking in the MYSQL query.

             $query  = "select ";
          $query .= "tt.project_id, tt.start_time, tt.end_time, cp.user_id, cp.firstname, cp.lastname, pj.title, pj.location ";
          $query .= "from #__pf_time_tracking as tt ";
            $query .= "LEFT JOIN (#__comprofiler as cp, #__pf_projects as pj) ON (tt.user_id=cp.user_id AND tt.project_id=pj.id) ";
        $query .= "WHERE tt.user_id='$user' AND tt.cdate='$date' AND tt.start_time BETWEEN '$start_time' AND '$end_time' AND tt.id != '$shift_id' ";

            

    Please let me know if you think you know of any improvements to this logic.

    Thursday, 12 July 2012

    Make a simple Module in Joomla 2.5

    I've just made a real simple module for Joomla 2.5 and I think it's worth recording as a reference for future module creation - as a decent sample template for MVC module in Joomla.

    It tackles some simple questions I was asking when looking to create a module.

    Like ' where to add the logic for Database calls in a Joomla Module' and how to fix a Failed loading XML file error when uploading a module.

    Heres the files and folders we needed to create.

    modules/mod_PRSwarnings/
    tmpl/default.php
    tmpl/index.html
    helper.php
    index.html
    modPRSwarnings.php
    modPRSwarnings.xml


    and here's the code


    modules/mod_PRSwarnings/tmpl/default.php
    [code]



    /**
     * PayRollSystem Warnings
     *
     * @package PayRollSystem Warnings
     * @subpackage PayRollSystem Warnings
     * @version   1.0 July, 2012
     * @author    DJ http://www.littleripples.com
     * @copyright Copyright (C) 2010 - 2012 www.littleripples.com, LLC
     * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
     *
     */

    // no direct access
    defined('_JEXEC') or die;





    if($items != NULL ){

     foreach ($items as $item) {
    $user_id = $item->id;
    $user_id2 = $item->user_id;
    $project_id = $item->project_id;
    $cdate = $item->cdate;
    $start_time = $item->start_time;
    $end_time = $item->end_time;
    $firstname = $item->firstname;
    $lastname = $item->lastname;

    echo "Last Shift: id $user_id ($user_id2)- $firstname $lastname  - Started $start_time - finished $end_time at ";

    }
    }

    [/code]

    modules/mod_PRSwarnings/tmpl/index.html
    [code]

    [/code]



    modules/mod_PRSwarnings/helper.php
    [code]


    /**
     * PayRollSystem Warnings
     *
     * @package PayRollSystem Warnings
     * @subpackage PayRollSystem Warnings
     * @version   1.0 July, 2012
     * @author    DJ http://www.littleripples.com
     * @copyright Copyright (C) 2010 - 2012 www.littleripples.com, LLC
     * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
     *
     */

    // no direct access
    defined('_JEXEC') or die;

    class ModPRSwarnings
    {
     public function getLastShift(){
          $db = &JFactory::getDBO();

          $query  = "select ";
          $query .= "tt.id, tt.project_id, tt.cdate, tt.start_time, tt.end_time, cp.user_id, cp.firstname, cp.lastname ";
          $query .= "from #__pf_time_tracking as tt ";
        $query .= "LEFT JOIN (#__comprofiler as cp) ON tt.user_id=cp.user_id ";
    $query .= "limit 1 ";
       

          $db->setQuery($query);
          $items = ($items = $db->loadObjectList())?$items:array();
          return $items;
        }


    }

    [/code]


    modules/mod_PRSwarnings/modPRSwarnings.php

    [code]


    //no direct access
    defined('_JEXEC') or die('Direct Access to this location is not allowed.');

    // include the helper file
    require_once(dirname(__FILE__).DS.'helper.php');


    $items = ModPRSwarnings::getLastShift();

    // include the template for display
    echo 'Hello World';
    require(JModuleHelper::getLayoutPath('mod_PRSwarnings'));

    [/code]




    modules/mod_PRSwarnings/modPRSwarnings.xml

    [code]


        PayRollSystem Warnings
        DJ Millward
        July 2012
        Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
        http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
        dj@lrip.eu
        littleripples.com
        1.0.0
        This module works with the PayRollSystem component to show the last shift added and any warningings on the system
       
            mod_PRSwarnings.php
            helper.php
            mod_PRSwarnings.xml
            index.html
            tmpl/default.php
            tmpl/index.html
       
       
           
       


    [/code]


    When uploading the module to my website I tried to use the 'Discover' function .  But got the error.

     *Failed loading XML file** * XML: failed to load  external entity * joomla development


    the fix for this was to use the 'Install from Directory' method of installing a module.