Jump to content
Latest News: (loading..)
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Just wondering if anyone has figured out a way yet to have both a product discount and a shipping discount attached to one discount code?

I am sure my boss will have me working on this one before long.


I run a completely customized osC2.2 RC1 shop with mostly custom modifications that replicate the features of many contributions available except in a way that the data is more easily synced with Quickbooks on a continuous basis.

Share this post


Link to post
Share on other sites

STILL CANNOT ADD COUPON WITHOUT REFRESH - ANYONE SOLVE THIS ISSUE YET???

I've SEARCHED EVERYWHERE WITH NO LUCK

 

I've tried these below codes and still does not work

 

I tried adding this code:

 

if (!tep_session_is_registered('coupon')) tep_session_register('coupon');

if (tep_not_null($HTTP_POST_VARS['coupon'])) {

$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

}

 

BEFORE these lines:

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

I've had the same problem with v 3.32, tried everytihing and searche everywhere with no luck. It only shows up in checkout_confirmation.php if the page is refreshed. Is there a command line to make the page refresh automatically? Placing that in the code may solve the problem.

Share this post


Link to post
Share on other sites

I've had the same problem with v 3.32, tried everytihing and searche everywhere with no luck. It only shows up in checkout_confirmation.php if the page is refreshed. Is there a command line to make the page refresh automatically? Placing that in the code may solve the problem.

 

I have the exact same issue. I have 2 websites. on one the code works perfectly and on the other I have to refresh the page on checkout confirmation then it works perfectly.

 

Why would I have to refresh? I can't seem to figure it out. I thought it might be because the session id was being lost maybe? I added this code:

 

if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
 if (tep_not_null($HTTP_POST_VARS['coupon'])) {
       $coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
 }

 

But it did nothing.

 

Any help would be extremely appreciated.

Share this post


Link to post
Share on other sites

I've had the same problem with v 3.32, tried everytihing and searche everywhere with no luck. It only shows up in checkout_confirmation.php if the page is refreshed. Is there a command line to make the page refresh automatically? Placing that in the code may solve the problem.

I have not been able to reproduce this problem. Believe me before I took this contribution with all of my modifications to the production server last night I tried to reproduce it to make certain I wasn't going to have a problem with it. I settled on version 3.32 as it had the fewest bugs and customizations for me to make, so I have no idea why you are having this problem. I would tripple check to make sure you didn't miss anything in the installation.

After that if you still want to solve the issue by refreshing the page consider that there are about a dozen different ways to do this that I can think of off the top of my head, but they will get you stuck in a loop. You can set a delay so the user has time to move through the checkout process, but then they may continue on before the first refresh. I can only think of a few solutions that may solve your problem from a refresh approach that will not put your visitor in a refresh loop (think stock ticker that constantly refreshes with new data).

 

JavaScript Solution 1 (probably the most cross-browser compatible, though I have tested much):

if(window.location.search.indexOf('reload')<0)

window.location.replace(window.location.href+'?reload');

 

JavaScript Solution 2 (works by storing a reloaded variable in the navigator DOM level and then checked on reload to see if another reload is necesarry. simply change the < 1 to however many times you want to reload.):

function loaded(){

if (!navigator.reloaded){

navigator.reloaded=0

}

if (navigator.reloaded < 1){

navigator.reloaded = ++;

location.reload();

}

}

 

JavaScript Solution 3 (the simplest solution I know, but likely the least cross-browser compatible):

if(name!='reload')

{

name = 'reload';

window.location.replace(window.location.href);

}

 

 

Test those out and let me know which seems the most cross-browser compatible. BTW the second solution can be called from an onLoad.

-Jason


I run a completely customized osC2.2 RC1 shop with mostly custom modifications that replicate the features of many contributions available except in a way that the data is more easily synced with Quickbooks on a continuous basis.

Share this post


Link to post
Share on other sites

