Add Geolocation to your Liquid Theme

Here’s something to help you customize your Spiffy Store’s Liquid Theme for your overseas customers.

We have added some new Liquid Theme variables that will give you access to the geolocation data for your customer. This will give you access to the Country, Country Code, City and Timezone information for the customer, based on the IP address being used.

Continue reading

Get Order Notifications when you’re on the move

With more and more people on the move and accessing their Spiffy Stores Toolbox from mobile devices, we’ve added a quick and simple way for you to get timely updates when your online store gets new orders.

Browse to your “Overview of your orders” page in your Spiffy Store Toolbox and you’ll now see an additional entry in the sidebar which includes a data feed link to all your most recent orders.

The new data feed link is encrypted and password protected so you can be sure that your online stores’ customers’ data is safe and secure.

There is more information available on this new feature in our Knowledge Base at https://www.spiffystores.com.au/kb/Recent_Orders_Data_Feed.

You can use this link on your mobile device to find out when new orders have been placed in your online store rather than having to monitor your email for the email notifications you normally receive.

Spammers Begone

We recently enabled a small security enhancement to the Spiffy Stores software to prevent a security attack called Cross Site Request Forgery (CSRF).

Basically, now an encrypted token is generated and inserted into every form on the store web pages. This prevents a hacker from copying a form from the site and tricking you into executing the form from a fake site, thus giving the hacker access to your account.

Whilst it was extremely unlikely that this sort of attack would work because of the way in which the Spiffy Stores software is designed, it never hurts to improve security wherever possible.

However, it turns out to have an unintended bonus effect!

Spiffy Stores is one of the few ecommerce solutions that has a “Contact Us” form built into your store. This form is generated for you automatically and you don’t need to use a third-party online form service to get something as essential as a contact form.

Now that we have added the Cross Site Request Forgery code, we are seeing instances of spammers who have “copied” the contact forms from various sites and have built them into scripts to try to spam our store owners with fake contact form submissions. All of these attempts are now failing because they are all detected as forgeries, and this means that your inbox will contain less of the spam generated by these pests.

Structuring Information for Search Engine Snippets

Here’s a quick update.

We’ve added a small improvement to our Theme support by defining a new header variable which can be used in the Theme.liquid file as part of the section.

Rather than hand-coding author, copyright, description and keywords meta tags, you can just code

[ruby]
{{ header.author }}
{{ header.copyright }}
{{ header.description }}
{{ header.keywords }}
[/ruby]

These variables will automatically generate the appropriate meta tags for your page’s content.

The advantage of these automatically generated tags is that they structure the description information in a way that makes it easy for the search engines to extract the relevant information about your product or page and this will appear as the snippet in the search results.

For details have a look at our Knowledge Base documentation

Liquid Template Variables – header

Multisets and Bags in Ruby

I’ve been looking around for an implementation of a Multiset/Bag in Ruby to ease the pain of recording some of our statistics.

Some of the statistics we gather are most usefully stored as some form of “super” Set in which each unique element is stored together with a count of the number of times that element has occurred. These statistics are likely to have a large number of repeated elements, so this makes sense as it saves on space and processing.

So, after an extensive search, I was surprised at the paucity of solutions for this problem.

Eventually I hit upon

http://maraigue.hhiro.net/multiset/index-en.php

It does exactly what I want, but I decided that I would add the following custom functions. These two functions return all the items in a Multiset with the highest/lowest counts.

class Multiset
  # Return all the items with the maximum count
  def max_values
    max_value = @items.values.max
    @items.select { |k, v| v == max_value }.map { |i| i[0] }
  end

  # Return all the items with the minimum count
  def min_values
    min_value = @items.values.min
    @items.select { |k, v| v == min_value }.map { |i| i[0] }
  end
end

How to Fake an Uploaded File

Our store software contains an extensive set of routines for processing uploaded images and resizing them into various image sizes. We’ve recently been adding some code to support a bulk import function and it’s become necessary to somehow fake uploading a file, given a specific URL for an image.

The basic plan is to use Net::HTTP to connect to the remote server and grab the image and save it in a temporary file. It turns out that Rails contains a UploadedTempfile class which is a subclass of Tempfile, and this is used by the CGI routines to handle any uploaded files.

Continue reading