Jump to content
Latest News: (loading..)

Recommended Posts

This following package is based on the Discount Code for osCommerce 2.3.1 Addon.

I was able to reduce the install process from 16 steps down to 9 steps.

Database tables and filenames definition have been removed. I tried to keep the code changes to a minimum.

SQL install/uninstall is done automatically with the ot_ module.

 

Download:

 

 

Edited by Tsimi

Share this post


Link to post
Share on other sites

Hi Lambros

 

Thought Id install this module and see what happens. All installed OK except I don't have anything under

 

Administration -> Catalog -> Discount Codes

 

What have i missed. Many thanks

 

Cheers

Grandpa

Share this post


Link to post
Share on other sites

@@grandpaj

 

Just did a quick install and you are right. My apologies.

There are two small typos inside the catalog_dc_content.php file.

 

Replace the whole contents of that file with this

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2015 osCommerce

  Released under the GNU General Public License
*/


    foreach ( $cl_box_groups as &$group ) {
    if ( $group['heading'] == BOX_HEADING_CATALOG ) {
      $group['apps'][] = array('code' => 'discount_codes.php',
                               'title' => BOX_CATALOG_DISCOUNT_CODES,
                               'link' => tep_href_link('discount_codes.php'));

      break;
    }
  }
?>

or just simply change both REPORTS to CATALOG.

Edited by Tsimi

Share this post


Link to post
Share on other sites

@@grandpaj

 

Oh man, I must have been really not my self today. I thought I replaced all instances. Again my apologies.

Open the admin/discount_codes.php file and go to line 442

There replace FILENAME_DISCOUNT_CODES with 'discount_codes.php'

Edited by Tsimi

Share this post


Link to post
Share on other sites

And just found more typos.

 

Inside the checkout_process.php replace this code

  // Discount Code 3.2 - start
  if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true' && !empty($discount)) {
    $discount_codes_query = tep_db_query("select discount_codes_id from " . TABLE_DISCOUNT_CODES . " where discount_codes = '" . tep_db_input($sess_discount_code) . "'");
    $discount_codes = tep_db_fetch_array($discount_codes_query);

    tep_db_perform(TABLE_CUSTOMERS_TO_DISCOUNT_CODES, array('customers_id' => $customer_id, 'discount_codes_id' => $discount_codes['discount_codes_id']));
    tep_db_query("update " . TABLE_DISCOUNT_CODES . " set number_of_orders = number_of_orders + 1 where discount_codes_id = '" . (int)$discount_codes['discount_codes_id'] . "'");

    tep_session_unregister('sess_discount_code');
  }
  // Discount Code 3.2 - end

with this one

  // Discount Code 3.2 - start
  if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true' && !empty($discount)) {
    $discount_codes_query = tep_db_query("select discount_codes_id from discount_codes where discount_codes = '" . tep_db_input($sess_discount_code) . "'");
    $discount_codes = tep_db_fetch_array($discount_codes_query);

    tep_db_perform('customers_to_discount_codes', array('customers_id' => $customer_id, 'discount_codes_id' => $discount_codes['discount_codes_id']));
    tep_db_query("update discount_codes set number_of_orders = number_of_orders + 1 where discount_codes_id = '" . (int)$discount_codes['discount_codes_id'] . "'");

    tep_session_unregister('sess_discount_code');
  }
  // Discount Code 3.2 - end

and inside the template_top.php

 

replace this code

<?php
  // Discount Code 3.2 - start
  if (basename($PHP_SELF) == FILENAME_DISCOUNT_CODES && isset($action) && $action == 'new') {
    echo '<body onload="onload();">';
  } else {
    echo '<body>';
  }
  // Discount Code 3.2 - end
?>

with this

<?php
  // Discount Code 3.2 - start
  if (basename($PHP_SELF) == 'discount_codes.php' && isset($action) && $action == 'new') {
    echo '<body onload="onload();">';
  } else {
    echo '<body>';
  }
  // Discount Code 3.2 - end
?>

I'll best go over the whole package again and see if there are more mistakes inside and clean them out.

Then repack the whole thing.

Edited by Tsimi

Share this post


Link to post
Share on other sites

@@Tsimi

 

Hi Lambros

 

I suppose I can at least be of some help, as Ive really no idea about code.

 

Great work, am about to try the new package.

 

Cheers

 

John

Share this post


Link to post
Share on other sites

Didn't see this post before.

Just to let know that I just uploaded a new bootstrapped version of:

 

Ship In Cart v2.4 BS
Add-on: http://addons.oscommerce.com/info/9066

 

which includes support for Discount Code 3.2.

Share this post


Link to post
Share on other sites

@@raiwa

@@Tsimi

 

Anyone using or know if this Discount Coupon Add-on works with Mailbeez?

 

Dan

Share this post


Link to post
Share on other sites

@@Dan Cole

 

I am not familiar with the Mailbeez service but the Discount Code deos not touch any mail function.

It is a simple order total module which will show in any confirmation e-mail no matter if HTML or plain text.

Edited by Tsimi

Share this post


Link to post
Share on other sites

@@Tsimi Thanks Lambros....I found the current discount coupon code module I'm using so I should probably try and update it....at least I'll know that it works with Mailbeez.  This one appealed to  me since it looked like there was minimal changes to the core and you had already done the heavy lifting.    :thumbsup:

 

Dan 

Edited by Dan Cole

Share this post


Link to post
Share on other sites

@@Tsimi  4 times eh?   That's probably some sort of record.  :P

 

The Discount Coupon contribution I'm currently using is this one here... http://addons.oscommerce.com/info/7644

 

Actually I'm using an older version of it but since my previuos post I had a look at it and I think it's an easy pesy install so I'm going to just run with it.   I don't like the idea that it requires changes to the core in several files but based on the discussion in the thread about updaing SPPC I think those changes can be eliminated along the way.

 

Dan

Share this post


Link to post
Share on other sites

lol yeah 4 times. I gotta be good at something right. :D

 

Just took a quick look at the install manual and I think there is a lot space for improvement to make the install more shorter.

I'll install it into my local store once and play around with it.

 

There is an issue with the other Discount Codes addon (Discount Codes 3.2) when using free shipping. Let's see if this one does a better job.

 

Thanks again for the info.

Share this post


Link to post
Share on other sites

@@Tsimi I don't use it with the standard free shipping module but I do use in situations where the shipping is adjusted if the order if over a certain valve, so hopefully it'll work for you.

 

Good luck with it...

 

Dan

Share this post


Link to post
Share on other sites

Thanks for the contribution i made i little change to avoid that the result is less than zero

 

around line 110

change

$order->info['total'] -= $discount;

To

if ($discount > $order->info['subtotal']) {
$discount = $order->info['subtotal'];
$order->info['total'] -= $discount;
} else {
$order->info['total'] -= $discount;
} 

Best regards

Marco

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×