I have not been able to reproduce this problem. Believe me before I took this contribution with all of my modifications to the production server last night I tried to reproduce it to make certain I wasn't going to have a problem with it. I settled on version 3.32 as it had the fewest bugs and customizations for me to make, so I have no idea why you are having this problem. I would tripple check to make sure you didn't miss anything in the installation.

After that if you still want to solve the issue by refreshing the page consider that there are about a dozen different ways to do this that I can think of off the top of my head, but they will get you stuck in a loop. You can set a delay so the user has time to move through the checkout process, but then they may continue on before the first refresh. I can only think of a few solutions that may solve your problem from a refresh approach that will not put your visitor in a refresh loop (think stock ticker that constantly refreshes with new data).

 

JavaScript Solution 1 (probably the most cross-browser compatible, though I have tested much):

if(window.location.search.indexOf('reload')<0)

window.location.replace(window.location.href+'?reload');

 

JavaScript Solution 2 (works by storing a reloaded variable in the navigator DOM level and then checked on reload to see if another reload is necesarry. simply change the < 1 to however many times you want to reload.):

function loaded(){

if (!navigator.reloaded){

navigator.reloaded=0

}

if (navigator.reloaded < 1){

navigator.reloaded = ++;

location.reload();

}

}

 

JavaScript Solution 3 (the simplest solution I know, but likely the least cross-browser compatible):

if(name!='reload')

{

name = 'reload';

window.location.replace(window.location.href);

}

 

 

Test those out and let me know which seems the most cross-browser compatible. BTW the second solution can be called from an onLoad.

-Jason

 

Thanks for the refresh code Jason. It is very weird that both of us are experiencing this same issue. I installed it with the autoinstaller do you think that could have an effect on this problem?

Share this post


Link to post
Share on other sites

Thanks for the refresh code Jason. It is very weird that both of us are experiencing this same issue. I installed it with the autoinstaller do you think that could have an effect on this problem?

 

I just tried the first two refresh scripts. the first one redirected to the index page. the second one did not work.

 

Just a little more info on the coupon code refresh problem as well:

 

once the user logs in and refreshes the confirmation page and the coupon shows up, if they then go back to shopping add products and do the checkout procedure again the coupon code works perfectly no refresh needed (with the updated amount too because new products were added and I am using a %age base coupon).

 

I'm pretty sure that can be indicative of where the problem lies but I am not familiar enough with either oscommerce or DCC code to be able to say where.

 

I would much rather have this work properly then use a refresh page script obviously so just trying to provide as much info as I can.

Share this post


Link to post
Share on other sites

I hava the same problem described below.. any clue ?

 

I have this module installed and wrks just fine. Also have the golden oldie Quantity Discounts http://www.oscommerc...y/contributions,1159

 

QTY discount has an option to disable it when a voucher is used. Doesn't seem to work with this contrib however. Does anyone have an idea how I can disable on of the two? I would prefer to hav the qty discount disabled when a coupon is used. See below for the code for ot_qty_discount.php.

 

Would really appreciate it when someone could help!

 

 

 

