Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

1) Hello, when i try to add an shipping zone exclusion, i have this message :

 

1136 - Column count doesn't match value count at row 1

 

INSERT INTO discount_coupons_to_zones VALUES

 

2) is it possible (if someone have already made the code) to add an payment method exclusion ???

i have try to make an adaptation of this code that i already have in another module but that don't work ... ?!? :

 

function exclude_payment()

{

global $order;

$od_payment = $order->info['payment_method'];

if($od_payment == 'PayPal')

return false;

else

return true;

}

 

function process() {

global $order, $ot_subtotal, $currencies;

$enabled = $this->exclude_payment();

$od_amount = $this->calculate_credit($this->get_order_total());

if ($od_amount>0) {

if($enabled)

{

$this->deduction = $od_amount;

$this->output[] = array('title' => $this->title . ':',

'text' => '<b>' . $currencies->format($od_amount) . '</b>',

'value' => $od_amount);

}

else

{

$od_amount = 0;

$this->output[] = array('title' => $this->title . ':',

'text' => '<b>Le paiment par Paypal ne donne pas droit à de réduction !</b>',

'value' => $od_amount);

}

 

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

if ($this->sort_order < $ot_subtotal->sort_order) {

$order->info['subtotal'] = $order->info['subtotal'] - $od_amount;

}

}

}

Edited by jblaise

Share this post


Link to post
Share on other sites

Hi there,

 

I've just installed Discount Coupon Codes but when I've come to test it - my discount code is generating the message:

 

"The minimum order total for this coupon is $20.00. Some or all of the products in your cart are excluded."

 

 

Now I've read Some of the other posts with regards to this and it seems people had exclusions within the discount rules.. but I've just checked on mine and there are no exclusions! Just wondering then if anyone has any suggestions on how to resolve this issue?

 

And just to clarify, the basket total is currently $26.96 and this 20% discount should be applicable to any conditions

 

Thanx In Advance,

 

Cleo

Share this post


Link to post
Share on other sites

I haven't had any issues with the percentage discounts (we mostly use percentage based discounts but they are 5-10% typically).

 

Double check the contribution files though to see if someone has had a fix for this issue - or do a google search. If you enter:

site:forums.oscommerce.com "Discount Coupon" +percentage

 

You should get search results only in the forums and only results that have both the phrase "discount coupon" and the word "percentage" in the result. This might help with pinpointing any other possible posts from people with a similar problem and maybe their fixes will be posted as well.

 

I found the answer on an earlier post. To prevent the discount being applied twice and have the subtotal show without the discount applied, in catalog/includes/classes/discount_coupon.php:

 

(around line 368) replace:

 

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) {
//we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax
$actual_shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
$applied_discount = 0;
}

 

with this:

 

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) {
//we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax
$actual_shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
$discount['applied_discount'] = 0;
}

 

'Display subtotal with discount applied' should be set to false.

 

My new problem:

 

Discount codes are working perfectly for 'fixed price' and 'shipping discounts'. I also tested different exclusions and it's functioning flawlessly. However 'percentage discounts' are miscalculated by up to $0.73 (customer is charged $0.73 more than he should have to pay based on discount percentage). I know the installation instructions say that small rounding errors may occur but I don't consider $0.73 to be a small error.

 

Has anyone else had this problem with wrong calculations for percentage discounts?

 

Tanja.


~Tracy
 

Share this post


Link to post
Share on other sites

Have you setup your shipping zones in Admin->Locations/Taxes->Tax Zones

 

This is where the shipping zones are setup - for example, you can create a zone named "US" and then put all of the countries in the United States into that zone - or you could create one big zone of "World" and put all countries into it. But you need to have a zone in order to check and see if that zone is allowed to use a coupon.

 

1) Hello, when i try to add an shipping zone exclusion, i have this message :

 

1136 - Column count doesn't match value count at row 1

 

INSERT INTO discount_coupons_to_zones VALUES

 

2) is it possible (if someone have already made the code) to add an payment method exclusion ???

i have try to make an adaptation of this code that i already have in another module but that don't work ... ?!? :

 

function exclude_payment()

{

global $order;

$od_payment = $order->info['payment_method'];

if($od_payment == 'PayPal')

return false;

else

return true;

}

 

