Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Class/Gift Vouchers/Discount Coupons 5.10


Strider

Recommended Posts

Hello All,

Well this contribution is amazing, and amazingly FUBAR. I would like to thank JimbobobHacker2 For his latest posts to the contribution page. However the instructions there specifically for the Jan 28th fixes seem incomplete.

1) Remove illogical condition.

file: catalog/checkout_payment.php

line: if (MODULE_ORDER_TOTAL_INSTALLED)

action: remove this line

How ever if you check that page there are two instances of

if (MODULE_ORDER_TOTAL_INSTALLED)
one on line 166 and one on line 307. It seems that the first instance is incorrect and that the second is. So I left the second one there.

Would JimbobobHacker2 or anyone else care to comment?

Thanks

Christian

Edited by christiansees

On your last day only you will have to approve or disaprove of how your life has been.

Link to comment
Share on other sites

  • Replies 4.8k
  • Created
  • Last Reply

Top Posters In This Topic

Hi all,

 

just posted my first contribution (v1 and v1.1) to the contribution page:

 

 

bunch of fixes v1.1 (table/roundoff/etc.)

 

v1.1 of my fixes instructions

 

This is for CCGV5.16, and is NOT the entire package, just a text file with revised instructions. (this instruction file replaces the original one)

 

NEW: add missing define in language file

NEW: align redeem button to input text field

 

0) add define for IMAGE_REDEEM_VOUCHER

 

1) fix the misalignment of the gift voucher/coupon code redeem table. including alignment of input field to redeem button image.

 

2) eliminate the checking of credit card info when the redeem button is pressed. i.e. redeem without entering credit card info, which is anyway erased after redeeming the coupon code.

 

3) move the gift voucher/coupon code table above the credit card table

 

4) fix round off errors in subtracting coupon value

 

5) checkout_confirmation.php does not pass coupon code to checkout_process.php

 

 

Hope this helps someone. this was not an easy contribution to install on a very highly customized/modified version of osCommerce...

 

Hello All,

 

This is my first post, so I apologize in advance if I have not formatted this question correctly. I am trying to accomplish 3) in Aviram's post above. My store is a bit modified, and I am not a programmer. When looking at the code below, does anyone have a solution to this?

 

The origin of my problem is this: My coupon redeem box is below the credit card box. A customer fills out all the credit card information, only to have it erased once a coupon is redeemed. From my understanding of the previous posts, simply placing the coupon redemption box above the credit card box will solve this.

 

All this is causing my customers confusion and I am losing people in the shopping cart. All this is causing me to lose what little business I have left.

 

Many thanks in advance,

 

Burt

 

<?php

/*

$Id: ot_coupon.php,v 1.4 2004/03/09 17:56:06 ccwjr Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class ot_coupon {

var $title, $output;

 

function ot_coupon() {

 

$this->code = 'ot_coupon';

$this->header = MODULE_ORDER_TOTAL_COUPON_HEADER;

$this->title = MODULE_ORDER_TOTAL_COUPON_TITLE;

$this->description = MODULE_ORDER_TOTAL_COUPON_DESCRIPTION;

$this->user_prompt = '';

$this->enabled = MODULE_ORDER_TOTAL_COUPON_STATUS;

$this->sort_order = MODULE_ORDER_TOTAL_COUPON_SORT_ORDER;

$this->include_shipping = MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING;

$this->include_tax = MODULE_ORDER_TOTAL_COUPON_INC_TAX;

$this->calculate_tax = MODULE_ORDER_TOTAL_COUPON_CALC_TAX;

$this->tax_class = MODULE_ORDER_TOTAL_COUPON_TAX_CLASS;

$this->credit_class = true;

$this->output = array();

 

}

 

function process() {

global $PHP_SELF, $order, $currencies, $cc_id;

 

$order_total=$this->get_order_total();

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

$tod_amount = 0.0; //Fred

$this->deduction = $od_amount;

if ($this->calculate_tax != 'None') { //Fred - changed from 'none' to 'None'!

$tod_amount = $this->calculate_tax_deduction($order_total, $this->deduction, $this->calculate_tax);

}

 

if ($od_amount > 0) {

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

$this->output[] = array('title' => $this->title . ':' . $this->coupon_code .':','text' => '<b>-' . $currencies->format($od_amount) . '</b>', 'value' => $od_amount); //Fred added hyphen

}

}

 

function selection_test() {

return false;

}

 

 

function pre_confirmation_check($order_total) {

global $customer_id;

return $this->calculate_credit($order_total);

}

 

function use_credit_amount() {

return $output_string;

}

 

/*

function credit_selection() {

global $customer_id, $currencies, $language;

$selection_string = '';

$selection_string .= '<tr>' . "\n";

$selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>';

$selection_string .= ' <td class="main">' . "\n";

$image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . DIR_WS_TEMPLATES . TEMPLATE_NAME . '/images/buttons/' . $language . '/button_redeem.gif" border="0" alt="' . IMAGE_REDEEM_VOUCHER . '" title = "' . IMAGE_REDEEM_VOUCHER . '">';

$selection_string .= TEXT_ENTER_COUPON_CODE . tep_draw_input_field('gv_redeem_code') . '</td>';

$selection_string .= ' <td align="right">' . $image_submit . '</td>';

$selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';

$selection_string .= '</tr>' . "\n";

return $selection_string;

}

*/

function credit_selection() {

global $customer_id, $currencies, $language;

$selection_string2 = '';

$selection_string2 .= '<tr>' . "\n";

$selection_string2 .= '<td class="main">' . "\n";

$selection_string2 .= TEXT_ENTER_GV_CODE . tep_draw_input_field('gv_redeem_code') . ' and click ';

$image_submit2 = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . DIR_WS_TEMPLATES . TEMPLATE_NAME . '/images/buttons/' . $language . '/button_redeem.gif" border="0" alt="' . IMAGE_REDEEM_VOUCHER . '" title = "' . IMAGE_REDEEM_VOUCHER . '">';

$selection_string2 .= ' </td><td align="right">' . $image_submit2 . '</td>';

$selection_string2 .= '</tr>' . "\n";

return $selection_string2;

}

 

