the bofe blog

a twenty something IT professional with a few things to say

Archive for November 2006

Music Trolling

with 2 comments

“Dr.” David Thorpe writes a column on SomethingAwful called Your Band Sucks which regularly trashes bands that I love.

He points out why Tool, Coheed and Cambria, Radiohead Avenged Sevenfold, and basically any band with a decent following all suck. The cool thing is that most of the time he’s right.

The column is a good reality check for any of the music fanatics out there. Read the fan mail he gets.

Ridiculous.

Written by bofe

November 21, 2006 at 12:24

Posted in Personal

Tagged with , ,

Expert Guitar Hero 2

with 9 comments

This afternoon I beat Guitar Hero 2 on expert. This week was dedicated to dethroning Freebird, and I was finally triumphant.

Now to rest my hands…

Written by bofe

November 19, 2006 at 14:59

Posted in Personal

Tagged with , ,

modifying osCommerce – [part 2 - Functions, Cases, Blocks Oh My]

with 8 comments

As I stated in my previous article on osCommerce, I did some work that had me modifying osCommerce. The modifications dealt with customizing shipping to be per product ordered. They fell under these categories:

  • Product Display
  • Shopping Cart Behavior
  • Checkout Process

Before We Code

It’s imperative to have a clearly defined plan for what additional data we’re storing. It’s also a good idea to have the database tables already modified.

The only table I ended up modifying was orders_products. I added fields like greeting, customers_shipping_id, discounts, and shipping_date.

There was only one table that I created (that was related to my modification): customers_shipping (customers_shipping_id PK, customer_id, shipping_name, shipping_address1, shipping_address2, shipping_city, shipping_state, shipping_zip)

Product Display

The file we’ll be looking at is product_info.php. Not a lot of osCommerce specific modifications happened here. I just plugged in specific PHP code for the user to select a shipping method, a destination, greeting, and a shipping date.

Shopping Cart

It’s good to understand the process that osC uses for a shopping experience.