function process() {

global $order, $ot_subtotal, $currencies;

$enabled = $this->exclude_payment();

$od_amount = $this->calculate_credit($this->get_order_total());

if ($od_amount>0) {

if($enabled)

{

$this->deduction = $od_amount;

$this->output[] = array('title' => $this->title . ':',

'text' => '<b>' . $currencies->format($od_amount) . '</b>',

'value' => $od_amount);

}

else

{

$od_amount = 0;

$this->output[] = array('title' => $this->title . ':',

'text' => '<b>Le paiment par Paypal ne donne pas droit à de réduction !</b>',

'value' => $od_amount);

}

 

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

if ($this->sort_order < $ot_subtotal->sort_order) {

$order->info['subtotal'] = $order->info['subtotal'] - $od_amount;

}

}

}


~Tracy
 

Share this post


Link to post
Share on other sites

I'd start by running a file comparison tool on your files vs the install files. There might be a misplaced bit of code or a missing character somewhere?

 

Hi there,

 

I've just installed Discount Coupon Codes but when I've come to test it - my discount code is generating the message:

 

"The minimum order total for this coupon is $20.00. Some or all of the products in your cart are excluded."

 

 

Now I've read Some of the other posts with regards to this and it seems people had exclusions within the discount rules.. but I've just checked on mine and there are no exclusions! Just wondering then if anyone has any suggestions on how to resolve this issue?

 

And just to clarify, the basket total is currently $26.96 and this 20% discount should be applicable to any conditions

 

Thanx In Advance,

 

Cleo


~Tracy
 

Share this post


Link to post
Share on other sites

the minimum order error~any help?

001.JPG

look is same coupon detail just different discount amount and type

but only the 1st one coupon will limited by exceed minimum order

002.JPG

and other 2 coupon even not meet the $300 requirement,

still applied the coupon, I found not post about this, need help

003.JPG

Edited by kenkenms

Share this post


Link to post
Share on other sites

 

work fine but one issue for me : to limit the use of coupons,

 

limit.gif

 

look at the screenshot, i set a limit of 1 use and 1 global coupon but i can use it with no limit !!!!

 

i've been looking the code for hours, and i don't understand why the limit can't work!!!

 

please help

 

 

thanks all

 

 

hi

 

same kind of problem for me... <_<


///

Share this post


Link to post
Share on other sites

First of all, great piece of work. Nice easy install, excluding a few parse erros... lol

 

OK, my issue: Scenario;

 

 

1 x EXPO-07 White - $14.99

Discount Coupon 1X995D applied: -$25.00

Sub-Total: $-10.01

United States Postal Service (1 x 2lbs) (Parcel Post): $4.90

Total: $0.00

 

 

The item is less than the coupon and the left over amount brings the Total to $0.00

which in turn gives and error

"This transaction cannot be processed. The amount to be charged is zero."

 

Is there a way to solve this? I don't care that there is a left over amount because I do not have

and credit balance installed to track this nor do I care that the coupon also is used for shipping. I just want it

to process so that I have some record in the customer account, deduct the item QTY and deduct the one time use

of the coupon.

 

Any suggestions?

:thumbsup:

Share this post


Link to post
Share on other sites

Hi guys!

 

I'm using a really old version of osCommerce which is a farsi version also, I have installed this module and works properly, the only problem is that order subtotal and total is calculated strange. Below is my order.php code:

 

<?php

/*

$Id: order.php,v 1.33 2003/06/09 22:25:35 hpdl Exp $

 

FarsiCommerce, Open Source E-Commerce

http://www.persianoc.com/

http://www.oscommerce.com/

 

Copyright © 2005-2006 FarsiCommerce

 

Released under the GNU General Public License

*/

 

defined('PROJECT_VERSION') or die('Access denied!');

 

class order {

var $info, $totals, $products, $customer, $delivery, $content_type;

 

function order($order_id = '') {

$this->info = array();

$this->totals = array();

$this->products = array();

$this->customer = array();

$this->delivery = array();

 

if (tep_not_null($order_id)) {

$this->query($order_id);

} else {

$this->cart();

}

}

 

function query($order_id) {

global $languages_id;

 

$order_id = tep_db_prepare_input($order_id);

 

$order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

$order = tep_db_fetch_array($order_query);

 

$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");

while ($totals = tep_db_fetch_array($totals_query)) {

$this->totals[] = array('title' => $totals['title'],

'text' => $totals['text']);

}

 

$order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'");

$order_total = tep_db_fetch_array($order_total_query);

 

$shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");

$shipping_method = tep_db_fetch_array($shipping_method_query);

 

$order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int)$languages_id . "'");