function collect_posts() {

global $HTTP_POST_VARS, $customer_id, $currencies, $cc_id;

if ($HTTP_POST_VARS['gv_redeem_code']) {

 

// get some info from the coupon table

$coupon_query=tep_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_COUPONS . " where coupon_code='".tep_db_input($HTTP_POST_VARS['gv_redeem_code'])."' and coupon_active='Y'");

$coupon_result=tep_db_fetch_array($coupon_query);

 

if ($coupon_result['coupon_type'] != 'G') {

 

if (tep_db_num_rows($coupon_query)==0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_INVALID_REDEEM_COUPON), 'SSL'));

}

 

$date_query=tep_db_query("select coupon_start_date from " . TABLE_COUPONS . " where coupon_start_date <= now() and coupon_code='".tep_db_input($HTTP_POST_VARS['gv_redeem_code'])."'");

 

if (tep_db_num_rows($date_query)==0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_STARTDATE_COUPON), 'SSL'));

}

 

$date_query=tep_db_query("select coupon_expire_date from " . TABLE_COUPONS . " where coupon_expire_date >= now() and coupon_code='".tep_db_input($HTTP_POST_VARS['gv_redeem_code'])."'");

 

if (tep_db_num_rows($date_query)==0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_FINISDATE_COUPON), 'SSL'));

}

 

$coupon_count = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."'");

$coupon_count_customer = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."' and customer_id = '" . $customer_id . "'");

 

if (tep_db_num_rows($coupon_count)>=$coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_COUPON . $coupon_result['uses_per_coupon'] . TIMES ), 'SSL'));

}

 

if (tep_db_num_rows($coupon_count_customer)>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_user'] . TIMES ), 'SSL'));

}

 

/*

if ($coupon_result['coupon_type']=='S') {

$coupon_amount = $order->info['shipping_cost'];

} else {

$coupon_amount = $currencies->format($coupon_result['coupon_amount']) . ' ';

}

if ($coupon_result['coupon_type']=='P') $coupon_amount = $coupon_result['coupon_amount'] . '% ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount .= 'on orders greater than ' . $coupon_result['coupon_minimum_order'];

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id'); //Fred - this was commented out before

$cc_id = $coupon_result['coupon_id']; //Fred ADDED, set the global and session variable

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT), 'SSL')); // Added in v5.13a by Rigadin

*/

global $order,$ot_coupon,$currency,$cc_id;

 

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

$cc_id = $coupon_result['coupon_id'];

 

$coupon_amount= tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places']); // $cc_id

 

/* you will need to uncomment this if your tax order total module is AFTER shipping eg you have all of your tax, including tax from shipping module, in your tax total.

if ($coupon_result['coupon_type']=='S') {

//if not zero rated add vat to shipping

$coupon_amount = tep_add_tax($coupon_amount, '17.5');

}

*/

$coupon_amount_out = $currencies->format($coupon_amount) . ' ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount_out .= 'on orders greater than ' . $currencies->format($coupon_result['coupon_minimum_order']);

 

if ( strlen($cc_id) > 0 && $coupon_amount == 0 ) {

$err_msg = ERROR_REDEEMED_AMOUNT_ZERO;

} else {

$err_msg = ERROR_REDEEMED_AMOUNT.$coupon_amount_out;

}

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode($err_msg), 'SSL'));

//**si** 09-11-05 end

 

// $_SESSION['cc_id'] = $coupon_result['coupon_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

} // ENDIF valid coupon code

} // ENDIF code entered

// v5.13a If no code entered and coupon redeem button pressed, give an alarm

if ($HTTP_POST_VARS['submit_redeem_coupon_x']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL'));

}

 

function calculate_credit($amount) {

global $customer_id, $order, $cc_id;

//$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

$od_amount = 0;

if (isset($cc_id) ) {

$coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");

if (tep_db_num_rows($coupon_query) !=0 ) {

$coupon_result = tep_db_fetch_array($coupon_query);

$this->coupon_code = $coupon_result['coupon_code'];

$coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS ." where coupon_code = '". $coupon_result['coupon_code'] . "'");

$get_result = tep_db_fetch_array($coupon_get);

$c_deduct = $get_result['coupon_amount'];

if ($get_result['coupon_type']=='S') $c_deduct = $order->info['shipping_cost'];

//v5.14 id coupon total > 0

if ($get_result['coupon_type']=='S') $c_deduct = $order->info['shipping_cost'];

if ($get_result['coupon_type']=='S' && $get_result['coupon_amount'] > 0 ) $c_deduct = $order->info['shipping_cost'] + $get_result['coupon_amount'];

if ($get_result['coupon_minimum_order'] <= $this->get_order_total()) {

if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {

for ($i=0; $i < sizeof($order->products); $i++) {

if ($get_result['restrict_to_products']) {

$pr_ids = split("[,]", $get_result['restrict_to_products']);

for ($ii = 0; $ii < count($pr_ids); $ii++) {

if ($pr_ids[$ii] == tep_get_prid($order->products[$i]['id'])) {

if ($get_result['coupon_type'] == 'P') {

/* Fixes to Gift Voucher module 5.03

=================================

Submitted by Rob Cote, [email protected]

original code:

$od_amount = round($amount*10)/10*$c_deduct/100;

$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

*/

//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

 

$pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

$od_amount = $od_amount + $pod_amount;

} else {

$od_amount = $c_deduct;

}

}

}

} else {

$cat_ids = split("[,]", $get_result['restrict_to_categories']);

for ($i=0; $i < sizeof($order->products); $i++) {

$my_path = tep_get_product_path(tep_get_prid($order->products[$i]['id']));

$sub_cat_ids = split("[_]", $my_path);

for ($iii = 0; $iii < count($sub_cat_ids); $iii++) {

for ($ii = 0; $ii < count($cat_ids); $ii++) {

if ($sub_cat_ids[$iii] == $cat_ids[$ii]) {

if ($get_result['coupon_type'] == 'P') {

/* Category Restriction Fix to Gift Voucher module 5.04

Date: August 3, 2003

=================================

Nick Stanko of UkiDev.com, [email protected]

original code:

$od_amount = round($amount*10)/10*$c_deduct/100;

$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

*/

//$od_amount = round($amount*10)/10*$c_deduct/100;

//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

 

$pr_c = $this->product_price(tep_get_prid($order->products[$i]['id'])); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

$od_amount = $od_amount + $pod_amount;

continue 3; // v5.13a Tanaka 2005-4-30: to prevent double counting of a product discount

} else {

$od_amount = $c_deduct;

continue 3; // Tanaka 2005-4-30: to prevent double counting of a product discount

}

}

}

}

}

} //endif $get_result['restrict_to_products']

} //end for sizeof($order->products)

} else {

if ($get_result['coupon_type'] !='P') {

$od_amount = $c_deduct;

} else {

$od_amount = $amount * $get_result['coupon_amount'] / 100;

}

}

}

}

if ($od_amount>$amount) $od_amount = $amount;

}

