Search

Resume and bio of the author Couple of articles related to my hobby - robotics
My impressions about immigration to Australia. In Russian only. Recipes for everyday problems solving
Linux-related posts Windows-related posts
Software-related posts A lot of info about hardware
Different tools you might find useful Posts about various web technologies
Everything that doesn't fit the rest of the menu RSS feed for this blog

Tag Cloud

Archives

Links

Andrey Mikhalchuk’s Blog

Technoblog about life

Feb 3, 2008 How to install coupons module for osCommerce (notes on installation and configuration)

The purpose of this post is not to replace the original coupons module installation manual, but to provide answers that you might have while installing it. It is based on my own experience and might be different from yours. This post is a part of set related to installing and configuring your own store. Please read the master post here.



So you decided to install something that will allow coupons in your store. Here is how you can do that. Grab a couple of coffee cups as this one will be tricky. So, the coupons module I really like is “Discount Coupon Codes “.

  1. The installation of this plugin is a bit complicated. Don’t try overwriting the original osCommerce files!! Instead open manual.html file from the module distribution and follow steps listed in “Edit Existing files”, then copy new files to the the osCommerce distribution.
  2. While editing the existing files you should be careful as line numbers do not match in many cases.
  3. Mods to admin/includes/boxes/catalog.php and admin/includes/boxes/reports.php are missing periods at the end of the second line. Add them, otherwise your store will become inaccessible.
  4. catalog/includes/classes/order.php file changed significantly since the module was released, so you will have to be extra careful while rewriting that part. I rewrote it like this:
    //kgt - discount coupons
    if( is_object( $this->coupon ) ) {
    $applied_discount = 0;
    $discount = $this->coupon->calculate_discount( $this->products[$index], $valid_products_count );
    if( $discount['applied_discount'] > 0 ) $valid_products_count++;
    $shown_price = $this->coupon->calculate_shown_price( $discount, $this->products[$index] );
    $this->info['subtotal'] += $shown_price['shown_price'];
    $shown_price = $shown_price['actual_shown_price'];
    } else {
    $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
    $this->info['subtotal'] += $shown_price;
    }
    /**************
    $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
    $this->info['subtotal'] += $shown_price;
    **************/
    //end kgt - discount coupons
  5. Beware of some drawbacks of this module:
    1. It doesn’t support stackable coupons
    2. Be careful and do not make coupon for amount more then the actual product price! The module incorrectly handles this situation
    3. The original module doesn’t support coupons for more then 999.99. To fix that alter the coupons table as following (issue this command in your db management program:
      alter table discount_coupons change coupons_discount_amount coupons_discount_amount decimal(17,12) not null default 0;

This post is published in Building your store, How To, Web.

3 Responses to “How to install coupons module for osCommerce (notes on installation and configuration)”

  1. How to establish your own internet store with osCommerce, USPS shipping, Paypal Pro payment and Coupons | Andrey Mikhalchuk's Blog Says:

    [...] Comments How to install coupons module for osCommerce (notes on installation and configuration) | Andrey Mikh… on How to establish your own internet store with osCommerce, USPS shipping, Paypal Pro payment and [...]

  2. Dave Bluman Says:

    Hi Andrey,
    Do you know if the Discount Coupon Codes can be applied to shipping versus taking an amount off the product price. For example if I want to get free shipping for a coupon code how would I go about this?
    Thanks,
    Dave

  3. Andrey Mikhalchuk Says:

    Hi Dave,

    Sorry, I don’t know that. In fact I set up my store a long time ago and since then I didn’t work with osCommerce anymore. When I’ll need to set up my next storefront (in a few months) I might become able to answer your question :)

    Regards,
    Andrey

Leave a Reply

You must be logged in to post a comment.

Site Map (c) Andrey Mikhalchuk, 2005-2008