$order_status = tep_db_fetch_array($order_status_query);

 

$this->info = array('currency' => $order['currency'],

'currency_value' => $order['currency_value'],

'payment_method' => $order['payment_method'],

'cc_type' => $order['cc_type'],

'cc_owner' => $order['cc_owner'],

'cc_number' => $order['cc_number'],

'cc_expires' => $order['cc_expires'],

'date_purchased' => $order['date_purchased'],

'orders_status' => $order_status['orders_status_name'],

'last_modified' => $order['last_modified'],

'total' => strip_tags($order_total['text']),

'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])));

 

$this->customer = array('id' => $order['customers_id'],

'name' => $order['customers_name'],

'company' => $order['customers_company'],

'street_address' => $order['customers_street_address'],

'suburb' => $order['customers_suburb'],

'city' => $order['customers_city'],

'postcode' => $order['customers_postcode'],

'state' => $order['customers_state'],

'country' => $order['customers_country'],

'format_id' => $order['customers_address_format_id'],

'telephone' => $order['customers_telephone'],

'email_address' => $order['customers_email_address']);

 

$this->delivery = array('name' => $order['delivery_name'],

'company' => $order['delivery_company'],

'street_address' => $order['delivery_street_address'],

'suburb' => $order['delivery_suburb'],

'city' => $order['delivery_city'],

'postcode' => $order['delivery_postcode'],

'state' => $order['delivery_state'],

'country' => $order['delivery_country'],

'format_id' => $order['delivery_address_format_id']);

 

if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {

$this->delivery = false;

}

 

$this->billing = array('name' => $order['billing_name'],

'company' => $order['billing_company'],

'street_address' => $order['billing_street_address'],

'suburb' => $order['billing_suburb'],

'city' => $order['billing_city'],

'postcode' => $order['billing_postcode'],

'state' => $order['billing_state'],

'country' => $order['billing_country'],

'format_id' => $order['billing_address_format_id']);

 

$index = 0;

$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'id' => $orders_products['products_id'],

'name' => $orders_products['products_name'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price']);

 

$subindex = 0;

$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

 

$this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';

 

$index++;

}

}

 

function cart() {

global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment;

 

$this->content_type = $cart->get_content_type();

 

$customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");

$customer_address = tep_db_fetch_array($customer_address_query);

 

$shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'");

$shipping_address = tep_db_fetch_array($shipping_address_query);

 

$billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'");

$billing_address = tep_db_fetch_array($billing_address_query);

 

$tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $billto : $sendto) . "'");

$tax_address = tep_db_fetch_array($tax_address_query);

 

$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,

'currency' => $currency,

'currency_value' => $currencies->currencies[$currency]['value'],

'payment_method' => $payment,

'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),

'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),

'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),

'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),

'shipping_method' => $shipping['title'],

'shipping_cost' => $shipping['cost'],

'subtotal' => 0,

'tax' => 0,

'tax_groups' => array(),

'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));

 

if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {

$this->info['payment_method'] = $GLOBALS[$payment]->title;

 

if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {

$this->info['order_status'] = $GLOBALS[$payment]->order_status;

}

}

 

$this->customer = array('firstname' => $customer_address['customers_firstname'],

'lastname' => $customer_address['customers_lastname'],

'company' => $customer_address['entry_company'],

'street_address' => $customer_address['entry_street_address'],

'suburb' => $customer_address['entry_suburb'],

'city' => $customer_address['entry_city'],

'postcode' => $customer_address['entry_postcode'],

'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),

'zone_id' => $customer_address['entry_zone_id'],

'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']),

'format_id' => $customer_address['address_format_id'],

'telephone' => $customer_address['customers_telephone'],

'email_address' => $customer_address['customers_email_address']);

 