return $od_amount;

}

 

function calculate_tax_deduction($amount, $od_amount, $method) {

global $customer_id, $order, $cc_id, $cart;

//$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

$coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");

if (tep_db_num_rows($coupon_query) !=0 ) {

$coupon_result = tep_db_fetch_array($coupon_query);

$coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code = '". $coupon_result['coupon_code'] . "'");

$get_result = tep_db_fetch_array($coupon_get);

if ($get_result['coupon_type'] != 'S') {

 

//RESTRICTION--------------------------------

if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {

// What to do here.

// Loop through all products and build a list of all product_ids, price, tax class

// at the same time create total net amount.

// then

// for percentage discounts. simply reduce tax group per product by discount percentage

// or

// for fixed payment amount

// calculate ratio based on total net

// for each product reduce tax group per product by ratio amount.

$products = $cart->get_products();

$valid_product = false;

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

$valid_product = false;

$t_prid = tep_get_prid($products[$i]['id']);

$cc_query = tep_db_query("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");

$cc_result = tep_db_fetch_array($cc_query);

if ($get_result['restrict_to_products']) {

$pr_ids = split("[,]", $get_result['restrict_to_products']);

for ($p = 0; $p < sizeof($pr_ids); $p++) {

if ($pr_ids[$p] == $t_prid) $valid_product = true;

}

}

if ($get_result['restrict_to_categories']) {

// Tanaka 2005-4-30: Original Code

/*$cat_ids = split("[,]", $get_result['restrict_to_categories']);

for ($c = 0; $c < sizeof($cat_ids); $c++) {

// Tanaka 2005-4-30: changed $products_id to $t_prid and changed $i to $c

$cat_query = tep_db_query("select products_id from products_to_categories where products_id = '" . $t_prid . "' and categories_id = '" . $cat_ids[$c] . "'");

if (tep_db_num_rows($cat_query) !=0 ) $valid_product = true;

}*/

// v5.13a Tanaka 2005-4-30: New code, this correctly identifies valid products in subcategories

$cat_ids = split("[,]", $get_result['restrict_to_categories']);

$my_path = tep_get_product_path($t_prid);

$sub_cat_ids = split("[_]", $my_path);

for ($iii = 0; $iii < count($sub_cat_ids); $iii++) {

for ($ii = 0; $ii < count($cat_ids); $ii++) {

if ($sub_cat_ids[$iii] == $cat_ids[$ii]) {

$valid_product = true;

continue 2;

}

}

}

}

if ($valid_product) {

$price_excl_vat = $products[$i]['final_price'] * $products[$i]['quantity']; //Fred - added

$price_incl_vat = $this->product_price($t_prid); //Fred - added

$valid_array[] = array('product_id' => $t_prid, 'products_price' => $price_excl_vat, 'products_tax_class' => $cc_result['products_tax_class_id']); //jason //Fred - changed from $products[$i]['final_price'] 'products_tax_class' => $cc_result['products_tax_class_id']);

// $total_price += $price_incl_vat; //Fred - changed

$total_price += $price_excl_vat; // changed

}

}

if (sizeof($valid_array) > 0) { // if ($valid_product) {

if ($get_result['coupon_type'] == 'P') {

$ratio = $get_result['coupon_amount']/100;

} else {

$ratio = $od_amount / $total_price;

}

if ($get_result['coupon_type'] == 'S') $ratio = 1;

if ($method=='Credit Note') {

$tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

$tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

if ($get_result['coupon_type'] == 'P') {

$tod_amount = $od_amount / (100 + $tax_rate)* $tax_rate;

} else {

$tod_amount = $order->info['tax_groups'][$tax_desc] * $od_amount/100;

}

$order->info['tax_groups'][$tax_desc] -= $tod_amount;

$order->info['total'] -= $tod_amount; // need to modify total ...OLD

$order->info['tax'] -= $tod_amount; //Fred - added

} else {

for ($p=0; $p<sizeof($valid_array); $p++) {

$tax_rate = tep_get_tax_rate($valid_array[$p]['products_tax_class'], $order->delivery['country']['id'], $order->delivery['zone_id']);

$tax_desc = tep_get_tax_description($valid_array[$p]['products_tax_class'], $order->delivery['country']['id'], $order->delivery['zone_id']);

if ($tax_rate > 0) {

//Fred $tod_amount[$tax_desc] += ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; //OLD

$tod_amount = ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; // calc total tax Fred - added

$order->info['tax_groups'][$tax_desc] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio;

$order->info['total'] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; // adjust total

$order->info['tax'] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; // adjust tax -- Fred - added

}

}

}

}

//NO RESTRICTION--------------------------------

} else {

if ($get_result['coupon_type'] =='F') {

$tod_amount = 0;

if ($method=='Credit Note') {

$tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

$tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

$tod_amount = $od_amount / (100 + $tax_rate)* $tax_rate;

$order->info['tax_groups'][$tax_desc] -= $tod_amount;

} else {

// $ratio1 = $od_amount/$amount; // this produces the wrong ratipo on fixed amounts

reset($order->info['tax_groups']);

while (list($key, $value) = each($order->info['tax_groups'])) {

$ratio1 = $od_amount/($amount-$order->info['tax_groups'][$key]); ////debug

$tax_rate = tep_get_tax_rate_from_desc($key);

$net = $tax_rate * $order->info['tax_groups'][$key];

if ($net>0) {

$god_amount = $order->info['tax_groups'][$key] * $ratio1;

$tod_amount += $god_amount;

$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;

}

}

}

$order->info['total'] -= $tod_amount; //OLD

$order->info['tax'] -= $tod_amount; //Fred - added

}

if ($get_result['coupon_type'] =='P') {

$tod_amount=0;

if ($method=='Credit Note') {

$tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

$tod_amount = $order->info['tax_groups'][$tax_desc] * $od_amount/100;

$order->info['tax_groups'][$tax_desc] -= $tod_amount;

} else {

reset($order->info['tax_groups']);

while (list($key, $value) = each($order->info['tax_groups'])) {

$god_amount=0;

$tax_rate = tep_get_tax_rate_from_desc($key);

$net = $tax_rate * $order->info['tax_groups'][$key];

if ($net>0) {

$god_amount = $order->info['tax_groups'][$key] * $get_result['coupon_amount']/100;

$tod_amount += $god_amount;

$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;

}

}

}

$order->info['total'] -= $tod_amount; // have to modify total also

$order->info['tax'] -= $tod_amount;

}

}

}

}

