Category: Briefs

  • Confirm WooCommerce Subscriptions Cancellation

    Confirm WooCommerce Subscriptions Cancellation

    We recently witnessed some issues occurring when customers using WooCommerce and Subscriptions deleted their payment methods (when they have a credit card “on file”). When they also have active subscriptions using the card they just deleted, most customers don’t realize that they also have to update their card for each of the active subscriptions.

    We’ve added a more robust way of dealing with this to the Subscriptions roadmap, but in order to stem the bleeding from the immediate issue, I whipped together a mini-plugin that will pop up an alert whenever a customer deletes a payment method.

    The plugin can be downloaded for free here: https://github.com/Prospress/woocommerce-subscriptions-delete-payment-method-confirmation

  • Taylor Land Services

    Taylor Land Services

    There’s still a place for commercial themes.

    An old acquaintance called up asking for help: he was rebranding his family business with an emphasis on heavy machinery and he wanted help with a website and logo. I said sure, as long as he wouldn’t mind using a pre-made theme.

    It had been so long since I had tried to quickly throw together a website that I had forgotten how amazing it is to be able to purchase a decent commercial theme and deploy a site so quickly. We pulled a heavy-machinery-looking font and color scheme and had a site up on super short notice. Fun, so fun.

     

    screenshot-taylorlandservices org 2016-05-20 11-13-58


    Link to Site

  • Weather Dashboard

    Weather Dashboard

    Last year, we installed a wi-fi enabled weather station on our property: the Rainwise MK-III-LR. Every few seconds, it sends updated weather data to the cloud. We chose to route the data to Wunderground, allowing it to be a peer among many personal weather stations in the area, which also opens up the data to the public.

    It turns out that the Wunderground API is pretty robust, and I was considering writing a WordPress plugin that would allow you to specify any weather station and have the information display on your site. Unfortunately, the API limits each user to a fairly small amount of monthly calls, unless you want to pay real, cash money. Therefore, to use the plugin, you’d have to sign up for a developer account on Wundergound and use your own API token, which might be a bit above the average blogger’s desire.

    Until I find a better solution, I’ll post the code here that I used to display my personal weather data on the farm website.

    First, here’s the display on the front end:

    Screen Shot 2016-05-19 at 12.31.07 PM

     

    To generate the view on the front end, first I added some HTML.

    <h4>Weather as reported by wx station KINRICHM9</h4>
    <span id="time_since_observed"></span><span id="offset"></span>
    <table class="table table-striped wx">
        <caption><h5>Current Conditions</h5></caption>
        <tr><td>Temp:</td><td><span id="current_temp"></span></td></tr>
        <tr><td>Dewpoint:</td><td><span id="dewpoint"></span></td></tr>
        <tr><td>Relative Humidity:</td><td><span id="humidity"></span></td></tr>
        <tr><td>Wind Speed:</td><td><span id="wind_speed"></span></td></tr>
        <tr><td>Wind Direction:</td><td><span id="wind_direction"></span></td></tr>
        <tr><td>Barometric Pressure:</td><td><span id="baro"></span></td></tr>
        <tr><td>Pressure Trend:</td><td><span id="baro_trend"></span></td></tr>
     </table>

     

    Then, we need to make the call to the API with JavaScript.

    <script>
     jQuery(document).ready(function($) {
       $.ajax({
       url : "http://api.wunderground.com/api/REPLACE_WITH_YOUR_API_TOKEN/geolookup/conditions/q/pws:KINRICHM9.json",
       dataType : "jsonp",
       success : function(parsed_json) {
        var time = parsed_json['current_observation']['observation_time'];
        var time_offset = parsed_json['current_observation']['local_tz_offset'];
        var temp_f = parsed_json['current_observation']['temp_f'];
        var temp_c = parsed_json['current_observation']['temp_c'];
        var hum = parsed_json['current_observation']['relative_humidity'];
        var dewpoint = parsed_json['current_observation']['dewpoint_string'];
        var wind_speed = parsed_json['current_observation']['wind_mph'];
        var wind_knots = Math.round((wind_speed / 1.16) * 10) / 10;
        var wind_degrees = parsed_json['current_observation']['wind_degrees'];
        var baro = parsed_json['current_observation']['pressure_in'];
        var baro_trend = parsed_json['current_observation']['pressure_trend'];
        var baro_trend_text = "Can't calculate (I broke my abacus)";
        if (baro_trend == "+") { baro_trend_text = "Going up, yay!"};
        if (baro_trend == "-") { baro_trend_text = "Going down&hellip;"};
    
       $( "#time_since_observed" ).replaceWith(time);
       $( "#offset" ).replaceWith("(UTC " + time_offset + ")");
       $( "#current_temp" ).replaceWith(temp_f + " F (" + temp_c + " C)");
       $( "#humidity" ).replaceWith(hum);
       $( "#dewpoint" ).replaceWith(dewpoint);
       $( "#wind_speed" ).replaceWith(wind_speed + " MPH (" + wind_knots + " knots)");
       $( "#wind_direction" ).replaceWith("From " + wind_degrees + "&#176; true");
       $( "#baro" ).replaceWith(baro + " inHg");
       $( "#baro_trend" ).replaceWith(baro_trend_text);
    
      }
     });
    });
    </script>

    It should be noted that this only updates on page refresh, and is really just a test to see if the API would access our weather data.


    Link to website

  • Hunting Check-In

    Hunting Check-In

    Sometimes, a simple solution is all that is needed for a simple problem. As is common for developers and programmers of all varieties, I can’t help but enjoy finding a clever solution to a particular problem, but that pales in comparison to the joy that I obtain from coming up with a dead simple, smack-you-in-the-forehead answer. I call that being smart, not clever.

    The farm property that I live on had an issue with multiple people wanting to use the land during hunting season, and no communication about who needs what area. Because two of the people were hunting, no other people could use the same area at the same time.

    First, we tried a whiteboard, but nobody used it. So I created the electronic equivalent of a whiteboard, and it was wildly successful. I made a simple form with large, glove-friendly buttons (think hunter at 6am using his iPhone in an Otter Box), and a simple list showing who went where at what time. It would then be up to each person to see where the other(s) had gone and avoid their area.

    It didn’t require a feat of programming. It didn’t require astounding design. It wasn’t an interactive map that required GPS permissions. It simply matched the problem at its level of simplicity, and therefore succeeded. It just required me putting my “clever” ego aside and letting the simple solution work.

    Screen Shot 2016-05-19 at 08.36.40 AM

    Screen Shot 2016-05-19 at 08.37.11 AM

    Screen Shot 2016-05-19 at 08.37.30 AM


    Link to Page