<?php/* $Id: ot_qty_discount.php,v 1.4 2004-08-22 dreamscape Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2004 Josh Dechant Protions Copyright © 2003 osCommerce Released under the GNU General Public License*/ class ot_qty_discount { var $title, $output; function ot_qty_discount() { $this->code = 'ot_qty_discount'; $this->title = MODULE_QTY_DISCOUNT_TITLE; $this->description = MODULE_QTY_DISCOUNT_DESCRIPTION; $this->enabled = MODULE_QTY_DISCOUNT_STATUS; $this->sort_order = MODULE_QTY_DISCOUNT_SORT_ORDER; $this->include_shipping = MODULE_QTY_DISCOUNT_INC_SHIPPING; $this->include_tax = MODULE_QTY_DISCOUNT_INC_TAX; $this->calculate_tax = MODULE_QTY_DISCOUNT_CALC_TAX; $this->output = array(); } function process() { global $order, $currencies, $ot_subtotal; $od_amount = $this->calculate_discount($this->get_order_total()); if ($this->calculate_tax == 'true') $tod_amount = $this->calculate_tax_effect($od_amount); if ($od_amount > 0) { if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') $title_ext = sprintf(MODULE_QTY_DISCOUNT_PERCENTAGE_TEXT_EXTENSION ,$this->calculate_rate($_SESSION['cart']->count_contents())); $this->deduction = $od_amount+$tod_amount; $this->output[] = array('title' => sprintf(MODULE_QTY_DISCOUNT_FORMATED_TITLE, $title_ext), 'text' => sprintf(MODULE_QTY_DISCOUNT_FORMATED_TEXT, $currencies->format($od_amount)), 'value' => $od_amount); $order->info['total'] -= $this->deduction; $order->info['tax'] -= $tod_amount; if ($this->sort_order < $ot_subtotal->sort_order) $order->info['subtotal'] -= $this->deduction; } } function calculate_discount($amount) { global $qty_discount, $order_total_array; $od_amount = 0; if ((MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON == 'true') && (isset($_SESSION['cc_id']))) return $od_amount; $qty_discount = $this->calculate_rate($_SESSION['cart']->count_contents()); if ($qty_discount > 0) { if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') { $od_amount = round((($amount*10)/10)*($qty_discount/100), 2); } else { $od_amount = round((($qty_discount*10)/10), 2); } } return $od_amount; } function calculate_rate($order_qty) { $discount_rate = split("[:,]" , MODULE_QTY_DISCOUNT_RATES); $size = sizeof($discount_rate); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_qty >= $discount_rate[$i]) { $qty_discount = $discount_rate[$i+1]; } } return $qty_discount; } function calculate_tax_effect($od_amount) { global $order; if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') { $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = 0; $tax_rate = tep_get_tax_rate($key); $net = ($tax_rate * $order->info['tax_groups'][$key]); if ($net > 0) { $god_amount = $this->calculate_discount($order->info['tax_groups'][$key]); $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } else { $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = 0; $tax_rate = tep_get_tax_rate($key); $net = ($tax_rate * $order->info['tax_groups'][$key]); if ($net>0) { $god_amount = ($tax_rate/100)*$od_amount; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } return $tod_amount; } function get_order_total() { global $order; $order_total = $order->info['total']; if ($this->include_tax == 'false') $order_total = ($order_total - $order->info['tax']); if ($this->include_shipping == 'false') $order_total = ($order_total - $order->info['shipping_cost']); return $order_total; } function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_QTY_DISCOUNT_STATUS'"); $this->check = mysql_num_rows($check_query); } return $this->check; } function keys() { return array('MODULE_QTY_DISCOUNT_STATUS', 'MODULE_QTY_DISCOUNT_SORT_ORDER', 'MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON', 'MODULE_QTY_DISCOUNT_RATE_TYPE', 'MODULE_QTY_DISCOUNT_RATES', 'MODULE_QTY_DISCOUNT_INC_SHIPPING', 'MODULE_QTY_DISCOUNT_INC_TAX', 'MODULE_QTY_DISCOUNT_CALC_TAX'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Quantity Discount', 'MODULE_QTY_DISCOUNT_STATUS', 'true', 'Do you want to enable the quantity discount module?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_QTY_DISCOUNT_SORT_ORDER', '2', 'Sort order of display.', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Disable If Coupon Used', 'MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON', 'true', 'Do you want to disable the quantity discount module if a discount coupon is being used by the user?', '6', '3','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Discount Rate Type', 'MODULE_QTY_DISCOUNT_RATE_TYPE', 'percentage', 'Choose the type of discount rate - percentage or flat rate', '6', '4','tep_cfg_select_option(array(\'percentage\', \'flat rate\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Discount Rates', 'MODULE_QTY_DISCOUNT_RATES', '10:5,20:10', 'The discount is based on the total number of items. Example: 10:5,20:10.. 10 or more items get a 5% or $5 discount; 20 or more items receive a 10% or $10 disount; depending on the rate type.', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Shipping', 'MODULE_QTY_DISCOUNT_INC_SHIPPING', 'false', 'Include Shipping in calculation', '6', '6', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Tax', 'MODULE_QTY_DISCOUNT_INC_TAX', 'false', 'Include Tax in calculation.', '6', '7','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Calculate Tax', 'MODULE_QTY_DISCOUNT_CALC_TAX', 'true', 'Bereken Tax on discounted amount.', '6', '8','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } }?>

Share this post


Link to post
Share on other sites

If you paste your PHP code inside tags (minus the *)[*code*] and [*/code*] then it will show up here as it does on your php page rather than all jumbled together ;)

 