return $tod_amount;

}

 

function update_credit_account($i) {

return false;

}

 

function apply_credit() {

global $insert_id, $customer_id, $REMOTE_ADDR, $cc_id;

//$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

if ($this->deduction !=0) {

tep_db_query("insert into " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, redeem_date, redeem_ip, customer_id, order_id) values ('" . $cc_id . "', now(), '" . $REMOTE_ADDR . "', '" . $customer_id . "', '" . $insert_id . "')");

}

tep_session_unregister('cc_id');

}

 

function get_order_total() {

global $order, $cart, $customer_id, $cc_id;

//$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

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

// Check if gift voucher is in cart and adjust total

$products = $cart->get_products();

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

$t_prid = tep_get_prid($products[$i]['id']);

$gv_query = tep_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");

$gv_result = tep_db_fetch_array($gv_query);

if (ereg('^GIFT', addslashes($gv_result['products_model']))) {

$qty = $cart->get_quantity($t_prid);

$products_tax = tep_get_tax_rate($gv_result['products_tax_class_id']);

if ($this->include_tax =='false') {

$gv_amount = $gv_result['products_price'] * $qty;

} else {

$gv_amount = ($gv_result['products_price'] + tep_calculate_tax($gv_result['products_price'],$products_tax)) * $qty;

}

$order_total=$order_total - $gv_amount;

}

}

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'];

// OK thats fine for global coupons but what about restricted coupons

// where you can only redeem against certain products/categories.

// and I though this was going to be easy !!!

$coupon_query=tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id='".$cc_id."'");

if (tep_db_num_rows($coupon_query) !=0) {

$coupon_result=tep_db_fetch_array($coupon_query);

$coupon_get=tep_db_query("select coupon_amount, coupon_minimum_order,restrict_to_products,restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code='".$coupon_result['coupon_code']."'");

$get_result=tep_db_fetch_array($coupon_get);

$in_cat = true;

if ($get_result['restrict_to_categories']) {

$cat_ids = split("[,]", $get_result['restrict_to_categories']);

$in_cat=false;

for ($i = 0; $i < count($cat_ids); $i++) {

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$cat_query = tep_db_query("select products_id from products_to_categories where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$cat_ids[$i] . "'");

if (tep_db_num_rows($cat_query) !=0 ) {

$in_cat = true;

$total_price += $this->get_product_price($products_id);

}

}

}

}

}

$in_cart = true;

if ($get_result['restrict_to_products']) {

 

$pr_ids = split("[,]", $get_result['restrict_to_products']);

 

$in_cart=false;

$products_array = $cart->get_products();

 

for ($i = 0; $i < sizeof($pr_ids); $i++) {

for ($ii = 1; $ii<=sizeof($products_array); $ii++) {

if (tep_get_prid($products_array[$ii-1]['id']) == $pr_ids[$i]) {

$in_cart=true;

$total_price += $this->get_product_price($products_array[$ii-1]['id']);

}

}

}

$order_total = $total_price;

}

}

return $order_total;

}

 

function get_product_price($product_id) {

global $cart, $order;

$products_id = tep_get_prid($product_id);

// products price

$qty = $cart->contents[$product_id]['qty'];

$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . (int)$product_id . "'");

if ($product = tep_db_fetch_array($product_query)) {

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $product['products_price'];

$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'");

if (tep_db_num_rows ($specials_query)) {

$specials = tep_db_fetch_array($specials_query);

$products_price = $specials['specials_new_products_price'];

}

if ($this->include_tax == 'true') {

$total_price += ($products_price + tep_calculate_tax($products_price, $products_tax)) * $qty;

} else {

$total_price += $products_price * $qty;

}

 

// attributes price

if (isset($cart->contents[$product_id]['attributes'])) {

reset($cart->contents[$product_id]['attributes']);

while (list($option, $value) = each($cart->contents[$product_id]['attributes'])) {

$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");

$attribute_price = tep_db_fetch_array($attribute_price_query);

if ($attribute_price['price_prefix'] == '+') {

if ($this->include_tax == 'true') {

$total_price += $qty * ($attribute_price['options_values_price'] + tep_calculate_tax($attribute_price['options_values_price'], $products_tax));

} else {

$total_price += $qty * ($attribute_price['options_values_price']);

}

} else {

if ($this->include_tax == 'true') {

$total_price -= $qty * ($attribute_price['options_values_price'] + tep_calculate_tax($attribute_price['options_values_price'], $products_tax));

} else {

$total_price -= $qty * ($attribute_price['options_values_price']);

}

}

}

}

}

if ($this->include_shipping == 'true') {

 

$total_price += $order->info['shipping_cost'];

}

return $total_price;

}

 

//Added by Fred -- BOF -----------------------------------------------------

//JUST RETURN THE PRODUCT PRICE (INCL ATTRIBUTE PRICES) WITH OR WITHOUT TAX