Selecting “add to cart” from product_info.php goes through this process:

  1. hits application_top.php with a HTTP GET of action “add_product”.
  2. flies to the switch case statement for $action which is: switch ($HTTP_GET_VARS[‘action’]) {
  3. goes to “add_product”:

The Shopping Cart has a few functions.

Found in includes/classes/shopping_cart.php

restore_contents()—does a restoration of shopping cart contents based on your shopping “basket”—the previous items you added to your cart with a login/password but did not check out.

notes: if you are a guest on the cart and you have products, when you log in their contents are added to your “basket”—as well as each additional product you add to your cart until checkout.

Additions I made here were mainly adding fields to be inserted into the “basket” (customers_shipping_id, greeting, shipping_date, shipping_id) I also changed the cart object that is returned here ($this->contents[$products[‘products_id’]]) to contain shipping_date, shipping_id, greeting and customers_shipping_id.

add_cart($products_id, $qty = ‘1’, $attributes = ‘’, $notify = true)—adds the product to your cart.

notes: if we’re dealing with a logged in session, add it to the basket (database) as well as the cart (sessions)

get_products()—provides a list of all products in the cart.

Once a user has items in the shopping cart, we go to the checkout process:

in includes/classes/order.php you’ll find a few functions.

cart()—transfers what was in the the shopping cart into an order.
query()—writes the order to the DB.
order()—initializes and calls cart()

The order then passes to a payment module, we used Authorize.NET AIM…

Methods in includes/classes/modules/payment/authorizenetaim.php

pre_confirmation_check()—runs a basic CC validation algorithm ( does not actually CHARGE the card )

before_process()—hits authorize.net VIA cURL and returns $response which is a pipe delimited string that has specifications “here:http://www.authorize.net/support/AIM_guide.pdf

To Change what username or password this module uses, the easiest way to go is via /catadmin/ and go to Modules > Payment > Authorize.net AIM

Ordering

This is where the bulk of the work I did was – the main files we’re dealing with are prefixed with checkout_.

The main pointer I can give with dealing with the checkout_ files is realize they all hit application_top.php first before spitting back to the actual page.

Database Notes

address_book—contains the default billing address for customers. address_book was originally intended for multiple shipping addresses, but not at the product level and didn’t provide enough flexibility.

categories—contains all of the categories and their “parent” categories. some redundancy.

categories_description—all of the names of the categories and their text descriptions that display on individual category pages.

customers—customer database. only really deals with osCommerce logins contains new customer email addresses. only important to osCommerce.

customers_basket—contains “shopping basket” for customers. i added shipping_date, greeting, customers_shipping_id, and shipping_id to this table.

orders—used in displaying order history. is the osCommerce orders table.

orders_products—modified with additions of shipping_date, greeting, users_shipping_id, and shipping_id (users_shipping_id == customers_shipping_id)

In Closing…

osCommerce is not so bad to modify if you have a clear plan. However, I really question some of the methods they use to iterate through products, like no foreach() loops!

My next article will be about analysis of your shopping cart. I’ll show you how to plug osCommerce into Google Analytics so that you can show your stakeholders great data on your store’s success.

Written by bofe

November 16, 2006 at 16:50

Posted in Personal

Tagged with ,

akbsad becomes dailyshortcut.com

with 2 comments

I couldn’t believe the domain was available. So, I snagged it and moved…

Enjoy Dailyshortcut.com

Written by bofe

November 11, 2006 at 11:57

Posted in Personal

Tagged with ,

Losticil

with one comment

A few of you readers need this new drug. I’m looking at you, Julia…

Sent from CodyKP.

Written by bofe

November 11, 2006 at 10:20

Posted in Personal

Tagged with

Cleaning up those MovableType 404s with mod_rewrite

with 3 comments

Long ago, I was running Movable Type with a link structure that looked like this:

http://www.bofe.org/archives/yyyy/mm/dd/entry-title

Then, I switched to wordpress which gives me this:

http://www.bofe.org/wp/yyyy/mm/dd/entry-title

Apache and mod_rewrite to the rescue.

Make a .htaccess file at the root level like this:

RewriteEngine On
ReWriteRule archives/(.*)/(.*)/(.*)/(.*) http://www.bofe.org/wp/$1/$2/$3/$4

Replace my domain with yours. Bliss!

Written by bofe

November 10, 2006 at 14:00

Posted in Personal

Tagged with ,

301/302 and HTTP Refer

without comments

For (my) future reference…

If you’re using HTTP Status code 301 or 302 to redirect, some services do not retain the header for HTTP to tell you the referring URL.

Example:

/GET advertisement.net/site1.php?redirect=bofe.org

site1.php has this code:

There’s no way for bofe.org to know that 90% of the hits from advertisement.net actually came from advertisement.net. bofe.org’s logs look like users just typed it in.

The key, tell advertisement.net to redirect to a Unique URL.

/GET advertisement.net/site1.php?redirect=bofe.org/1234.php

where 1234.php redirects to the preferred destination.

Now you can effectively track the effectiveness of the advertisement that you were running with advertisement.net.

Written by bofe

November 10, 2006 at 11:32

Posted in Personal

Tagged with ,

Guitar Hero 2: Day 1

without comments

I just got to put a couple of hours in on Guitar Hero 2 last night.

In expert mode, I made it to Freya. 27 out of 45. 60% through on my first run.

I love the hammer on/pull offs, though. Maybe I’ll get to post a video of my skills one of these days…

Written by bofe

November 9, 2006 at 17:04

Posted in Personal

Tagged with ,

The Longest Day

without comments

A bulleted recap of 11/06/2006 – 11/07/2006

  • 7:30 AM, wake up
  • 8:40 AM drive to Evansville, IN for job interview
  • 10:00 AM arrive in Evansville, interview
  • 12:00 PM finish interviewing, depart for Owensboro
  • 12:50 PM arrive home, spend time relaxing…wait for Adam and Pixie to pick me up for flight to Nashville
  • 5:00 PM depart Owensboro for Nashville, TN (I have a flight back to KC at 8:20 PM)
  • 11:30 PM arrive at Red Roof Inn in Nashville, TN.
  • 12:03 AM (It’s now Tuesday) receive text notification from Clayton that Guitar Hero 2 has been acquired
  • 4:00 AM receive text message from Clayton saying he has conquered GH2.
  • 4:00:15 AM weep openly because Clayton beat GH2 before I did
  • 4:30 AM shower, get ready to get taxi to airport
  • 5:20 AM take taxi ride from hotel to airport
  • 6:45 AM depart Nashville
  • 8:30 AM arrive in Kansas City
  • 9:30 AM drive to Overland Park to shower again, change clothes, and go to work
  • 11:00 AM arrive at work, resume normal work week
  • 6:00 PM get home, play GH2
  • 7:30 PM sleep

Typically, a drive to Nashville from Owensboro is two hours and change. According to the KY DOT, this was due to a “vehicle on fire” on I-65 south bound—about 5 minutes outside of Bowling Green.

My whole day was completely fucked.

I had to get DMac’s wife on the phone (Thank you SO much!) to cancel my original 8:20 PM reservation and get the next one possible. Next reservation? 6:45 AM.

So, we drove around Nashville near the airport and found a hotel room for the three of us that night. It was a pretty terrible hotel, filled with roaches and my crazy travel friends. I did not get any sleep.

Written by bofe

November 8, 2006 at 17:42

Posted in Personal

Tagged with

Not Quite Uprooting

without comments

I’m moving to Owensboro, Kentucky over Thanksgiving. My last day in the Kansas City area is November 22. I put in my notice at the agency Tuesday afternoon. It’s been a wild ride, and I wouldn’t trade any of it.

Deciding to move out to KC right after college was a very tough decision. It’s been equally difficult to decide to move back to KY.

To everyone I’ve met here, it’s been wonderful. I’ve learned a lot about business, computers, the world, and myself.

Why? I’m just not willing to settle down here. The area just isn’t me. I’m better when I’m close to friends and family.

So, moving again is not quite uprooting because I never even bought a bed—but I’ll always remember my 5 months here.

Written by bofe

November 8, 2006 at 17:32

Posted in Personal

Tagged with