Year: 2017

WooCommerce: Use Product Images as Category Images

Update: Version 1.3.1 released on the 25th August 2020.

So, earlier this morning I found myself wishing that WooCommerce had the capability to use a product thumbnail when displaying a category link in situations where the category doesn’t have its own thumbnail defined.

I went on a bit of a hunt and found a couple of small plugins. One didn’t work at all, which I attribute mainly to it having not been updated for two years and much changing in both WordPress and WooCommerce since then, and another one that I found didn’t work until I made a couple of code changes – and had a couple of noteworthy problems;

  • it would only fetch product thumbnails from that immediate category – not delving deeper down into the category tree and fetch product thumbnails from child categories, and
  • it did no filtering for products that had no thumbnails set, so would in some cases return products that had no thumbnail

So, I’ve made my own. A zip download can be found below, you just need to drop the folder inside it into your wp-content/plugins folder and then activate the “WooCommerce Category Product Thumbnails” plugin.

I’m using WordPress 4.9.4 and WooCommerce 3.3.0 – please let me know in the comments if it doesn’t work on other versions.

Update version 1.1 –  23rd March 2018: Add option (found under WooCommerce -> Settings -> Products -> Auto Category Thumbnails) to change the image size used for the automatic thumbnails. By default it remains as “shop_thumbnail”, but you may find that “shop_catalog” is a better choice.

Download

Download the plugin from the WordPress Plugin Repository

Source

This plugin is open-source – view the source code on the GitHub repository.

Security isn’t a dirty word, Blackadder

I’m often surprised at just how some websites treat their users when it comes to security.

As any decent website developer knows, one of the basic tenets of application security is that you should never store a user’s password in an unencrypted format – and you shouldn’t really be storing a password in an encrypted format, either. The correct way to deal with storing a password is to use a password hashing algorithm (note: “password hashing”, not just “hashing”)

I’m not going to pretend that I’m perfect at this. It took me an embarrassingly long time to stop using MD5 for hashing passwords in my code (although, in my defence, it was at least salted and not just a straight hash) but I caught up with the zeitgeist and all’s well again. Of course, it seems these days I do most of my work with existing frameworks and applications, so don’t really have to worry too much about that kind of thing any more.

The fact that there are so many frameworks and other tools out there to help devs with this kind of thing just makes it all the more upsetting when I see someone doing it so drastically wrong. Someone like whoever it was that developed KidsPass.co.uk

For those unfamiliar, Kids Pass is a website aimed at parents that offers many discounts and other offers on things to do with their little’uns. It’s not a website aimed at children, which is just as well because with password security as poor as theirs that would be absolutely terrifying.

Alien: Covenant – Movie Review

WARNING: Contains minor spoilers.

Those who know me will know that the Alien franchise is, hands-down, my favourite series of movies of all time. I am too young to have actually seen any of the “original” four at the cinema (when they were released, at least) but I have since seen Alien (the Director’s Cut) on the big screen, Prometheus and now Ridley Scott’s new release, Alien: Covenant. I don’t really count the AvP movies as part of the franchise, although I did go and see them when they were released.

It occurred to me as I was planning this review out, that I haven’t actually written any sort of review or retrospective on the other movies in the franchise, which I really must do – but first, a review of Covenant.

Into the thick – the Black Country Living Museum

A week ago, Jem and I took the kids on a semi-planned day trip out to the Black Country Living Museum in Dudley.

A Shop of Miscellany at the Museum

I’d not been before, but the name made it sound like it would be right up my street, being a little bit like Blists Hill Victorian Town in Coalport, which is just down the road from us and (from what I remember) is a cracking museum for kids and adults alike.

On arrival, we met up with a couple of friends and made our way into the entrance.

Guardians Of The Galaxy Vol. 2 – Movie Review

WARNING: Contains spoilers.

The first Guardians Of The Galaxy movie (from hereon referred to as GotG) was a smash hit for Marvel Studios when it came out in 2014, raking in over $750 million at the box office. It was considered a refreshing change from previous Marvel movies, with more humour and, crucially, a setting that did not involve Earth.

Privacy Policy & Powered by WordPress & Theme by Anders Norén