I hava the same problem described below.. any clue ?

 

I have this module installed and wrks just fine. Also have the golden oldie Quantity Discounts http://www.oscommerc...y/contributions,1159

 

QTY discount has an option to disable it when a voucher is used. Doesn't seem to work with this contrib however. Does anyone have an idea how I can disable on of the two? I would prefer to hav the qty discount disabled when a coupon is used. See below for the code for ot_qty_discount.php.

 

Would really appreciate it when someone could help!

 

 

 

<?php/* $Id: ot_qty_discount.php,v 1.4 2004-08-22 dreamscape Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2004 Josh Dechant Protions Copyright © 2003 osCommerce Released under the GNU General Public License*/ class ot_qty_discount { var $title, $output; function ot_qty_discount() { $this->code = 'ot_qty_discount'; $this->title = MODULE_QTY_DISCOUNT_TITLE; $this->description = MODULE_QTY_DISCOUNT_DESCRIPTION; $this->enabled = MODULE_QTY_DISCOUNT_STATUS; $this->sort_order = MODULE_QTY_DISCOUNT_SORT_ORDER; $this->include_shipping = MODULE_QTY_DISCOUNT_INC_SHIPPING; $this->include_tax = MODULE_QTY_DISCOUNT_INC_TAX; $this->calculate_tax = MODULE_QTY_DISCOUNT_CALC_TAX; $this->output = array(); } function process() { global $order, $currencies, $ot_subtotal; $od_amount = $this->calculate_discount($this->get_order_total()); if ($this->calculate_tax == 'true') $tod_amount = $this->calculate_tax_effect($od_amount); if ($od_amount > 0) { if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') $title_ext = sprintf(MODULE_QTY_DISCOUNT_PERCENTAGE_TEXT_EXTENSION ,$this->calculate_rate($_SESSION['cart']->count_contents())); $this->deduction = $od_amount+$tod_amount; $this->output[] = array('title' => sprintf(MODULE_QTY_DISCOUNT_FORMATED_TITLE, $title_ext), 'text' => sprintf(MODULE_QTY_DISCOUNT_FORMATED_TEXT, $currencies->format($od_amount)), 'value' => $od_amount); $order->info['total'] -= $this->deduction; $order->info['tax'] -= $tod_amount; if ($this->sort_order < $ot_subtotal->sort_order) $order->info['subtotal'] -= $this->deduction; } } function calculate_discount($amount) { global $qty_discount, $order_total_array; $od_amount = 0; if ((MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON == 'true') && (isset($_SESSION['cc_id']))) return $od_amount; $qty_discount = $this->calculate_rate($_SESSION['cart']->count_contents()); if ($qty_discount > 0) { if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') { $od_amount = round((($amount*10)/10)*($qty_discount/100), 2); } else { $od_amount = round((($qty_discount*10)/10), 2); } } return $od_amount; } function calculate_rate($order_qty) { $discount_rate = split("[:,]" , MODULE_QTY_DISCOUNT_RATES); $size = sizeof($discount_rate); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_qty >= $discount_rate[$i]) { $qty_discount = $discount_rate[$i+1]; } } return $qty_discount; } function calculate_tax_effect($od_amount) { global $order; if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') { $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = 0; $tax_rate = tep_get_tax_rate($key); $net = ($tax_rate * $order->info['tax_groups'][$key]); if ($net > 0) { $god_amount = $this->calculate_discount($order->info['tax_groups'][$key]); $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } else { $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = 0; $tax_rate = tep_get_tax_rate($key); $net = ($tax_rate * $order->info['tax_groups'][$key]); if ($net>0) { $god_amount = ($tax_rate/100)*$od_amount; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } return $tod_amount; } function get_order_total() { global $order; $order_total = $order->info['total']; if ($this->include_tax == 'false') $order_total = ($order_total - $order->info['tax']); if ($this->include_shipping == 'false') $order_total = ($order_total - $order->info['shipping_cost']); return $order_total; } function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_QTY_DISCOUNT_STATUS'"); $this->check = mysql_num_rows($check_query); } return $this->check; } function keys() { return array('MODULE_QTY_DISCOUNT_STATUS', 'MODULE_QTY_DISCOUNT_SORT_ORDER', 'MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON', 'MODULE_QTY_DISCOUNT_RATE_TYPE', 'MODULE_QTY_DISCOUNT_RATES', 'MODULE_QTY_DISCOUNT_INC_SHIPPING', 'MODULE_QTY_DISCOUNT_INC_TAX', 'MODULE_QTY_DISCOUNT_CALC_TAX'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Quantity Discount', 'MODULE_QTY_DISCOUNT_STATUS', 'true', 'Do you want to enable the quantity discount module?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_QTY_DISCOUNT_SORT_ORDER', '2', 'Sort order of display.', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Disable If Coupon Used', 'MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON', 'true', 'Do you want to disable the quantity discount module if a discount coupon is being used by the user?', '6', '3','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Discount Rate Type', 'MODULE_QTY_DISCOUNT_RATE_TYPE', 'percentage', 'Choose the type of discount rate - percentage or flat rate', '6', '4','tep_cfg_select_option(array(\'percentage\', \'flat rate\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Discount Rates', 'MODULE_QTY_DISCOUNT_RATES', '10:5,20:10', 'The discount is based on the total number of items. Example: 10:5,20:10.. 10 or more items get a 5% or $5 discount; 20 or more items receive a 10% or $10 disount; depending on the rate type.', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Shipping', 'MODULE_QTY_DISCOUNT_INC_SHIPPING', 'false', 'Include Shipping in calculation', '6', '6', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Tax', 'MODULE_QTY_DISCOUNT_INC_TAX', 'false', 'Include Tax in calculation.', '6', '7','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Calculate Tax', 'MODULE_QTY_DISCOUNT_CALC_TAX', 'true', 'Bereken Tax on discounted amount.', '6', '8','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } }?>


~Tracy
 

Share this post


Link to post
Share on other sites

I just tried the first two refresh scripts. the first one redirected to the index page. the second one did not work.

 

Just a little more info on the coupon code refresh problem as well:

 

once the user logs in and refreshes the confirmation page and the coupon shows up, if they then go back to shopping add products and do the checkout procedure again the coupon code works perfectly no refresh needed (with the updated amount too because new products were added and I am using a %age base coupon).

 

I'm pretty sure that can be indicative of where the problem lies but I am not familiar enough with either oscommerce or DCC code to be able to say where.

 

I would much rather have this work properly then use a refresh page script obviously so just trying to provide as much info as I can.

Did you give option 3 a go?

Also option two must be called from an onload event. I forgot to mention that, sorry.

Edited by jsalis

I run a completely customized osC2.2 RC1 shop with mostly custom modifications that replicate the features of many contributions available except in a way that the data is more easily synced with Quickbooks on a continuous basis.

Share this post


Link to post
Share on other sites

Did you give option 3 a go?

Also option two must be called from an onload event. I forgot to mention that, sorry.

 

I gave a few other options I found around the internet a go. the ones that worked always lead me back to login.php and after logging in to the cart which show it empty.

 

I think this could be an indication of where the problem lies.

Share this post


Link to post
Share on other sites

I have a rather strange problem with this contribution. I installed it, it was working (kind of).. it would calculate the correct discount, but the total was never shown correctly. i.e, if the items cost $10 it would show Items $10.. Discount $1... Shipping $5, total $15

But, if the buyer checked out and went to paypal ipn (yes I added the paypal ipn fixes) they would pay the correct total which was $14, but nowhere does the saved order show any coupon discount.. so, I thought maybe it had something to do with the order total, so I went in and made sure the discount coupon had a sort order number, but as soon as I did that... now the order always shows $0.00 for the total. It will have correct amounts in there.. but no total. So, I figured if I just set the sort order back to the default of 0 it might fix it back to the way it was.. but no, now no matter what I do, when I coupon code is used the order total is shown as $0.00

I am not sure what has gone wrong, I didnt change anything else, no php files, or anything, only the sort order for discount coupon in admin which I have since changed back with no effect.

I have no choice now but to disable coupons until I can figure out what has gone wrong. Any help would be appreciated.

Share this post


Link to post
Share on other sites

I have a rather strange problem with this contribution. I installed it, it was working (kind of).. it would calculate the correct discount, but the total was never shown correctly. i.e, if the items cost $10 it would show Items $10.. Discount $1... Shipping $5, total $15

But, if the buyer checked out and went to paypal ipn (yes I added the paypal ipn fixes) they would pay the correct total which was $14, but nowhere does the saved order show any coupon discount.. so, I thought maybe it had something to do with the order total, so I went in and made sure the discount coupon had a sort order number, but as soon as I did that... now the order always shows $0.00 for the total. It will have correct amounts in there.. but no total. So, I figured if I just set the sort order back to the default of 0 it might fix it back to the way it was.. but no, now no matter what I do, when I coupon code is used the order total is shown as $0.00

I am not sure what has gone wrong, I didnt change anything else, no php files, or anything, only the sort order for discount coupon in admin which I have since changed back with no effect.

I have no choice now but to disable coupons until I can figure out what has gone wrong. Any help would be appreciated.

 

I thought I would add, that if I disable the coupon discount, or if I just don't enter a coupon code.. there are no problems with the total, it shows correctly.

Here are the order confirmation screens with and without a coupon for same item.

 

With Coupon:

Products (Edit)

1 x Dollar Bling Cap $9.00

Discount Coupon BQ9Z4L applied: -$0.90

Sub-Total: $8.10

AusPOST Parcel Post (Delivery to 6030 - 1 days Estimated Delivery Time*NO INSURANCE COVERAGE AGAINST LOSS OR DAMAGE

1 boxes 0.2kg(s)): $3.95

Total: $0.00

 

 

Without Coupon:

 

Products (Edit)

1 x Dollar Bling Cap $9.00

Sub-Total: $9.00

AusPOST Parcel Post (Delivery to 6030 - 1 days Estimated Delivery Time*NO INSURANCE COVERAGE AGAINST LOSS OR DAMAGE

1 boxes 0.2kg(s)): $3.95

Total: $12.95

Share this post


Link to post
Share on other sites

I thought I would add, that if I disable the coupon discount, or if I just don't enter a coupon code.. there are no problems with the total, it shows correctly.

Here are the order confirmation screens with and without a coupon for same item.

 

With Coupon:

Products (Edit)

1 x Dollar Bling Cap $9.00

Discount Coupon BQ9Z4L applied: -$0.90

Sub-Total: $8.10

AusPOST Parcel Post (Delivery to 6030 - 1 days Estimated Delivery Time*NO INSURANCE COVERAGE AGAINST LOSS OR DAMAGE

1 boxes 0.2kg(s)): $3.95

Total: $0.00

 

 

Without Coupon:

 

Products (Edit)

1 x Dollar Bling Cap $9.00

Sub-Total: $9.00

AusPOST Parcel Post (Delivery to 6030 - 1 days Estimated Delivery Time*NO INSURANCE COVERAGE AGAINST LOSS OR DAMAGE

1 boxes 0.2kg(s)): $3.95

Total: $12.95

 

Well, stranger things have happened.. Just for kicks, I figured the problem was in that section near the bottom of \classes\order.php

where you add these lines

//kgt - discount coupon

if( is_object( $this->coupon ) ) {

$this->info['total'] = $this->coupon->finalize_discount( $this->info );

}

//end kgt - discount coupon

 

I commented out those lines and by some miracle, the calculations and total are all correct now. Go figure

Share this post


Link to post
Share on other sites

I am working on some development for this contribution, but don't see where the number of times a specific customer has used a given coupon is stored. This feature allowed me to use a coupon 4 times that had a max use of 2 then on my fifth attempt is threw and error message stating that I had used the coupon 4 times and I am only allow 2 times, so I cannot use it again. I want to clean that up, before releasing my contribution to this module, but I don't see any db fields that would store such data. Can anyone point me in the right direction?


I run a completely customized osC2.2 RC1 shop with mostly custom modifications that replicate the features of many contributions available except in a way that the data is more easily synced with Quickbooks on a continuous basis.

Share this post


Link to post
Share on other sites

Just installed this Ad-On and it worked well, however now when I try to log in to my admin page to check for orders and stuff it says:

 

Not Found

The requested URL /osCommerce/catalog/admin/FILENAME_LOGIN was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

 

Kind of new to this...any help would be appreciated.

 

 

 

***I HAAVE NOW BEEN LOCKED OUT OF MY ADMIN PAGE BECAUSE OF THIS ERROR, DESPERATELY NEED TO GET IN**** ANY HELP WOULD BE WONDERFUL. THANKS!!

Share this post


Link to post
Share on other sites

***I HAAVE NOW BEEN LOCKED OUT OF MY ADMIN PAGE BECAUSE OF THIS ERROR, DESPERATELY NEED TO GET IN**** ANY HELP WOULD BE WONDERFUL. THANKS!!

This contribution has nothing to do with the catalog/admin/login.php page has nothing to do with this contribution. I suspect however that your catalog/admin/includes/configure.php file is not correct. Try to navigate directly to login url for your store http://yourstore.com/catalog/admin/login.php for example and see what happens. If you do not get a 404 take a look at your catalog/admin/includes/configure.php file and see if any thing is messed up in there as far as the directory constants are concerned. Another place to look is filenames.php file, as it is entirely possible that the FILENAME_LOGIN constant is not properly defined. If you do get a 404 however, then ftp in and see if the login.php files is even present on the server.

From the message you provided I suspect that filenames.php and/or the configure.php file(s) have some constants not correctly defined and specifically the FILENAME_LOGIN constant simply isn't defined at all. Do tell what you find out.

-Jason


I run a completely customized osC2.2 RC1 shop with mostly custom modifications that replicate the features of many contributions available except in a way that the data is more easily synced with Quickbooks on a continuous basis.

Share this post


Link to post
Share on other sites

Hi there-

 

I have a new install of this contribution - eager to get it rockin - looks great!

 

I had to manually edit files, and have everything in place.

 

Two things not working quite right - thinking they are related.

In admin, when I try to edit, make new coupon, etc - not of that stuff, the buttons, do anything.

I cannot delete, create new, edit - nothing.

Also, in checkout, the test coupon that was the default - does nothing. Not working.

 

Been through the file edits twice. Actually three times, as I had a buddy help me do the same too - all three sets of files gave the same result.

 

Any ideas of where to start looking?

 

Thanks!

 

--Jeff

Share this post


Link to post
Share on other sites

Hello-

 

I have an urgent problem... any help is greatly appreciated!

 

I entered a discount code, but entered the wrong discount amount by accident. It is set to $0.30 instead of 30%. The coupon interface in the admin panel will not let me change anything on this coupon at all! I can edit all the older coupons, but not this one.

 

Does anyone know how I can unlock the edit features on this coupon? Do I have to change the amount in the SQL database?

 

Thanks in advance for any help!

Share this post


Link to post
Share on other sites

Hi,

 

Sorry posted a question in the general support section on this by mistake :-(

 

Has anyone got this working with single page checkout contribution yet ?

 

Thanks


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

Me again...

 

Fixed my previous problem, but got a new one: how do I get this to work when order_total is zero. Everything will do just fine untill it's payment time. checkout_confirmation.php will take you to my payment provider. This doesn't like zero amounts.

 

Anyone got an idea? Am I missing something?

 

Ciao,

Tom

Share this post


Link to post
Share on other sites

This isn't a Discount Coupons issue- it's an osC issue. There is a contribution that allows checkout with $0.00 amounts without needing payment information. (I forget the name of the contribution, but if you search through the contributions for zero dollar checkout you should find it). Hope that helps :)

 

Me again...

 

Fixed my previous problem, but got a new one: how do I get this to work when order_total is zero. Everything will do just fine untill it's payment time. checkout_confirmation.php will take you to my payment provider. This doesn't like zero amounts.

 

Anyone got an idea? Am I missing something?

 

Ciao,

Tom


~Tracy
 

Share this post


Link to post
Share on other sites

This should be editable. The only part of a coupon that is not editable is the actual coupon code. You should be able to simply delete the coupon and then re-create it, but I would also double check your code as something must not be right for this to be happening.

 

Hello-

 

I have an urgent problem... any help is greatly appreciated!

 

I entered a discount code, but entered the wrong discount amount by accident. It is set to $0.30 instead of 30%. The coupon interface in the admin panel will not let me change anything on this coupon at all! I can edit all the older coupons, but not this one.

 

Does anyone know how I can unlock the edit features on this coupon? Do I have to change the amount in the SQL database?

 

Thanks in advance for any help!


~Tracy
 

Share this post


Link to post
Share on other sites

Hi there-

 

Just giving the issue a bump... Any ideas on which file to examine?

Where to look?

 

I know something is wrong, but may be something in my customized store or...?

 

Thanks!

 

--Jeff

 

 

 

Hi there-

 

I have a new install of this contribution - eager to get it rockin - looks great!

 

I had to manually edit files, and have everything in place.

 

Two things not working quite right - thinking they are related.

In admin, when I try to edit, make new coupon, etc - not of that stuff, the buttons, do anything.

I cannot delete, create new, edit - nothing.

Also, in checkout, the test coupon that was the default - does nothing. Not working.

 

Been through the file edits twice. Actually three times, as I had a buddy help me do the same too - all three sets of files gave the same result.

 

Any ideas of where to start looking?

 

Thanks!

 

--Jeff

Share this post


Link to post
Share on other sites

I would do a file compare with a program like WinMerge just to make sure that you don't have some code in the wrong place on the page. Also, I might compare files with an older version of DCC to see if maybe something changed in a newer version that is then causing the problem.

 

What version of DCC are you using, and what version of osC are you running? Do you have other contributions installed?

 

Hi there-

 

Just giving the issue a bump... Any ideas on which file to examine?

Where to look?

 

I know something is wrong, but may be something in my customized store or...?

 

Thanks!

 

--Jeff


~Tracy
 

Share this post


Link to post
Share on other sites

I would do a file compare with a program like WinMerge just to make sure that you don't have some code in the wrong place on the page. Also, I might compare files with an older version of DCC to see if maybe something changed in a newer version that is then causing the problem.

 

What version of DCC are you using, and what version of osC are you running? Do you have other contributions installed?

 

Yep - running a couple of other contributions. SEO and Meta be two off the top of my head.

We ran those changes a few times - but seems odd that it won't properly let me administer them, and then I lose the code in checkout. I have a buddy who is a programmer helping me find the problem, but he's not that versed in Oscommerce.

 

Thanks!

 

--Jeff

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

×