October 24th, 2017

Fresco is a very nice, responsive lightbox that I just came across embedded in a WordPress theme. It’s very easy to use in the simple scenario – just add a couple of classes to an image link and you’re away.

However, when you want to link to a specific image in the set, adding another link works but adds another copy of the image into the lightbox. It means that you need to use the jQuery API instead and there are a couple of functions that might work.

The first that I tried fitted the requirements of the project, so I stopped here. It opens the image in a lightbox, but it doesn’t open the set created by the links of class fresco:

jQuery(document).ready(function($) {
  $('.popfresco').click(function(e) {
    e.preventDefault();
    var image = $(this).attr('href'); 
    Fresco.show(image);
  });
});

and simply for the link:

<a class="popfresco" href="http://mountolympuspurefoods.com/wp-content/uploads/2016/11/mojito-kefir-label.jpg">

The call which I left for another day was

Fresco.show($('#elementid')[0]);

This needs targetting at the image link you want in some way and would probably open the set in the right place.

osCommerce versions

September 24th, 2017

Creation of osCommerce

The brainchild of Harald Ponce de Leon, osCommerce has been around for a long time. It started life as The Exchange Project in the early days of the millennium, a name which is still alive in the naming convention of its functions (starting with tep_).

Old osCommerce Shops

There are still many stores live on the web running a very old codebase. You often can’t tell by looking at them as many have a “skin” that makes the web page design modern, even if underneath the shop processes are supported by old code.

Older shops that I have come across may still be based on osC 2.2 – often pinned to their original release ; MS2 (milestone 2, 2003) through to RC2 (2008).

Why not update?

The reason for this is the wide range of addons that have been available for this time, but were applied by changing the code. This meant that while new shops were based on the current version of osC, many existing shops were never upgraded as the customisation had to be repeated.

With version 2.3 in 2010 a modicum of modularity was introduced, extended a little through the releases up until 2.3.4 in 2014.

Since this release, a community project known as Responsive osCommerce (or 2.3.4BS) has grown, derived from the 2.3.4 codebase. As well as using the Boostrap framework to deliver a responsive front end, it also greatly extends the modularity of the application allowing much more customisation and extension without the need to modify the core code.

Where are we now?

While not an official osCommerce release or version, it has been officially adopted to the extent that many of its features are to be included in the official release stream and its users have been promised a migration path back into that stream.

osC version 2.4 (in beta at the time of writing) has the same looking shop as the Responsive version, has a rewritten (and also responsive) administration area and opens up the concept of Apps to addon developers to modify and extend it in a way that is analogous the plugins of WordPress.

Worldpay Payments Extended Payment Module

March 18th, 2017

Released some time ago now, this extension to the standard payment module adds a couple of features:
– if the payment is cancelled in Worldpay, the shopper is returned to the shop checkout to choose another payment method
– for successful payments, the fraud checking information is carried through to oscommerce and recorded in the order history

Available to download from the addons area and also from a branch off the master in a fork of 2.3.4BS – see the wiki in my fork:
https://github.com/BrockleyJohn/Responsive-osCommerce/wiki/Worldpay-Hosted-Payments-extended

Paypal standard for osCommerce 2.3.4(BS)

January 19th, 2016

At the time of beginning this article, I’m still in the midst of a painful process to get working Paypal support on an oscommerce 2.3.4(BS) store. At this stage it’s a cautionary tale.

In testing, the paypal_standard module worked fine in sandbox mode, but was not tested in live mode.

We went live, and following payment through paypal, although processed fine in pp, the error “Could not verify the PayPal transaction. Please try again.” showed on return to the store. In the meantime, however, the IPN went through and updated the order to the appropriate status and added the comment verified.

The debug email showed only partial data being returned – no result and some get vars:

$HTTP_GET_VARS:

Array
(
[tx] => 6M910349SK180201D
[st] => Completed
[amt] => 1.20
[cc] => GBP
[cm] => 947
[item_number] =>
)

After a couple of hours fiddling about without getting any further, I re-implemented the old payment module from osc 2.2. I’m not happy with that either, as the ipn seems unreliable (though it was fine before the upgrade). So there are two paths of ongoing work, see if I can get the standard module going from a test osc install but against the live paypal account without the error and see if I can get the app going. The latter is fodder for several articles by itself.

Anyway the lesson learnt is – always test paypal integation against the live paypal environment as well as sandbox. Even if it’s just to make sure you have all the credentials right!

Setting up shipping modules in online shops – flat rate methods

January 5th, 2016

Flat Shipping Methods

The simplest way of charging for shipping is using a flat method. This means that the shipping charge doesn’t change depending on the customer’s order. It could be that you offer free shipping to everyone, or that you charge everyone the same.

This doesn’t imply you’ll send the order anywhere in the world for the same price, but it should be the same for anyone in your home country. If you are going to ship internationally, you probably want to restrict the destinations, or charge differently for some of them. If so, you’ll need a geographical method.

It also doesn’t imply the customer has no choice: you can still offer standard and express shipping, each of them charged at a different flat rate. In this case you’d be setting up two flat-rate shipping modules.

Flat charging methods are clear for your customers to understand, quick to implement and easy for you to explain on the site. Typically they are seen favourably by people placing high value orders, but may appear expensive to someone buying a single cheap item. Since the shipping charge for each order may not bear much relation to the shipping cost for each order, you need to monitor how well these balance out.