$this->delivery = array('firstname' => $shipping_address['entry_firstname'],

'lastname' => $shipping_address['entry_lastname'],

'company' => $shipping_address['entry_company'],

'street_address' => $shipping_address['entry_street_address'],

'suburb' => $shipping_address['entry_suburb'],

'city' => $shipping_address['entry_city'],

'postcode' => $shipping_address['entry_postcode'],

'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),

'zone_id' => $shipping_address['entry_zone_id'],

'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']),

'country_id' => $shipping_address['entry_country_id'],

'format_id' => $shipping_address['address_format_id']);

 

$this->billing = array('firstname' => $billing_address['entry_firstname'],

'lastname' => $billing_address['entry_lastname'],

'company' => $billing_address['entry_company'],

'street_address' => $billing_address['entry_street_address'],

'suburb' => $billing_address['entry_suburb'],

'city' => $billing_address['entry_city'],

'postcode' => $billing_address['entry_postcode'],

'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),

'zone_id' => $billing_address['entry_zone_id'],

'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']),

'country_id' => $billing_address['entry_country_id'],

'format_id' => $billing_address['address_format_id']);

 

$index = 0;

$products = $cart->get_products();

//kgt - discount coupons

global $coupon;

if( tep_session_is_registered( 'coupon' ) && tep_not_null( $coupon ) ) {

require_once( DIR_WS_CLASSES.'discount_coupon.php' );

$this->coupon = new discount_coupon( $coupon, $this->delivery );

$this->coupon->total_valid_products( $products );

$valid_products_count = 0;

}

//end kgt - discount coupons

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

$this->products[$index] = array('qty' => $products[$i]['quantity'],

'name' => $products[$i]['name'],

'model' => $products[$i]['model'],

'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),

'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),

'price' => $products[$i]['price'],

'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),

'weight' => $products[$i]['weight'],

'id' => $products[$i]['id']);

 

if ($products[$i]['attributes']) {

$subindex = 0;

reset($products[$i]['attributes']);

while (list($option, $value) = each($products[$i]['attributes'])) {

$attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

 

$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],

'value' => $attributes['products_options_values_name'],

'option_id' => $option,

'value_id' => $value,

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

 

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

 

//kgt - discount coupon

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

$applied_discount = 0;

$applied_discount = $this->coupon->calculate_discount( $this->products[$index], $valid_products_count );

if( $applied_discount > 0 ) $valid_products_count++;

$shown_price = $this->coupon->calculate_shown_price( $applied_discount, $this->products[$index] );

$this->info['subtotal'] += $shown_price['shown_price'];

$shown_price = $shown_price['actual_shown_price'];

} else {

$shown_price = tep_add_tax($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 coupon

 

 

$products_tax = $this->products[$index]['tax'];

$products_tax_description = $this->products[$index]['tax_description'];

if (DISPLAY_PRICE_WITH_TAX == 'true') {

$this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

if (isset($this->info['tax_groups']["$products_tax_description"])) {

$this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

} else {

$this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

}

} else {

$this->info['tax'] += ($products_tax / 100) * $shown_price;

if (isset($this->info['tax_groups']["$products_tax_description"])) {

$this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;

} else {

$this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price;

}

}

 

$index++;

}

 

if (DISPLAY_PRICE_WITH_TAX == 'true') {

$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];

} else {

$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];

}

//kgt - discount coupon

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

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

}

//end kgt - discount coupon

}

}

?>

 

Thanks in advance ...

Share this post


Link to post
Share on other sites

I've also noticed that when a customer adds more than one item in their cart, the coupon code box does not

show on checkout_confirmation page.

 

Am I missing something here? Sorting, coding, etc?

 

Any help would be appreciated.... Thanks

Share this post


Link to post
Share on other sites

The error is happening because stock osc is not setup to handle $0.00 orders. There is a contribution you can install to allow $0.00 orders and not request credit card information for those orders. Then your store should have no problem allowing the order to continue after the coupon drops it to $0.00 :-)

 

First of all, great piece of work. Nice easy install, excluding a few parse erros... lol

 

OK, my issue: Scenario;

 

 

1 x EXPO-07 White - $14.99

Discount Coupon 1X995D applied: -$25.00

Sub-Total: $-10.01

United States Postal Service (1 x 2lbs) (Parcel Post): $4.90