function product_price($product_id) {

$total_price = $this->get_product_price($product_id);

if ($this->include_shipping == 'true') $total_price -= $order->info['shipping_cost'];

return $total_price;

}

//Added by Fred -- EOF -----------------------------------------------------

 

// START added by Rigadin in v5.13, needed to show module errors on checkout_payment page

function get_error() {

global $HTTP_GET_VARS;

 

$error = array('title' => MODULE_ORDER_TOTAL_COUPON_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

 

return $error;

}

 

function check() {

if (!isset($this->check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_COUPON_STATUS'");

$this->check = tep_db_num_rows($check_query);

}

 

return $this->check;

}

 

function keys() {

return array('MODULE_ORDER_TOTAL_COUPON_STATUS', 'MODULE_ORDER_TOTAL_COUPON_SORT_ORDER', 'MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING', 'MODULE_ORDER_TOTAL_COUPON_INC_TAX', 'MODULE_ORDER_TOTAL_COUPON_CALC_TAX', 'MODULE_ORDER_TOTAL_COUPON_TAX_CLASS');

}

 

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 Total', 'MODULE_ORDER_TOTAL_COUPON_STATUS', 'true', 'Do you want to display the Discount Coupon value?', '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_ORDER_TOTAL_COUPON_SORT_ORDER', '9', '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 ('Include Shipping', 'MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING', 'true', 'Include Shipping in calculation', '6', '5', '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_ORDER_TOTAL_COUPON_INC_TAX', 'true', 'Include Tax 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 ('Re-calculate Tax', 'MODULE_ORDER_TOTAL_COUPON_CALC_TAX', 'None', 'Re-Calculate Tax', '6', '7','tep_cfg_select_option(array(\'None\', \'Standard\', \'Credit Note\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_ORDER_TOTAL_COUPON_TAX_CLASS', '0', 'Use the following tax class when treating Discount Coupon as Credit Note.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");

}

 

function remove() {

$keys = '';

$keys_array = $this->keys();

for ($i=0; $i<sizeof($keys_array); $i++) {

$keys .= "'" . $keys_array[$i] . "',";

}

$keys = substr($keys, 0, -1);

 

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");

}

}

?>

Link to comment
Share on other sites

I have spent Many hours going through these posts, My problem is No payment is being taken all is well with the voucher ect, you select a payment method, I have tried paypal, credit card ect and you complete order with out being sent to paypal or Payment page, I have very carefully checked Checkout_payment.php and Checkout_confirmation.php and compared with before and after changes but getting nowhere

 

the set up is as follows

 

RC2a

Multistore V2

CCGV 5.21

RMA Returns V2.6

MATC 2.3.1

plus many other less related contribs

 

I have spent a very very long time getting this all woking, its prob something silly but i just cant see it,

 

Any ideas where to look?

 

Thank you

David

Link to comment
Share on other sites

  • 2 weeks later...

Hi Guys

i understand the Gift Vouchers how create the new

Creating a gift voucher for a customer to buy is the same as creating a new product with the exception that the gift vouchers model number must start with the word GIFT in upper case. It can be GIFT_25 or GIFT25 or whatever you would like to use. as the suffix to the word. But MUST START with the word GIFT You can create gift vouchers in any denomination. Gift certificate images have been provide in the catalog\images directory in denominations of 25$, 50$ and 100$ values.

 

You can also create gift vouchers by sending them to your customers via the admin->Vouchers/Coupons->Mail Gift Voucher selection within the admin. To use this to send a voucher to a customer use the drop down customer list. To send to a single customer or future customer you can put their email in the Email To: text box. Do not use both the customer dropdown list and the Email To: text box or the customer will get 2 gift vouchers. To determine what values the gift voucher is used on please see the doc on modules->order total->gift vouchers.

 

Gift vouchers are a virtual product. In this regard, in many shops, they do not require shipping charges to be added to them. To avert the shipping charge on gift vouchers set the weight of the gift voucher to 0 when creating the product and enable downloads by setting true the value admin->configuration->downloads->enable download .

476443584.gif

but i don't where the add or insert button tell me how an example

Link to comment
Share on other sites

Hi Guys

i understand the Gift Vouchers how create the new

 

476443584.gif

but i don't where the add or insert button tell me how an example

 

You can create Gift Vouchers as normal products with a weight of 'zero'

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

  • 1 month later...

I was wondering if anyone knows why my Admin looks like the below when I installed the CCGV5.21. The links seem to work, and when I click on another link outside the Voucher box, it goes back to normal. Did I miss an installation of a file?

 

CCGV.jpg

Link to comment
Share on other sites

  • 2 weeks later...

well spent around 70hours + now on working with this mod ina relatively unmodified cart.

 

I have tried the latest versions of ccgv and ccgv(trad)

 

Ihave tried several of the contributions in between.

 

I currenty have the latest ccgv mod installed on a system using mysql5.

 

The Coupons appear to work fine and so do the restrictions etc.

 

Th gift vouchers, however is where I am struggling.

 

I have ceated and purchased the gift voucher, as the downloads were enabled it sold the voucher to mewithout any shipping charge (so thats working)

 

However the admin is showing the voucher que button as release, but there is no details on the gift voucher purchased.

 

If someone can post me in the right direction of the files responsible or a fix I would be very grateful.

 

Thanks

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

well spent around 70hours + now on working with this mod ina relatively unmodified cart.

 

I have tried the latest versions of ccgv and ccgv(trad)

 

Ihave tried several of the contributions in between.

 

I currenty have the latest ccgv mod installed on a system using mysql5.

 

The Coupons appear to work fine and so do the restrictions etc.

 

Th gift vouchers, however is where I am struggling.

 

I have ceated and purchased the gift voucher, as the downloads were enabled it sold the voucher to mewithout any shipping charge (so thats working)

 

However the admin is showing the voucher que button as release, but there is no details on the gift voucher purchased.

 

If someone can post me in the right direction of the files responsible or a fix I would be very grateful.

 

Thanks

Johnny

 

okay I thought it was working but now its completly broke....ggrrrrrr so enjoyable

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

  • 1 month later...

Hi everyone, im having a big problem where after using the Gift Voucher, the balance remain the same, can someone point me to the right direction in fixing the problem or if anyone is having the same problem and fixed it, can you please help me ? Thank you

Link to comment
Share on other sites

  • 4 weeks later...

hi guys,

 

i have this mod installed, it comes up in my admin no problem, i can add coupons etc:

 

however during the checkout process it simply does not show up during the checkout_payment screen,

 

i have another website which works fine with it, the redeem code box and button appear etc: but nothing seems to appear on my new site for reedeeming the coupon, has anybody ever had this problem before, it seems like it is all installed etC: i dont seem to get any errors it just simply does not display,

 

i have scanned through my checkout_payment file, and all the code seems to be there, i have tried using the checkout_payment.php file from my other site that works, but unusually it still doesnt display the redeem box and button etc:

 

any help would be hugely appreciate, cheers

 

dlyxzen

Link to comment
Share on other sites

Hi Guys!

 

Great contribution....thanks

 

I have just a 2 small issues on the confirmation new customer's email and on how to make a GIFT voucher... ( I can still send to customers Gift and Vouchers):

 

1st: All is going well but when the customer is getting the email of confirmation he had a new account in my website (as normal) it has the test under saying that "as a new subscriber, you have a "welcome-coupon" for your first order" see the code below...

 

There isn't a code under it is all blank!

 

I have created the code. I have writed down the code in the Admin/configuration/To offer a discount coupon..., I have set to 0 "To offer a gift voucher" - but still not working!

 

DO YOU KNOW HOW I CAN MAKE MY CODE APPEAR in the email?

 

2nd: I still don't get it about the gift voucher!

 

I have made a GIFT_WELCOME as a product.

But I do I fill it up please?

 

*Where do I put this product?

*In Products Manufacturer, do I put something?

*Is the status has to be ON or OFF? (cause if put ON it will apprear in my "new product banner"!

*In Products Name, do I put GIFT_WELCOME here? If yes English, french,... have to have the same name: GIFT_WELCOME?

*In Products Description, do I put something in here too?

*In Products Quantity, do I put a quantity of how many time I want to use it?

*In Products Model, do I put the name of the Gift Voucher again (GIFT_WELCOME)?

*In Products Image, I can add any .gif image?

*In Products URL, any URL I suppose?

*and In Products Weight, I read it has to be 0, is it right?

 

If you can tell me how to make it please it will be very nice cause I have been reading most of the forum and couldn'd found a clair view.

 

Thanks

osCommerce Online Merchant v2.2 RC1 W3C Valid FR avec : colissimo_v1.9 // CGV // GoogleXML_sitemap - Update -> googlexml_sitemap_seo_v_1.5 // Ultimate SEO URLs 2.1d - Update -> v22d_12 // AntiRobotRegistrationValidation-3.1 // TinyMCE WYSIWYG HTML EDITOR // HEader Tag SEO 3.1.4 // PDF Invoice 1.5 // Specials_enhanced_v1_3_1 // quick_stock_update_v3.5_FRENCH // xmembers_v2.2 // contact_us_form_in_db_with_amin_v1.1 // photo_display_1 // previous_next_with_details // infoBox Admin v.2.25 // whosonlineturbov1.1fr // customer_discount_v1.3 // flash_bannersv2 // Horizontal_menu_V3 // Loginbox_Best_1 // CCGV // XSell_v2_7_2 // Printable Catalog XSS Flaw Fixed // all_specials_slideshow // Birthdays_v1.4 // Search_price_range_pulldown_menu_1.1 // contrib-categories // Reviews_in_Product_Display_v2.3 // Easy Graphical Borders // Simple Multiple Images (Unlimited) with Fancy Popups V1.3.5 // Guestbook V3.0 // Blacklist_IP_v.3 // Quicker Product Edit v2.1 // Chronopost_2010 // Easy Center // Size Shop with Layers // Safari-Chrome_fix // Protection to Configuration v1.3a // Page_Cache_v1.6... Thanks to everyone!

Link to comment
Share on other sites

Hi Guys!

 

Great contribution....thanks

 

I have just a 2 small issues on the confirmation new customer's email and on how to make a GIFT voucher... ( I can still send to customers Gift and Vouchers):

 

1st: All is going well but when the customer is getting the email of confirmation he had a new account in my website (as normal) it has the test under saying that "as a new subscriber, you have a "welcome-coupon" for your first order" see the code below...

 

There isn't a code under it is all blank!

 

I have created the code. I have writed down the code in the Admin/configuration/To offer a discount coupon..., I have set to 0 "To offer a gift voucher" - but still not working!

 

DO YOU KNOW HOW I CAN MAKE MY CODE APPEAR in the email?

 

2nd: I still don't get it about the gift voucher!

 

I have made a GIFT_WELCOME as a product.

But I do I fill it up please?

 

*Where do I put this product?

*In Products Manufacturer, do I put something?

*Is the status has to be ON or OFF? (cause if put ON it will apprear in my "new product banner"!

*In Products Name, do I put GIFT_WELCOME here? If yes English, french,... have to have the same name: GIFT_WELCOME?

*In Products Description, do I put something in here too?

*In Products Quantity, do I put a quantity of how many time I want to use it?

*In Products Model, do I put the name of the Gift Voucher again (GIFT_WELCOME)?

*In Products Image, I can add any .gif image?

*In Products URL, any URL I suppose?

*and In Products Weight, I read it has to be 0, is it right?

 

If you can tell me how to make it please it will be very nice cause I have been reading most of the forum and couldn'd found a clair view.

 

Thanks

 

Gift Vouchers are created as regular items with a weight of (zero) 0. The way I set my Gift Vouchers were as follows:

 

GIFT_25

GIFT_50

GIFT_75

GIFT_100

 

As for your other problem I have not looked in to the code for so long I am not able to help you but hopefully someone else will be able to

Edited by chooch

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Gift Vouchers are created as regular items with a weight of (zero) 0. The way I set my Gift Vouchers were as follows:

 

GIFT_25

GIFT_50

GIFT_75

GIFT_100

 

As for your other problem I have not looked in to the code for so long I am not able to help you but hopefully someone else will be able to

 

 

Hi chooch!

 

Then if I get it right, I just need to fill up the product name (ex: GIFT_25) and make sure that the weight is at 0 (as I read already in the post) + an image or a link if I want to.

No more details in the product, just the Product name and the weight?

Can it be off status as it appears if I put it on?

 

 

Hope that someone will give an issue for the Gift voucher code in the email cause I have tried a lot of things (without knowing how to code) and cause can only send then via "Gift Vouchers sent" and can't do it automatically (first user).

But I am already happy with what I have...

 

Thanks for your contribution chooch!

Edited by Eric B

osCommerce Online Merchant v2.2 RC1 W3C Valid FR avec : colissimo_v1.9 // CGV // GoogleXML_sitemap - Update -> googlexml_sitemap_seo_v_1.5 // Ultimate SEO URLs 2.1d - Update -> v22d_12 // AntiRobotRegistrationValidation-3.1 // TinyMCE WYSIWYG HTML EDITOR // HEader Tag SEO 3.1.4 // PDF Invoice 1.5 // Specials_enhanced_v1_3_1 // quick_stock_update_v3.5_FRENCH // xmembers_v2.2 // contact_us_form_in_db_with_amin_v1.1 // photo_display_1 // previous_next_with_details // infoBox Admin v.2.25 // whosonlineturbov1.1fr // customer_discount_v1.3 // flash_bannersv2 // Horizontal_menu_V3 // Loginbox_Best_1 // CCGV // XSell_v2_7_2 // Printable Catalog XSS Flaw Fixed // all_specials_slideshow // Birthdays_v1.4 // Search_price_range_pulldown_menu_1.1 // contrib-categories // Reviews_in_Product_Display_v2.3 // Easy Graphical Borders // Simple Multiple Images (Unlimited) with Fancy Popups V1.3.5 // Guestbook V3.0 // Blacklist_IP_v.3 // Quicker Product Edit v2.1 // Chronopost_2010 // Easy Center // Size Shop with Layers // Safari-Chrome_fix // Protection to Configuration v1.3a // Page_Cache_v1.6... Thanks to everyone!

Link to comment
Share on other sites

Hi chooch!

 

Then if I get it right, I just need to fill up the product name (ex: GIFT_25) and make sure that the weight is at 0 (as I read already in the post) + an image or a link if I want to.

No more details in the product, just the Product name and the weight?

Can it be off status as it appears if I put it on?

 

 

Hope that someone will give an issue for the Gift voucher code in the email cause I have tried a lot of things (without knowing how to code) and cause can only send then via "Gift Vouchers sent" and can't do it automatically (first user).

But I am already happy with what I have...

 

Thanks for your contribution chooch!

 

No, the model number must be GIFT_25 or GIFT_26 etc etc but you can call the product whatever you wish to, just make sure the model number begins with GIFT_ and then has a value attached to it. Try it and test it, it should work providing you installed everything correctly.

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

No, the model number must be GIFT_25 or GIFT_26 etc etc but you can call the product whatever you wish to, just make sure the model number begins with GIFT_ and then has a value attached to it. Try it and test it, it should work providing you installed everything correctly.

 

It works!!!

 

I was trying to make it work only on my test area (localhost) but there it doesn't. But it works online! Don't know why!

 

Anyway, thanks again

osCommerce Online Merchant v2.2 RC1 W3C Valid FR avec : colissimo_v1.9 // CGV // GoogleXML_sitemap - Update -> googlexml_sitemap_seo_v_1.5 // Ultimate SEO URLs 2.1d - Update -> v22d_12 // AntiRobotRegistrationValidation-3.1 // TinyMCE WYSIWYG HTML EDITOR // HEader Tag SEO 3.1.4 // PDF Invoice 1.5 // Specials_enhanced_v1_3_1 // quick_stock_update_v3.5_FRENCH // xmembers_v2.2 // contact_us_form_in_db_with_amin_v1.1 // photo_display_1 // previous_next_with_details // infoBox Admin v.2.25 // whosonlineturbov1.1fr // customer_discount_v1.3 // flash_bannersv2 // Horizontal_menu_V3 // Loginbox_Best_1 // CCGV // XSell_v2_7_2 // Printable Catalog XSS Flaw Fixed // all_specials_slideshow // Birthdays_v1.4 // Search_price_range_pulldown_menu_1.1 // contrib-categories // Reviews_in_Product_Display_v2.3 // Easy Graphical Borders // Simple Multiple Images (Unlimited) with Fancy Popups V1.3.5 // Guestbook V3.0 // Blacklist_IP_v.3 // Quicker Product Edit v2.1 // Chronopost_2010 // Easy Center // Size Shop with Layers // Safari-Chrome_fix // Protection to Configuration v1.3a // Page_Cache_v1.6... Thanks to everyone!

Link to comment
Share on other sites

hi guys,

 

i have this mod installed, it comes up in my admin no problem, i can add coupons etc:

 

however during the checkout process it simply does not show up during the checkout_payment screen,

 

i have another website which works fine with it, the redeem code box and button appear etc: but nothing seems to appear on my new site for reedeeming the coupon, has anybody ever had this problem before, it seems like it is all installed etC: i dont seem to get any errors it just simply does not display,

 

i have scanned through my checkout_payment file, and all the code seems to be there, i have tried using the checkout_payment.php file from my other site that works, but unusually it still doesnt display the redeem box and button etc:

 

any help would be hugely appreciate, cheers

 

dlyxzen

 

hey guys does anybody at all have any idea why my redeem option is not display on the checkout payment screen ?!?

 

i really desperate to get it going and i cant work it out :(

Link to comment
Share on other sites

It works!!!

 

I was trying to make it work only on my test area (localhost) but there it doesn't. But it works online! Don't know why!

 

Anyway, thanks again

 

Good news.

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

  • 1 month later...

im wondering whether anybody can help me with a slightl calculation problem i have with this mod

 

i have a voucher that discounts 10%. The discount calculates correctly on the payment information page, for this example i used an item worth $10.99 and the voucher is for %10, so it naturally takes off $1.10, im guessing that it is being rounded,

 

but on the checkout confirmation page the coupon amount taken off goes from $1.10, to $0.99.

 

I have played around with the re-calculate tax and include tax options and this doesnt seem to alter the figure at all.

 

does ANYBODY have any idea what might be going wrong? its like it is re-calculating the discount again after it has already been discounted

 

:( :(

 

any help would be greatly appreciated

Link to comment
Share on other sites

  • 2 weeks later...

since i've installed ccgv-version (14 Apr 2009) the paypal website payment standard module doesnt work for me. after confirming an order the page redirect me to the checkout_success.php-page. normally the site should redirect to the paypal-homepage. so my customers cant make the payment. is there any solution for my problem?

Link to comment
Share on other sites

HELLO,

 

REDEEM Problem/

 

I installed CCGV on new RC2a version

 

I am testing now the feature. Seems working mostly, but still learning how to use it.

 

I have one problem though. This the message I get when trying to send a voucher to another account after purchasing it:

 

Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in /homepages/.../includes/functions/database.php on line 113

 

The another person receives email link but when trying to redeem the vaucher is not redeemed

 

I wonder if some one knows the solution to this problem. Perhaps is related to some settings I have done wrong

 

Looking forward to some help

Thanks

Link to comment
Share on other sites

HELLO,

 

REDEEM Problem/

 

I installed CCGV on new RC2a version

 

I am testing now the feature. Seems working mostly, but still learning how to use it.

 

I have one problem though. This the message I get when trying to send a voucher to another account after purchasing it:

 

Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in /homepages/.../includes/functions/database.php on line 113

 

The another person receives email link but when trying to redeem the vaucher is not redeemed

 

I wonder if some one knows the solution to this problem. Perhaps is related to some settings I have done wrong

 

Looking forward to some help

Thanks

 

for those who have such problem:

 

i think i found a solution

 

on line 113 include/functions/dtatabase.php

 

change

return mysql_insert_id($$link);

to

return mysql_insert_id();

 

seems work fine now

 

cheers

Link to comment
Share on other sites

Hi,

 

hope you can help?

 

installed the ccgv latest version.

 

the discount coupons work

the gift vouchers can be mailed out and sent

part of the gift voucher can be sent on to another person from ones account and the value is correctly deducted off the voucher balance.

the gift vouchers can be purchased and added to a persons account

 

not been able to verify the rest of the credit situation yet.

 

 

 

however redeeming the vouchers is a problem.

 

1. Cant redeem any ggift vouchers at all.

2. cant use the voucher balance in account (displayed in shopping cart box)

 

any idea where these problems are located or where i should lookm to find them?

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Hi,

 

hope you can help?

 

installed the ccgv latest version.

 

the discount coupons work

the gift vouchers can be mailed out and sent

part of the gift voucher can be sent on to another person from ones account and the value is correctly deducted off the voucher balance.

the gift vouchers can be purchased and added to a persons account

 

not been able to verify the rest of the credit situation yet.

 

 

 

however redeeming the vouchers is a problem.

 

1. Cant redeem any ggift vouchers at all.

2. cant use the voucher balance in account (displayed in shopping cart box)

 

any idea where these problems are located or where i should lookm to find them?

 

hello,

 

i am new to this contribution. but in the past few days i have been playing with it since some very valuable people on this forum advised me that this is the best to use

 

let me see if i understand you right:

 

1) you buy a voucher

2) it is released by admin (under the voucher/cupon options), and the produt is set us Delivered by admin (under the orders options)

3) the voucher appears into your cart box

4) you can send it. when send can the recepient use it?

5) but you can not use it if keep it for yourself

 

i had this problem and resolved it by changing the orders of the options in module/order total:

 

Discount Coupons 3

Vouchers 4

Shipping 2

Sub Total 1

Tax 5

Total 6

 

after doing this in the checkout_payment.php appears a tick box called To Be Used With Gift Vouchers. by the way the reddem button also changes its position from far right goes to left (not sure why, but works)

 

if you tick this box or put a code if you have one (in case sent the voucher) it discounts in the next step the voucher amount

 

hope this helped you

 

cheers

Link to comment
Share on other sites

  • 1 month later...
I have one problem though. This the message I get when trying to send a voucher to another account after purchasing it:

 

Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in /homepages/.../includes/functions/database.php on line 113

I found a similar problem when installing this contribution on a clients store.

 

The solution I found was to change the code around line #65 of gv_send.php

 

Search for

      $insert_id = tep_db_insert_id($gv_query);
     $gv_query=tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent) values ('" . $insert_id . "' ,'" . $customer_id . "', '" . addslashes($gv_customer['customers_firstname']) . "', '" . addslashes($gv_customer['customers_lastname']) . "', '" . $HTTP_POST_VARS['email'] . "', now())");

and replace it with

     $gv_query=tep_db_query("select coupon_id from " . TABLE_COUPONS . " where coupon_code = '" . $id1 . "'");
     $gv_new_coupon=tep_db_fetch_array($gv_query);
     $gv_query=tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent) values ('" . $gv_new_coupon['coupon_id'] . "' ,'" . $customer_id . "', '" . addslashes($gv_customer['customers_firstname']) . "', '" . addslashes($gv_customer['customers_lastname']) . "', '" . $HTTP_POST_VARS['email'] . "', now())");

 

I got the feeling that tep_db_insert_id($gv_query) was the cause of the problem, and I didn't want to edit the .../include/database.php in case other parts of osCommerce relied on it's current functionality, so I ended up getting the coupon information from the coupons file and then inserting a record in the email track table.

 

 

I also found that the remote IP wasn't being entered into the redeem track table so made the following change in gv_redeem.php around line #52

 

Search for

// Update redeem status
   $gv_query = tep_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $coupon['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')");

and replace it with

// Update redeem status
   $gv_query = tep_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $coupon['coupon_id'] . "', '" . $customer_id . "', now(),'" . $_SERVER['REMOTE_ADDR'] . "')");

 

I believe the reason it wasn't working for me is that $REMOTE_ADDR requires register_globals to be on, so I used the super global $_SERVER['REMOTE_ADDR'] instead.

 

Best regards

LABBS Web Services

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...