Blog

Constant Contact API

05/05/2011
APIs
0 Comments

3rd Party email marketing services like Constant Contact, Mail Chimp, iContact, Benchmark Email, Campaigner, just to name a few are the the increasingly popular solution for managing website newsletters and email campaigns. However I was unsatisfied with the pre-generated contact forms provided by these companies. You know the forms where you enter your email and are then redirected to the 3rd party's site to confirm your email address before being added to the list. Anyway I  wanted to write an article talking up the benefits of using an API (if available), rather than the standard pre-generated forms. This article will deal with Constant Contact's API.

The Standard Constant Contact Form


When customers submit the standard constant contact form the following paramaters are passed to constant contact:

  • ea = Email Field
  • m = CC Account Number

When this form is submitted the customer is taken to away from the website to another form within a popup window. Additional information can be collected by adding fields to the form through constant contact. However there is no way of passing the information from the form on your website to the form on constant contact when the user submits there information.. So the solution to more customized constant contact forms is to use their API. You can get to the sample forms and code from the constant contact developer website or download them straight from sourceforge at this link http://sourceforge.net/projects/ctctsampleforms/.

The sample code includes a class to work with the API in a file called cc_class.php. The file contains the class CC_Utility() with 3 extensions to the class CC_List(), CC_Contact(), CC_Campaign(). This is where you put your cc account information:

var $login = 'cc-account-username'; //Username for your account
var $password = 'cc-account-password'; //Password for your account
var $apikey = 'your-api-key'; // API Key for your account.

Once you have your cc account information in the right place the class and API are very easy to work with, and provide the ability for you to setup a completely custom signup form on your website that interacts directly with your constant contact account. You can specify which email lists you want people to sign up for, allow customers to edit/update their contact information, and more. Best of all the customer will never leave your website, maintaining a professional appearance, and a more user-friendly process for your customers.

Migrating OsCommerce to a New Server

05/02/2011
eCommerce
0 Comments

I recently had to move a client's osCommerce website to a new server. It was a a messier migration than I expected, so I wrote a guide to make it easier for everyone. 

Difficulty:
Moderate, somewhat technical, advanced for someone who isn’t familiar in the LAMP environment.

Requirements:

  • Know how to FTP, and have FTP Login Information

  • Familiarity with SQL, Database Login Information

  • Your New Hosting or a New Server with PHP and SQL

  • Know your Absolute Hosing Path  ex. /home/content/y/o/u/yourabslutepath/html

  • Some knowledge of PHP, SQL, and Linux Servers

Files Edited In This Tutorial:

  • osCommerce/catalog/includes/configure.php

  • osCommerce/catalog/admin/includes/configure.php

  • osCommerce/catalog/ includes/functions/sessions.php

  • osCommerce/catalog/admin/includes/functions/sessions.php

  • .htaccess

  • osCommerce/catalog/.htaccess

  • osCommerce/catalog/admin/.htaccess

  • index.html

1) Copy Your Website Files

FTP to your current website root and copy your entire website. The root is usually your starting directory, or the top most directory, or called something like public_html/. Make sure you copy your entire website.

2) Export and Import Your Database

Login to your database manager, usually phpmyadmin. Click on your database, and select export. Export all of the tables in the database to an sql text file. You should remove the very top portion of code in the exported text where the database is created ex. CREATE DATABASE yourdatabase. It is unnecessary since you usually need to create a new database and user manually on your new server. Once your new database is created on the new server, select sql or import. Then copy the sql text from the export you just did into the textfield.  Your database connection information replaces the old connection information in the catalog/includes/configure.php, and the catalog/admin/includes/configure.php files.

3) Change the Website Redirect

If your URL is different make sure you replace the old URL with the new one in the meta redirect of the root index.htm file, ex. URL=http://www.yournewurlhere/osCommerce/catalog/.

UPDATE: Your site may not have a meta redirect, I don't think this exists in all osCommerce installations... it may have been added by a previous php developer. Anyways you will want to check for incorrect redirects as they will cause problems.

4) .htaccess File Configurations

If your URL is different you need to replace it with the new one in the .htaccess files. Be very careful not to change anything except the URL, ex. www.yourwebsite.com. Change these files:

  • .htaccess

  • osCommerce/catalog/.htaccess

  • osCommerce/catalog/admin/.htaccess

5) Check Register Globals

One of the first errors people get is easily corrected by placing a file named php.ini in the root directory of the new server. The following code must be placed in the file, register_globals = ON. Godaddy servers require that the file be named php5.ini. You may want to check with your hosting provider if there are any requirements or restrictions regarding the php.ini file on your server.

6) Replace Configuration Settings

Replace all of the old configuration settings with the new server’s URL, Absolute Hosting Path, and Database Connection Information, in these files (your URL may be the same):

  • osCommerce/catalog/includes/configure.php

  • osCommerce/catalog/admin/includes/configure.php

7) Administration Passwords

Depending upon the original configuration, your administration passwords may not work.  To fix the issue change the admin/.htaccess file. Make sure it is pointing to the correct passwd file for the osCommerce/catalog/admin directory. Make sure the password you are using is in the passwd file. It is easy if you can locate your old passwd file and copy it to the correct location on your new server.

8) Session, Cookie, and Header Errors

Session and Header errors sometimes occur depending upon your original configurataion. You may need to recreate a directory called phpsession in the root of the new site, and then replace the session_save_path with the absolute hosting path and your new phpsession directory.

9) SSL Errors or Long Load Times

If you do not have an SSL set up yet on the new server you can prevent a lot of errors by disabling the SSL connection. Start by making sure your URL paths in the configure files are not pointed to https:// in both of the configure.php files. Next turn off SSL in both of the configure.php files, define(’ENABLE_SSL’, false); define(’ENABLE_SSL_CATALOG’, false); .

I hope this was helpful. If you have any questions, or if you want to hire me to help with your migration to a new server feel free to contact me a karl@webksd.com.