If you want the shipping charge to vary with the customer’s order, eg. free over £100 or heavier orders cost more, take a look at Table Rate Shipping Methods.

If you want the shipping charge to vary with the delivery address, find out more about Geographical Shipping Methods

Setting up shipping modules in online shops

January 3rd, 2016

Shipping Introduction

Shipping costs are complicated, generally speaking. For each business there are many possible options for the carriage of their orders. The costs to the business of shipping each order can vary depending on the choice of carrier, the destination country, the destination postcode (zipcode), the size of each package, the weight of each package, the number of packages in the order consignment – and the rates for all of this may vary according to the volume of orders sent out. If your freight is not collected by the carrier, you also need to factor in the cost and/or inconvenience of taking it to the drop-off (e.g. post office, parcel shop, courier depot).

If you’re lucky, the stuff you’re selling is all more-or-less the same size, shape and weight. This makes it an easy decision to choose how to send it and doesn’t need anything hard to set up in your store.

Typically, however, a business picks a combination of shipping methods based on their cost, reliability and convenience: e.g. mail, express parcels, slow parcels and freight. The customer is usually offered a simplified choice between a faster and a cheaper alternative for their order.

While it is possible to implement shipping charges that reflect the cost to the business of shipping each order, this can require a lot of investment in setting up the product data to support it, and it can be off-putting to online customers if delivery prices are unclear or appear high. It is common to implement a charging model in which small profits on delivery of many items off-set the losses on some orders, or where the profit margin of larger value orders is used to cover their shipping.

So the first step is to get an idea of the costs – either by looking at the orders you sent if you’re already trading, or by looking up the rates of the methods you’re planning to use if not. Check also for variation by location (more for outlying areas, other countries and so on), and for restrictions that may apply to individual products – e.g. glass or liquids excluded, size/weight limits, dangerous/illegal goods.
Keep a list of these variations and exceptions – you’ll need it when trying out the different shipping models for a good fit.

Now go through the various shipping models to see which seem to make sense for your store, and try out some numbers for the ones that look promising.

Simplest: Flat Rate Shipping

Remote access to MySQL – error 10061 can’t connect to MySQL server – host is not allowed – user is not allowed

February 15th, 2015

I’ve just been reviving my ubuntu (linux) server on the LAN to do some interface development and testing, and thought it would be easier to work if I had remote access to the MySQL databases to use something a little more productive than phpMyAdmin.

Poof! What a palaver! All up and running now, but time to make some notes in case I ever have to do this again. In case it matters, it’s the long term support LTS version of Ubuntu 12.04 (purple pangolin IIRC).

Anyhow, the default install of a LAMP server (linux/apache/mysql/php) doesn’t allow remote access, so you have to set it up.

The original error was

SQL Error (2003): Can't connect to MySQL server on hostname (10061)

 
Read the rest of this entry »

osCommerce / Quickbooks interface

February 9th, 2013

Recently released: interface between osC 2.2 and Quickbooks using QBWC

This is a complex & rich implementation, which linked an existing online catalogue & customers with existing inventory and customers in Quickbooks, which is used to record high-street shop customers and transactions. Ongoing functionality keeps stock levels in sync and feeds online transactions and customers to QB.

As well as semi-automated take-on, there’s flexible matching support that makes it straightforward to link the two inventories – no automated product/item creation.

The Quickbooks Web Connector (QBWC, available free from Intuit) runs on a pc alongside the desktop versions of Quickbooks, and communicates with a SOAP server based on ConsoliByte’s PHP integration framework. This was developed to implement the necessary calls, plus a transaction manager within osC to group together the several interface calls needed to support a shop transaction.  The main constraint is that QBWC requires SSL (but then, so does a fully integrated implementation of Googlecheckout/Google Wallet).

I expect to begin a simpler QB interface implementation for another site, based on osCommerce 2.3.1

cgi on cloud hosting

October 4th, 2012

Copying a site from cpanel hosting to cloud hosting… contact page uses cgiemail to send the message.

Testing the contact page (using the domain alias before changing the nameservers) fails with a not found error on accessing the script and include file.

Trying to access the mail script without the following bit of the path attempts to download the file instead of run it, so it appears to be a web server config problem.

Try adding a handler in a .htaccess file in the cgi-bin directory:

<FilesMatch “cgiemail”>
SetHandler cgi-script
</FilesMatch>

Following that, if you get an Internal Server Error (500), try setting the file permissions to 755.

osCommerce 2.2 Errors on copying a store to a new server

August 5th, 2012

Recently I’ve been setting up a test server within the LAN (to be able to use Quickbooks Web Connector without an SSL licence) and have had to resolve several errors relating to setting up a copy of an osCommerce 2.2 store.

Some issues relating to .htaccess files:
– these are used particularly in shared hosting to set specific system options that you might better set as server options on your own server
– a new LAMP installation typically defaults to not processing .htaccess files, so they are ignored
– when copying a store with URL rewriting enabled, the page links within the store are set to the rewritten URLs, but the server rewriting rules for the store are contained in the .htaccess file in the catalog directory and being ignored by default
– enabling the .htaccess files causes both the catalog and admin sides of the store to fail with Internal Error 500s
– the catalog side fails because other default server settings do not allow the .htaccess files to override server settings so you have to set AllowOverride to On for the URL rewriting
– the admin side fails because the password protection settings for the directory refer to paths and files on the old server