Switched On Tech Design

  • WooCommerce Variable Products all showing out of stock: Sorry, this product is unavailable. Please choose a different combination.

    I must have spent hours today trying to fix a problem with Woocommerce – no matter which way I set up a variable product it always showed as out of stock no matter which combination of options I selected. The error message was:   Sorry, this product is unavailable. Please choose a different combination.   Very…

  • How do you check website links and jpgs etc. recursively?

    LinkChecker is a great way of doing this;   http://wummel.github.io/linkchecker/   Other people’s sites may have robots.txt files that prevent you from using this tool on their sites but it’s darn handy for pulling up broken links on your own sites. This is a valid alternative to the Integrity tool on Mac if you’re comfortable…

  • Importing a MySQL database with a new name where the original still exists

    So you want to export your MySQL database then import it on the same server with a new name.   I tried this several times and using the SOURCE command inside MySQL or just mysql -p < db.sql both resulted in the database re-importing over the original name.   To fix that run: sed -i…

  • PHP contact form returns 504 gateway error after moving to Digital Ocean

    This one had me scratching my head for a while – using php7.0-fpm and the latest nginx on Debian 8 Jessie I was seeing our PHP contact form working correctly but returning a Gateway 504 error upon submission, which was resulting in a great deal of resubmitted forms and error notifications from users.   This…

  • How to pass through a USB device to a Windows Virtualbox VM

    How to pass through a USB device to a Windows Virtualbox VM

    Running a Mac with Windows running in a Virtualbox virtual machine? Here’s how to pass through a USB device so that whenever the VM (Virtual Machine) is running and the USB device is plugged into a USB port it appears in the Windows VM and not in Mac OS X. Open up Virtualbox and make…

  • Owncloud Nine: How to reset the admin password

    Well, about ten minutes after installing the new Owncloud Nine we found out that we had typo’d the admin password. Fortunately, it’s an easy fix. Run the following (this worked on Debian with a fresh Owncloud 9 install):   cd /path/to/owncloud sudo -u webserveruser php occ user:resetpassword adminaccountname   In our case the command was:…

  • Adding products to Woocommerce

    First, log into your website at:   yourwebsiteurl.com/wp-admin/   Enter your username and password and you should be directed to your WordPress dashboard.   First, we’ll upload some images to go with the products you’re adding today. On the left you will see Media:   Hover over it and you should see “Library” and “Add…

  • Checking whether nginx cache is working

    Just set up nginx caching and wondering whether it’s working properly? You can check it pretty easily:   curl -I URL.goes.here That should return a bunch of information, but the important bit is: X-Proxy-Cache: MISS   Well, in this case it’s not working. If it’s working you’ll see a HIT there.

  • Drupal 8: Configure block or Place Block do nothing

    In short, clicking on “Place Block” results in a brief loading icon and then nothing, and Configure Block results in a “This website encountered an unexpected error” message. The fix was found here:   https://www.drupal.org/node/2597506   Edit the following file – the “core” directory should be in your Drupal 8 root directory:   [drupal root]/core/lib/Drupal/Core/Annotation/Translation.php…

  • Drupal 8 – How to enable multi image upload

    One of the great things about Drupal 8 is that it has multi-image uploading capabilities built-in, unlike Drupal 7. By default, however, it’s a single image at a time.   To enable multiple image upload for articles, for example, navigate to:   siteurl/admin/structure/types/manage/article/fields   Click “edit” next to the Image field type, and you’re taken…