Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Replace osCommerce's checkout process with FoxyCart.
PHP JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ext/foxycart
.gitignore
README.textile
account.php
checkout_shipping.php

README.textile

Faux-sC

Sneaking FoxyCart through the system. A straightforward-to-install modification to osCommerce that directs the osCommerce checkout through FoxyCart.

Why, might you ask, would I want that in my osCommerce store? Simple: PCI Compliance — you don’t really want the burden of keeping your customers’ credit card numbers on file, do you?

Download

The latest, as a zip archive

The latest, as a compressed tarball

Installation

Extract the downloaded archive. Now you’ve got the following files:

<pre> README.textile ext/foxycart/ <----- copy this whole tree into your installation checkoutReplacement.php class.rc4crypt.php class.xmlparser.php config.php fc-oscommerce.php jquery-latest.pack.js loadingAnimation.gif macFFBgHack.png oscommerce.class.php test.xmldatafeed.php thickbox-compressed.js thickbox.css </pre>

1. Copy the ext/foxycart folder into the ext folder of your osCommerce installation.

2. Edit config.php, tell Faux-sC where to find your osCommerce install and the address of your FoxyCart store. If you offer free shipping on some products by setting their weight to 0, enable that section of config.php.

3. Copy this into the <head> tag of your checkout_process.php (at line 195 for us):

<pre> <?php //---- BEGIN FAUXSC HIJACK --// include('ext/foxycart/checkoutReplacement.php'); //---- END FAUXSC HIJACK ----// ?> </pre>

4. Copy this into the top block of code your account.php, right below the line that requires the language file (at line 22 for us):
<pre> <?php //---- BEGIN FAUXSC HIJACK --// include('ext/foxycart/emptyCart.php'); //---- END FAUXSC HIJACK ----// ?> </pre>

5. Edit checkoutReplacement.php, change the message that displays to customers when they’re directed to FoxyCart.

6. Set your FoxyCart Store’s datafeed to point to, for example:
http://www.yourstore.com/ext/foxycart/fc-oscommerce.php

7. You may want to turn off your store’s emails in FoxyCart: Faux-sC will send out osCommerce-like emails whenever a new order is placed.

8. For best user experience, we recommend editing your FoxyCart receipt template and replacing the default “Continue” button with one that directs the customer back to their account page on your site as follows:
<pre> http://www.yoursite.com/account.php?checkout_complete=1 </pre>

Setting ?checkout_complete=1 triggers the bit of code we added to account.php which empties the customer’s shopping cart before showing their account page. We think it makes sense to send people to their account page, but you may think differently — just move the code in step 4 to the top of that file.

Note that if the customer never clicks the continue link on their receipt, their shopping cart will automatically empty when FoxyCart updates the store’s datafeed: usually within a minute of when they place their order.

9. Test.

10. Once you’re happy with the checkout process, go ahead and turn off those notoriously PCI-breaking osCommerce payment modules — such as the plain Credit Card, Authorize.net, etc. You may want to leave standard PayPal on as, at the time of this writing, FoxyCart does not support standard PayPal.

How it Works

We assume that you are still using osCommerce for your main catalog and its basic shopping cart. Up until the customer has arrived at the “shipping options” page (checkout_shipping.php), the checkout process remains the same as usual: add to cart, update cart, checkout, login or create account.

Once they hit the shipping page, they’re immediately presented with an overlay on the page that asks: do you want Expedited Checkout or Standard? (The message is intentionally lame — please write a clear explanation for your customers). Note that the main reason we did this instead of just redirecting to Foxycart is for PayPal Standard; in the future, whether to redirect or ask will likely be an option in config.php.

OK, so: the customer chooses “expedited” and they’re taken right to FoxyCart. The “expedited” link was actually wrapped up in a form that creates a shopping cart in FoxyCart whose contents match the osCommerce basket.

The customer must now log in to FoxyCart, fill in their address and card information, and complete their order. In the future, FoxyCart will likely have an API for two-way synchronization of user address information; however, at the moment, a customer who has checked out through osCommerce but not through FoxyCart must enter their address information anew the first time through the FoxyCart checkout.

Once the customer has confirmed the order, the FoxyCart store datafeed sends the order information back to fc-datafeed.php, which does the following:

1. Creates an osCommerce account for the customer if they don’t have one. If they do, updates their address information in osCommerce.

2. Creates an order from osCommerce’s stored shopping cart contents.

3. Sends an osCommerce order email out to the customer.

4. Empty the customer’s saved and current baskets.

Caveats

We don’t support any of osCommerce’s internationalization features — when the customer checks out with FoxyCart, we have osCommerce always send the English descriptions of the products in the cart. At the moment, FoxyCart itself doesn’t support more than one language per store, until that’s changed we’re going to leave i18n alone.

Also, we will always use the English content for the order email, defined in osCommerce’s includes/languages/english/checkout_process.php. We also use a standard US address format in the receipt email that’s hardcoded into our OSCommerce interoperability class.

Notes

The OSCommerce class is designed to be usable outside of Faux-sC. Use it for good, not evil, and free data from the clutches of osCommerce.

Something went wrong with that request. Please try again.