Categories
Code Shopp Web

Upgrading Shopp 1.1.9 to 1.2.3

Shopp 1.2 has been with us for some time now, but prior to 1.2.2 there were problems with upgrading from 1.1.x. Now though, upgrading to 1.2.3 (the current version as of August 2012) from 1.1.9 is incredibly simple. Before proceeding, I recommend reading the documentation for upgrading to Shopp 1.2 and the template changes in 1.2.

The best way to proceed with an upgrade like this is to create a new sub-domain on your server where you can try the upgrade without making changes to your live site. Copy your site files to the new sub-domain, and copy the WordPress database to a new database. Once that’s done, you’ll need to update wp_config.php on the new domain to point to the new database, and also update the ‘siteurl’ line in wp_options to point to the new sub-domain. Once that’s done, you can proceed.

Backup Your Database

This is essential before doing any upgrade in WordPress, but many of us omit this step. I’ll admit, I’m guilty of this from time to time as well. We sort of expect that when we upgrade, everything will work fine, and backing up can be a pain. There are a number of plugins that will back up your database for you, but I prefer to go into phpMyAdmin to export the whole database. Once that’s done, we can move on.

Backup Your Files

You shouldn’t need to backup the entire site, as we’ll only be upgrading the Shopp folder, so you can get along just fine by downloading a copy of your wp-content folder. If you haven’t got a backup copy of your entire site in some time, this is a good time to do so.

Note Your Settings and Addons

When you upgrade Shopp, most of your settings are carried over properly. However, in the event that they’re not, it’s a good idea to have a copy of your settings on paper just in case. Go through the Settings page and make notes of your settings and set that aside. Also, if you use shipping or payment addons, make notes of your settings there as well. I discovered that when I upgraded to 1.2.3, Authorize.net forgot which credit cards it had been set to accept.

Get Fresh Downloads

Go to your Shopp account page and download the latest copy of Shopp core, and any addons that you’ll be using on the site.

Now, you’re ready to proceed with the upgrade. Cross your fingers, and here we go.

Maintenance Mode

If you *have* to upgrade on your live site (I mentioned that this is a bad idea, right?) then find a maintenance mode plugin and enable it before proceeding. This way, visitors to your site won’t get unfriendly error messages while upgrading.

Update Shopp Folder

Disable the Shopp plugin from within WordPress. I like to preserve the old Shopp folder, so move it to the parent folder (wp-content), then upload the new Shopp files. Once it’s done, upload the shipping any payment addons to the appropriate folders. When that’s all done, enable the Shopp plugin again.

Update Menus

One of the biggest changes in 1.2 is that Shopp no longer requires Pages to work. It uses “virtual” pages which are loaded from the new template files, and the page slugs are set from within the Shopp settings. Any menu references to the old Shop, Cart, Account, and Checkout pages will not work, and you’ll find these pages in the Trash. You’ll need to replace them with Custom Links.

Update Theme Template Files

Because Shopp is no longer using Pages, you can no longer choose a Template for those pages, or choose a layout option (available on some theme frameworks). This means you’ll likely need to create some new templates, or update your existing templates. The changes required generally differ depending on which theme or framework you’re using, but you’d be served to update your Theme to the latest version available. I’ll cover more specific changes in another article (to come later).

At this point, you should be done. Check thru your site to make sure there aren’t any major problems.

OMG THINGS ARE BROKEN!

If you’ve arrived at this point, then it’s a good thing you did the upgrade on a test site and not your live site, right? There are a slew of issues I’ve seen people have, and each one is a different animal, but the best thing to do is try narrowing the problem down as much as possible. My advice is to contact the Shopp Help Desk and let them help you out.

Categories
Code Shopp Web

New Shopp plugin: Minimum Order Amounts

For the multitude of people who have asked in the forums “How do I set a minimum order amount in Shopp?” My new plugin is the answer. Interested? Check out the plugin page here, or get it from the WordPress plugin directory.

It’s pretty straightforward and simple (at this point) with only two configuration options. I’ve got a list of improvements that I’d like to make in the future, but I’ll be working on them as I have time.

Categories
Code Shopp Web Work

Changing Credit Card Expiration Date Fields in Shopp

The question was asked in the Shopp Community Forums about how to change the Credit Card expiration date fields from input boxes to drop down menus. The default Shopp template has them set as text boxes, which works fine, but we can improve on this and make it easier to use.

Credit card expiration date text boxes

If you’re using Shopp’s theme templates, you’ll want to edit checkout.php. Look for the following code near the bottom of the file:

<span><?php shopp('checkout','billing-cardexpires-mm','size=4&required=true&minlength=2&maxlength=2&title=Card\'s 2-digit expiration month'); ?> <label for="billing-cardexpires-mm">MM</label></span>
/<span><?php shopp('checkout','billing-cardexpires-yy','size=4&required=true&minlength=2&maxlength=2&title=Card\'s 2-digit expiration year'); ?><label for="billing-cardexpires-yy">YY</label></span>

Change it to the following:

<span> 
  <select id="billing-cardexpires-mm" class="required paycard" title="Card's 2-digit expiration month" name="billing[cardexpires-mm]">
    <option>01</option> 
    <option>02</option> 
    <option>03</option> 
    <option>04</option> 
    <option>05</option> 
    <option>06</option> 
    <option>07</option> 
    <option>08</option> 
    <option>09</option> 
    <option>10</option> 
    <option>11</option> 
    <option>12</option> 
  </select>
  /<label for="billing-cardexpires-mm">Month</label>
</span>
<span>
  <select id="billing-cardexpires-yy" class="required pay card" title="Card's 2-digit expiration year" name="billing[cardexpires-yy]">
<?php 
$thisyear = date("y"); 
for($x=0;$x<10;$x++){ echo '<option>'.($thisyear + $x).'</option>\n'; } ?> </select>
<label for="billing-cardexpires-yy">Year</label></span>

Now you should have a couple of nice drop down select menus, which are a little more user friendly because they eliminate the chance of a user putting in the wrong information. The new code will also display the current year and the next 10 years, which means you won’t need to change the menu code every year.

Credit card expiration date fields drop down menus