Two prices per product in osCommerce

By | February 14, 2010

Had an interesting puzzle presented to me the other day. Basically an osCommerce store owner wanted to have two prices of products. In other words;

– the standard price
– a “friends and family” price (% reduction)

My idea was to simply use a Coupon Code to get the % reduction, then amend the display_price to show both the standard price AND the reduced price.

Pleased to say that within an hour of thinking about it, I was able to come up with a workable solution…based on my version 5.5 Coupon Code system.

So, an installation of v5.5 coupon code was the first step. This allows the store owner to set up coupons for % off, money off or free shipping. It also gives the ability for the buyer to insert the coupon code BEFORE the checkout process (I think mine is the only Coupon Code system that does this), which of course means that the buyer can browse the store with the Coupon Session present [before accessing the checkout].

We can now determine if a coupon code is present and amend the display of all prices appropriately;

if (tep_session_is_registered('coupon_code')) {
$price_shown .= '
Friends and Family Price: ' . $this->format($this->calculate_price($products_price - ($products_price * ($_SESSION['coupon_amount'] / 100)), $products_tax, $quantity)) . '';

and to make it look pretty (stylesheet.css);

.FF {
background: yellow;

Very straightforward way to give two prices of products. Can be made more complicated by installing other things such as QPBPP (Quantity Price Breaks Per Product) or SPPC (Seperate Pricing Per Customer), but my way is an installation of a fairly simple coupon system and an extra couple of lines of code to deal with showing two prices. Easy!

Leave a Reply

Your email address will not be published.