Total: $0.00

 

 

The item is less than the coupon and the left over amount brings the Total to $0.00

which in turn gives and error

"This transaction cannot be processed. The amount to be charged is zero."

 

Is there a way to solve this? I don't care that there is a left over amount because I do not have

and credit balance installed to track this nor do I care that the coupon also is used for shipping. I just want it

to process so that I have some record in the customer account, deduct the item QTY and deduct the one time use

of the coupon.

 

Any suggestions?

:thumbsup:


~Tracy
 

Share this post


Link to post
Share on other sites

The error is happening because stock osc is not setup to handle $0.00 orders. There is a contribution you can install to allow $0.00 orders and not request credit card information for those orders. Then your store should have no problem allowing the order to continue after the coupon drops it to $0.00 :-)

 

Thanks Tracy..... Would you happen to know that contrib name? Have done a few searches to no avail..

 

Appreciate the response.....

Share this post


Link to post
Share on other sites

I was considering adding the coupon code feature but all I can see if problems with recent implementations.

 

The smartass response about a crystal ball is totally useless. It takes lots more than a crystal ball for the poor dumb users to try to implement an addon like this. This feature may at one time have worked, but the most recent add-ons page [http://addons.oscommerce.com/info/4269] has an auto-installer from 30June; then a 9-July mod that references something from 21 March09 and most recently a revision to a single file that was made on 5-October. How is anyone supposed to figure what version of all this stuff is the one that might work on their shop?

 

If kristapasnak hadn't spent 5 or 10 hours implementing this change and trying to figure out what was wrong, they wouldn't have asked for help. I'm sure it will be a long time before they ask for help again, if all they get is their chops busted for trying.

 

If you realy want to be helpful, then fix the app and put a full package online, so that we don't need to be mindreaders to figure out which pieces to use and which to ignore. It's too late for CLEES4005 (4Nov09), who installed all this stuff and now can't even get into her admin panel.

 

I'll wait a few months until someone clears this up before considering implementation of this feature.

 

Thanks John....Couldn't have said it better.

 

We are all here to help work through issues and to be bashed like an idiot, this doesn't say much for the know-it-alls that come back and say this kind of stuff. It doesn't matter if the person needing help is a novice or expert, when help is needed, this is what this forum is for.

 

To the brow beaters, don't bash someone's request for help with "you should have done this or that"! Offer a solution or don't say anything because you only show your ignorance and machonism when you talk out of you backside. If you cannot offer assistance, then please just ignore the forums and go hide in your perfect little world and leave the space you take for the ones who really care to help....

 

BTW, to all that really do offer help in this forum, KUDOS to you all. We all do appreciate your help even though some do not say it. I'm sure you do it because you love to help and care about the ones who at least try.

Share this post


Link to post
Share on other sites

Hello

 

Has anybody out there managed to rewrite this contribution to get it to work with Barclays EPDQ payment module please?

Share this post


Link to post
Share on other sites

Hello everyone!

 

I have a problem with this contribution, I have been asked to gather all orders that were created using a discount coupon but I have realised that discount_coupons_to_orders table is empty.

 

I am trying to solve this but I don't know where the function is that saves the data to this table when an order is made.

 

Any help to resolve this problem would be much appreciated as it's a top priority!

Share this post


Link to post
Share on other sites

Hello everyone!

 

I have a problem with this contribution, I have been asked to gather all orders that were created using a discount coupon but I have realised that discount_coupons_to_orders table is empty.

 

I am trying to solve this but I don't know where the function is that saves the data to this table when an order is made.

 

Any help to resolve this problem would be much appreciated as it's a top priority!

 

 

Make sure if you have attributes for products that they show up in order confirmation page. I have the same problem when I sold an item and went to see what size they purchased. Was nowhere to be found. I don't think this has anything to do with coupons but it may. If you find out why your shopping cart is not passing data to the database, please let me know as we could have the same issue

 

Thanks

Share this post


Link to post
Share on other sites

Hi,

 

I've just installed this contribution, looked like just what I need.

The installation went fine I think, I have enabled the module in modules/order total.

 

I don't get the option for creating coupon codes under 'catalog' in my admin though!!! Rather vital.

 

Does anyone have an idea what I have done wrong?

I have the shop in dutch btw and have added all extra lines from english.php to my dutch.php in admin/includes/languages.

 

Help appreciated, TIA, best regards,

 

Wiljo

Share this post


Link to post
Share on other sites

Hi,

 

I've just installed this contribution, looked like just what I need.

The installation went fine I think, I have enabled the module in modules/order total.

 

I don't get the option for creating coupon codes under 'catalog' in my admin though!!! Rather vital.

 

Does anyone have an idea what I have done wrong?

I have the shop in dutch btw and have added all extra lines from english.php to my dutch.php in admin/includes/languages.

 

Help appreciated, TIA, best regards,

 

Wiljo

 

Double check all the files and make sure they are in the correct directories.

 

What places the option is catalog/admin/coupons.php If this is not in your folder, it will not show.

 

Not a programmer but have installed this. If you get it working, let me know if your attributes show on your

order confirmation page and email notification. Mine seems to have lost their way and do not populate from shopping

cart to the order confirmation

 

Serious issue because if they are not on your order confirmation, they do not get placed into the database, therfore

rendering after sale lookup or edits, inoperable. At least this is what has happened to me.

 

Good luck with your install. Sorry not to be much help.

Share this post


Link to post
Share on other sites

I have just installed too and in my admin panle under modules I am seeing this $heading = array(); $contents = array(); $heading[] = array('text' => BOX_HEADING_CUSTOMERS, 'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers')); if ($selected_box == 'customers') { $contents[] = array('text' => '' . BOX_CUSTOMERS_CUSTOMERS . '

' . '' . BOX_CUSTOMERS_ORDERS . ''); $box = new box; echo $box->menuBox($heading, $contents); ?>

 

Any ideas?

Share this post


Link to post
Share on other sites

also my customers section in admin panel has dissappeaed??

 

Not a programmer but it seems like this was installed wrong.

 

Even when installed correctly, doesn't mean the code written is correct.

 

Best way to make sure that the mod is installed at least correctly is to

get something like Winmerge editor and compare files so that you can merge each mod

smoothly. At least when you do it this way, usually this type of code you are seeing

is not shown in your admin area or main display.

 

Definately appears that something is not installed correctly. You can also backup your

original files and use a fresh install of OSC and just copy over most files without

merging them just to see if the mod is written correctly and works with fresh install.

Then if it does, take this new install and modify files to get it to look like your

original store.

 

Mod are no fun to install and even the ones who know coding have issues at times.

Good luck with your journey and hope someone else can be better assistance with your

issue. Doesn't seem that many help on this contrib anymore.....

Share this post


Link to post
Share on other sites

Hi,

 

I've just finish installing this addon...but i've noticed that my order total or sub-total is doubled than the total product's price. I'm not sure what went wrong and i'm new to this.

 

I was wondering if anyone could give me a hand on this?

 

thank you.

Share this post


Link to post
Share on other sites

Coupon shows unlimited in the Available column in admin even though the quantity is set to 0.

 

Customers uses coupon code and tries to use again, and they can't.

Different customer logs in and uses different email address SAME code and it applies the credit.

 

Not sure but could this be due to the admin showing the coupon unlimited even though

I click edit and the quantity shows 0? If I click edit on the coupon and change to an active

number, the admin shows that number but when set back to 0 it shows Unlimited Available again

and different customers can use the same code.

Share this post


Link to post
Share on other sites

I've also noticed that when a customer adds more than one item in their cart, the coupon code box does not

show on checkout_confirmation page.

 

Am I missing something here? Sorting, coding, etc?

 

Any help would be appreciated.... Thanks

 

Fixed!! Ended up replacing checkout_process.php clean then re-added all mods to it.

 

Still issues with coupon codes being used by more than one email address at checkout.

One email address uses lets say 1z334x. If another user or same user logs in with different

email address, the coupon can be used again.

 

Look in admin and the first coupon transaction deducted the qty but then displays

UNLIMITED. How strange ist that? If I edit the coupon qty to zero, only shows UNLIMITED.

Change it to any other number and it is fine. Serious issue!

 

Have checked and read more than I cared to but could not find any issues like this in hundreds of posts.

 

Any help with this mod?

Edited by beanzy

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

×