Just another WordPress site

Blog

Getshopped – Add more details to sales CSV

Posted by on Oct 25, 2011 in blog, getshopped, hack, php, WordPress, WordPress 3.0, WordPress Development, WordPress Plugins, wp e-commerce | 1 comment

I have previously showed I added shipping columns to the sales logs page in a getshopped (Wp-Ecommerce) installation. This was fine but now we need that data to show up in the csv download.

Here’s how to do it-

Open wp-content/plugins/wp-e-commerce/wpsc-admin/ajax-and-init.php and find the function wpsc_purchase_log_csv();

Find this-

$headers = "\"Purchase ID\",\"Purchase Total\","; //capture the headers

And replace it with this-

$headers = "Purchase ID, Item Price, Item Shipping, Item Total,"; //capture the headers

A few lines under that you will find the beginning of the foreach loop, which looks like this-

foreach ( (array)$data as $purchase ) {

Right after that add this-

              $purch_item_price = $purchase['totalprice'];
      
              $price_wo_shipping = $purch_item_price - (float)preg_replace('/[^0-9.]/', '', $purchase['base_shipping']);

And then below that should be this-

            $form_headers = '';
            $output .= "\"" . $purchase['id'] . "\","; //Purchase ID
            $output .= "\"" . $purchase['totalprice'] . "\","; //Purchase Total

Replace it with this-

            $form_headers = '';
            $output .= "\"" . $purchase['id'] . "\","; //Purchase ID
            $output .= "\"" . $price_wo_shipping . "\","; //Item w/o shipping
            $output .= "\"" . $purchase['base_shipping'] . "\","; //Shipping
            $output .= "\"" . $purchase['totalprice'] . "\","; //Purchase Total

 

And you’re done!

Have fun!

 

GetShopped – Add order without shipping column to sales view

Posted by on Oct 6, 2011 in blog, getshopped, hack, php, WordPress, WordPress 3.0, WordPress Development, WordPress Plugins, wp e-commerce | 0 comments

The sales view in the wp-ecommerce (GetShopped) is great but it will show you the total price of an order rather than the price without shipping, the shipping, and the total.

To introduce this functionality you do have to hack the plugin files, but there is not another way as I can not see any hooks I could make use of. If I have missed one, please do let me know!

Here is what you need to do-

Open ‘plugins/wp e-commerce/wpsc-admin/display-sales-logs.php’, go to around line 75 and find this-

         if(!isset($_REQUEST['purchaselog_id'])){
            $columns = array(
               'cb' => '<input type="checkbox" />',
               'purchid' => __( 'Order ID', 'wpsc' ),
               'date' => __( 'Date / Time', 'wpsc' ),
               'name' => '',
               'amount' => __( 'Amount', 'wpsc' ),
               'details' => __( 'Details', 'wpsc' ),
               'status' => __( 'Status', 'wpsc' ),
               'delete' => __( 'Delete', 'wpsc' ),
               'track' => __( 'Tracking ID', 'wpsc' )
            );

Change it to this-

         if(!isset($_REQUEST['purchaselog_id'])){
            $columns = array(
               'cb' => '<input type="checkbox" />',
               'purchid' => __( 'Order ID', 'wpsc' ),
               'date' => __( 'Date / Time', 'wpsc' ),
               'name' => '',
               'pricewoshipping' => __( 'Price w/o Shipping', 'wpsc' ),
               'shipping' => __( 'Shipping', 'wpsc' ),
               'amount' => __( 'Total', 'wpsc' ),
               'details' => __( 'Details', 'wpsc' ),
               'status' => __( 'Status', 'wpsc' ),
               'delete' => __( 'Delete', 'wpsc' ),
               'track' => __( 'Tracking ID', 'wpsc' )
            );

I have added in two new columns and also changed the Amount column name to Total. Then go to around line 452. You’re looking for the function called get_purchaselogs_content(). You will see a while statement that starts like this-

   while(wpsc_have_purch_items()) : wpsc_the_purch_item();
   ?>
   <tr>
      <th class="check-column" scope="row"><input type='checkbox' name='purchlogids[]' class='editcheckbox' value='<?php echo wpsc_the_purch_item_id(); ?>' /></th>
      <td><?php echo wpsc_the_purch_item_id(); ?></td><!-- purchase ID -->
      <td><?php echo wpsc_the_purch_item_date(); ?></td> <!--Date -->
      <td><?php echo wpsc_the_purch_item_name(); ?></td> <!--Name/email -->

After the Name/email <td> is where we will put our new column data.

First, we have to calculate the price without shipping. Do that like this-

      <?php

       $purch_item_price = wpsc_the_purch_item_price();

      $price_wo_shipping = $purch_item_price - (float)preg_replace('/[^0-9.]/', '', wpsc_display_purchlog_shipping());

      ?>

Then you can add the table cell to display it-

<td><?php echo wpsc_currency_display( $price_wo_shipping ); ?></td><!-- Price w/o shipping -->

Then add the next custom column-

<td><?php echo wpsc_display_purchlog_shipping(); ?></td><!-- Shipping -->

And finally update the amount column- (you have to do this one because calling wpsc_the_purch_item_price() multiple times will add to your total. Which is not good.)

<td><?php echo wpsc_currency_display( $purch_item_price ); ?></td><!-- Amount -->

And we’re done! Nice and simple and now you/your clients can have a more informative first view of their sales.

Digital creative desk space in Birmingham

Posted by on Oct 5, 2011 in blog, Uncategorized | 0 comments

I have the opportunity to start a new space where creatives can have a permanent base whilst having the opportunity to work with other like minded people. I’d like to tell you about it and see if you might be interested!

When I went fulltime freelance I really struggled to find an affordable space to base myself that wasn’t an office in a big corporate building and working at home wasn’t practical with two small children. So I’ve been thinking of starting something that people like me may be interested in and the opportunity to do it has come about!

The space is in Fazeley Studios (fazeleystudios.com) which currently is home to loads of creative industries including web design, graphic design, film, web development and animation. The studios are beautifully decorated (take a look at the website to see!) and there is a great cafe/bar on site as well as a wonderful courtyard to relax in. There is 24 hour access so nightowls are welcome and I would be more than happy to have dogs join their owners in the space!

I would like to create a space where freelancers and small business owners can have a permanent base to work from whilst being involved with the others around them. I don’t want it to be a fractured, separate working environment where no one talks to each other but a place where people feel free to call on the expertise of others around them and maybe even group together to pitch for jobs they couldn’t ordinarily get on their own. It will be a relaxed place where everyone has a say in what happens and how we manage the space. For example everyone is free to suggest how to decorate the space and we could organise monthly breakfasts or film nights.

It would be great to create an environment where everyone helps each other. So if one person lacks graphic design skills, for example, they can call on one of the graphic designers in the hub rather than outsourcing overseas or to larger companies. It’s not about putting large companies out of business but helping out smaller ventures and encouraging other like minded people.

It would also be great (although it’s just a thought at the moment) to be able to advertise the hub’s combined skills as a single entity. This may mean that the hub as a whole can be contracted for work in which everyone takes part and shares in the profits. It would of course depend on the people involved in the space and their various skill sets but it’s a nice thought.

If nothing else it will be a place where people can come to work. I reckon my productivity increased ten fold when I moved to a dedicated working space. It also meant that when I went home I was home and with the family rather than working all hours of the day and night.

Cost wise I’m still trying to work that out! It will depend on what price I can haggle the space down to but it’s probably going to be between £150 – £200 per desk per month. Each desk will include a desk, a chair and mega fast internet. Theres also the option for a dedicated phone line if people need it. To get this off the ground I need at least 4 other people to be up for it and the room will probably hold about 11 total. So a nice number where we can all know each other!

When it starts will depend on how quickly people respond but all being well it could start at the beginning of Novemer.

If you are interested but would like some more info please email me at andycharrington@gmail.com and ask away! I will try to answer all your questions.

If you would absolutely like to join me, brilliant! Please send me an email at andycharrington@gmail.com telling me what you do and when you would like to move in!

If you have any thoughts, feedback or suggestions I would love to hear them. Please drop me a line at andycharrington@gmail.com.

Finally if you think you may know of someone who would be interested please please please forward this to them!

Thanks for reading and I hope to hear from you soon.

New version of WordPress Gallery

Posted by on Oct 3, 2011 in blog, WordPress, WordPress 3.0, WordPress Development, WordPress Plugins | 0 comments

Version 0.6 of WordPress Gallery is now available!

20111003-083413.jpg

It’s always nice to see my plugin on the front page of WordPress plugins. Even if it is only in the recently updated section!

Two massive new features have been introduced in the latest version-

Links per images.
You can now specify a link for each image to link to on click. Great for people using the gallery as a featured content slider. Only thing to watch here is that you don’t have the lightbox option switched on. If you do, the lightbox will take precedence.

Drag and drop order.
Now you can order the images by simply dragging them in to the order you would like in the admin page. Go to Gallery then simply drag ad drop your images!

Please let me know of any bugs or feedback!

Have fun!

Is WordPress good enough for my site?

Posted by on Aug 3, 2011 in blog, WordPress, WordPress 3.0, WordPress Development, WordPress Plugins, WordPress Themes | 1 comment

Quite often I have people asking whether or not WordPress can handle their large site. They have very genuine concerns that WordPress can not handle things like scaling and caching and large visitor loads.

Whether you are performing due diligence or just wondering what WordPress can do, the below should be quite useful to you.

Its always best to lead by example right! So here we go!

A whole bunch of sites with massive user bases use WordPress. Here are a few-

http://tutsplus.com/ – A HUUUGE site with thousands of articles, media and users. Alexa rank 591

http://freelanceswitch.com/ – I use this site a lot! Both the site and the jobs board are powered by WordPress. Alexa rank 5,813

http://mac.appstorm.net/ – Another site with a huge following. Alexa rank 5,856

http://wiki.envato.com/ – The wiki for the ginormous envato market place. Alexa rank 4,101

http://workawesome.com/ – A blog but a large blog nonetheless. Alexa rank 31, 945

http://blog.themeforest.net/ – The blog for themeforest, possibly the largest template site on the net. A huge following. Alexa rank 287

With large sites caching is very important. Querying the database as few times as possible and only doing so when cached content is not available is crutial for a large site. Serving users static html rather than server intensive php powered by goodness knows how many DB queries saves a tonne in terms of server resources and site responsiveness. WordPress already has numerous plugins for this. The best two are WP Super Cache and W3 Total Cache.

http://codex.wordpress.org/High_Traffic_Tips_For_WordPress is a really good read straight from the WordPress mouth about the capabilities of WordPress. For me, the overriding message from that page is that it is more about the hardware behind the site than the software serving the site.

37 signals (the makers of Basecamp and other very successful web apps) wrote this very honest and wise piece.

http://gettingreal.37signals.com/ch04_Scale_Later.php

Basecamp is probably the most successful online project management tool out there and they openly admit that precious time is lost worrying about problems that may never occur. And when they do occur it is optimal to fix them and tweak the set up as they happen.

As they say -

In the beginning, make building a solid core product your priority instead of obsessing over scalability and server farms. Create a great app and then worry about what to do once it’s wildly successful. Otherwise you may waste energy, time, and money fixating on something that never even happens.

Another brilliantly honest article from the same guys-

http://37signals.com/svn/archives2/dont_scale_99999_uptime_is_for_walmart.php

Edublogs is one of the most successful education based blogging platforms and they use WordPress MU (multi-user). Here is an in depth (and quite geeky) article on the set up of that system.

http://wpmu.org/scaling-wordpress-wpmu-buddypress-like-edublogs/

Matt Mullenweg, the founder of WordPress made an interesting response to somebody moving their site to drupal from WordPress after getting to 200,000 hits per day. He offers some sound advice-

http://webdevnews.net/2008/12/mullenweg-scale-wordpress-to-20000000-views-per-day-for-100-pmonth/

“Barry” is the “Chief Systems Wrangler” at automattic (the people behind wordpress, askimet, vaultpress and IntenseDebate) and he wrote this article about hyperDB -

http://barry.wordpress.com/2011/07/20/hyperdb-lag-detection/

Essentially what he is saying is that using hyperDB (found here http://wordpress.org/extend/plugins/hyperdb/) enables huge sites to effectively and sparingly use DB queries to further optimise a high traffic volume and user interaction site. Read more from “Barry” on scaling here http://barry.wordpress.com/category/scaling/

The only other thing I will add is that words like “blog”, “theme” and “plugin” are used a lot with WordPress. Do not be put off by them! WordPress started out life as a blogging platform and it has struggled to shift that association. In truth, WordPress is actually an extremely powerful Content Management System with a highly intuitive and extensive API. Plugins are essentially little (or large) packages that add extra functionality to a WordPress install. Themes define the look of your site. They contain all the client side code and it is in themes that a design of a site is held.

Hana FLV Extension

Posted by on Jul 14, 2011 in blog, Jealous Designs WordPress Plugins | 1 comment

This plugin extends the capabilities of the Hana FLV Player plugin.

It allows users to upload their FLV files directly through the Tiny MCE button rather than having to copy and paste a URL.

It also adds a new meta box to posts and pages which allows the user to save the same data but as post meta. This can then be called from within a theme from a simple function.

 

You must have the Hana FLV Player plugin installed and activated for this plugin to work.
Download now or visit Hana FLV Extension on wordpress.org. Total downloads: 1,587.
 

Tags: extension, flv, hana, hana flv, integration, media library, upload

WordPress Gallery

Posted by on Jul 14, 2011 in blog, Jealous Designs WordPress Plugins | 42 comments

WordPress gallery provides a simple interface for uploading images, editing them and having them displayed on the front end of your site via a shortcode or a function call.

The front end gallery can be configured in the following ways-

  • Height and width of your gallery.
  • Transition effect.
  • Transition time.
  • Optional lightbox effect to original image.
  • Choose whether or not to display a "pager" which can contain nothing (just empty squares), numbers or thumbnails. Thumbnail sizes are configurable.
  • Order the images by dragging them.

Uploading images is done through a simple interface that allows you to upload multiple images at once (only limited by your server's execution time and maximum file size). You can then edit the image to adjust crop, scale and rotation. Any changes you make to an image can be easily reverted back to the original image at any time.

If you have an Amazon S3 account your images will be uploaded there saving bandwidth and storage costs.

Download now or visit WordPress Gallery on wordpress.org. Total downloads: 16,029.

Tags: amazon, galleries, gallery, image, jquery, s3, slideshow

WP E-commerce – Image previews to change on hover

Posted by on Jun 6, 2011 in blog, getshopped, hack, javascript, jquery, WordPress 3.0, WordPress Development, WordPress Plugins, wp e-commerce | 0 comments

Hi All,

Another fix ive had to implement whilst working with WP E-Commerce. This time to add functionality so that when thumbnails (from gold cart gallery) are hovered over, the main image preview changes. This also will update the main preview image so that when clicked the correct large image pops up.

You must add this code AFTER the thumbnails have been generated. For me that was at the very bottom of wpsc-single_product.php after

</div><!--close single_product_page_container-->

Here’s the code to add-

<script> jQuery(".attachment-gold-thumbnails").each(function () { jQuery(this).css("cursor", "pointer"); var large_preview = jQuery(this).parent().attr("rev"); var even_larger_preview = jQuery(this).parent().attr("href"); var preview_title = jQuery(this).parent().attr("rel"); jQuery(this).hover( jQuery(this).mouseover(function() { jQuery(".product_image").attr("src", large_preview); jQuery(".product_image").parent().attr("href", even_larger_preview); jQuery(".product_image").parent().attr("rel", preview_title); }) ); }); </script>

It also takes the magnifying glass cursor off the thumbnails and replaces it with pointer. You can change it to whatever you like really.

NB: I have only tested this with the thickbox image pop up script within WPEC. This is due to it being the only one that works natively within the plugin for me…

:-)

WP E-commerce Category list order and more control…

Posted by on Jun 5, 2011 in blog, getshopped, hack, php, WordPress Development, WordPress Plugins, wp e-commerce | 3 comments

So ive been trying to use wpsc functions to control my widget of category listings… not fun. i have very little control over the listings without editing the core files which is something i would rather not do.

There are a number of supposed solutions out there but with the recent change to use wordpress tables rather than wpsc custom tables, at lot of those fixes no longer work.

So my solution has been to just use the already existing WordPress function “wp_list_categories”.

Like this

<?php
 $args = array('taxonomy' => 'wpsc_product_category', 'orderby' => 'ID', 'order' => 'ASC', 'style' => 'none', 'child_of' => 15);
 wp_list_categories( $args );
 ?>

Just put that in your sidebar or wherever else you want to display categories. Forget the widget for category listings, it doesnt allow you enough control. Using the above code will allow you to have control over the following (from http://codex.wordpress.org/Template_Tags/wp_list_categories)

<?php $args = array(
 'show_option_all'    => ,
 'orderby'            => 'name',
 'order'              => 'ASC',
 'show_last_update'   => 0,
 'style'              => 'list',
 'show_count'         => 0,
 'hide_empty'         => 1,
 'use_desc_for_title' => 1,
 'child_of'           => 0,
 'feed'               => ,
 'feed_type'          => ,
 'feed_image'         => ,
 'exclude'            => ,
 'exclude_tree'       => ,
 'include'            => ,
 'hierarchical'       => true,
 'title_li'           => __( 'Categories' ),
 'show_option_none'   => __('No categories'),
 'number'             => NULL,
 'echo'               => 1,
 'depth'              => 0,
 'current_category'   => 0,
 'pad_counts'         => 0,
 'taxonomy'           => 'category',
 'walker'             => 'Walker_Category' ); ?>

I was using three category widgets but now am simply using this in my sidebar-

<h2>SHOP BY AGE</h2>    

 <?php
 $args = array('taxonomy' => 'wpsc_product_category', 'orderby' => 'ID', 'order' => 'ASC', 'style' => 'none', 'child_of' => 15);
 wp_list_categories( $args );
 ?>    

 <h2>SHOP BY ARTIST</h2>    

 <?php
 $args = array('taxonomy' => 'wpsc_product_category', 'orderby' => 'ID', 'order' => 'ASC', 'style' => 'none', 'child_of' => 8);
 wp_list_categories( $args );
 ?>    

 <h2>SHOP BY TYPE</h2>    

 <?php
 $args = array('taxonomy' => 'wpsc_product_category', 'orderby' => 'ID', 'order' => 'ASC', 'style' => 'none', 'child_of' => 11);
 wp_list_categories( $args );
 ?>

Much simpler and allows me absolute control over the order, appearance, depth and exclusions etc.

Its sad the this plugin doesnt have native support for this. maybe because its not needed when we can just use the WordPress functions?…

Add related products to wp e-commerce (getshopped) store

Posted by on Jun 5, 2011 in blog, getshopped, hack, php, WordPress 3.0, WordPress Development, WordPress Plugins, wp e-commerce | 13 comments

Here is a nice and simple way to enable related products on a single product page when using wp e-commerce. There’s only four steps!

Step one: Download the “Related Posts” plugin from http://www.microkid.net/wordpress/related-posts/ and install it.

Step two: Set up the plugin and familiarise yourself with the admin panel. Here is a great place to start.

Step three: Insert the following where you want your related products to display (for me this is in the imported wpsc-single_product.php file in my theme folder)-

MRP_show_related_posts()

Step four: Change line 450 in microkids-related-posts.php (now in your wp-content/plugins/microkids-related-posts folder)

FROM

$output .= "<li><a href="".get_permalink( $related_post->ID )."">".$related_post->post_title."</a></li>n";

TO

$output .= "<li><a href="".get_permalink( $related_post->ID ).""><img src="".wpsc_the_product_thumbnail(get_option('product_image_width'),get_option('product_image_height'),$related_post->ID,'single')."" ><br>".$related_post->post_title."</a></li>n";

And you’re done.
:-)