Jump to content
Latest News: (loading..)
T. Thomas

Credit Class & Gift Vouchers for 2.3.4

Recommended Posts

Ok, dang it. It is broken again and I did back up. Kevin, would you please update your core files with the fix and upload it to the addons?

Share this post


Link to post
Share on other sites

Ok, now we can actually get past the payment page which is great! Thanks for that coding fix. The next issue I am seeing is with the email that contains the link to redeem the GV. When you click on the link, it takes you to a page that says the gv# is invalid. Is this simply a text message which I need to change? Also, I do not see anywhere in the admin/configuration area a link to send new customers a GV as a welcome as per the use instructions.

 

I tried to contact the original writer of this module however the website contact form is not working. I did send a message through the forums here but don't really hold out much hope of a reply. Your's was the first working fix I have found for this issue. Thank you so much! I can live with the other issues for now but do look forward to your contribution to this addon later this year. I would actually be willing to throw a few bucks your way to have a fully functioning module.

 

The email link issue has been around for some time if I recall. I don't remember if I ever looked at it properly since customers could just type in the code to redeem the amount during checkout. This isn't a text message issue, and is definitely something with the coding.

 

The settings for new customer GV is found in Configuration -> My Store

 

I'm working on this because I also use CCGV, but the much older one from osC v2.2 RC2a. I had installed its adapted 2012 version on a test osC 2.3.4 (which seemed to be working). But then deleted that test site in lieu of a test osC 2.3.3.4. I thought this module, being re-coded for this version, would come working out-of-the-box. Therefore, I installed this module for my osC 2.3.3.4 run. However, I haven't done much testing with my busy schedule. Your posts have made me realize just how much work needs to happen on this module to make it functional. And while I can post "quick" fixes for your individual needs, I'd much rather patch a majority of the necessary changes in one go (because there are more issues I found). Keep reporting and I'll keep a record of what needs to change.

 

I'm by no means a PHP coder (I mean, all I found were spelling errors), but I can figure things out. So with some patience, hopefully I can figure out how to make this add-on work later this month.

Share this post


Link to post
Share on other sites

I am so happy that someone is taking an interest in this. It has many great features that, if it worked properly, would service the needs of many oscommerce users, like us. I had this working with that last fix of the spelling error and backed up my files as I should have.

 

My problem now is I had to reinstall my files after I broke the styling and now this mod doesn't work anymore even using the backed up files. I didn't change anything in the database at all with the my styling changes.. There is also no place in the configuration/my store area to send the gv to customer in my setup. I hate to have to go back to the simple coupon mod as I like the gift certificate feature in this one.

Edited by L. Haase

Share this post


Link to post
Share on other sites

Well, I recheked everything including the typo. I thought I had backed up the proper files but the one I transferred back didn't have the spelling correction above and still no luck getting this re-working.

 

Here is my checkout_payment.php file. The one pasted above is non-functioning. This one worked but doesn't now. Any ideas?

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

// if there is nothing in the customers cart, redirect them to the shopping

 

cart page

if ($cart->count_contents() < 1) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

 

// if no shipping method has been selected, redirect the customer to the

 

shipping method selection page

if (!tep_session_is_registered('shipping')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

 

// avoid hack attempts during the checkout procedure by checking the internal

 

cartID

if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

if ($cart->cartID != $cartID) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

}

 

// Stock Check

if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {

$products = $cart->get_products();

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

if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

break;

}

}

}

 

// if no billing destination address was selected, use the customers own

 

address as default

if (!tep_session_is_registered('billto')) {

tep_session_register('billto');

$billto = $customer_default_address_id;

} else {

// verify the selected billing address

if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {

$check_address_query = tep_db_query("select count(*) as total from " .

 

TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and

 

address_book_id = '" . (int)$billto . "'");

$check_address = tep_db_fetch_array($check_address_query);

 

if ($check_address['total'] != '1') {

$billto = $customer_default_address_id;

if (tep_session_is_registered('payment')) tep_session_unregister

 

('payment');

}

}

}

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

require(DIR_WS_CLASSES . 'order_total.php'); // CCGV

$order_total_modules = new order_total; // CCGV

 

if (!tep_session_is_registered('comments')) tep_session_register

 

('comments');

if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS

 

['comments'])) {

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

}

 

$total_weight = $cart->show_weight();

$total_count = $cart->count_contents();

$total_count = $cart->count_contents_virtual(); // CCGV

 

// load all enabled payment modules

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment;

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

 

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING,

 

'', 'SSL'));

$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT,

 

'', 'SSL'));

 

require(DIR_WS_INCLUDES . 'template_top.php');

?>

 

<script type="text/javascript"><!--

var selected;

<?php /* following jscript function ADDED FOR CCGV */ ?>

var submitter = null;

function submitFunction() {

submitter = 1;

}

<?php /* END OF ADDED FOR CCGV */ ?>

 

function selectRowEffect(object, buttonselect) {

if (!selected) {

if (document.getElementById) {

selected = document.getElementById('defaultSelected');

} else {

selected = document.all['defaultSelected'];

}

}

 

if (selected) selected.className = 'moduleRow';

object.className = 'moduleRowSelected';

selected = object;

 

// one button is not an array

if (document.checkout_payment.payment[0]) {

document.checkout_payment.payment[buttonselect].checked=true;

} else {

document.checkout_payment.payment.checked=true;

}

}

 

function rowOverEffect(object) {

if (object.className == 'moduleRow') object.className = 'moduleRowOver';

}

 

function rowOutEffect(object) {

if (object.className == 'moduleRowOver') object.className = 'moduleRow';

}

//--></script>

<?php echo $payment_modules->javascript_validation(); ?>

 

<h1><?php echo HEADING_TITLE; ?></h1>

 

<?php echo tep_draw_form('checkout_payment', tep_href_link

 

(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return

 

check_form();"', true); ?>

 

<div class="contentContainer">

 

<?php

if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS

 

['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}-

 

>get_error())) {

?>

 

<div class="contentText">

<?php echo '<strong>' . tep_output_string_protected($error['title']) .

 

'</strong>'; ?>

 

<p class="messageStackError"><?php echo tep_output_string_protected

 

($error['error']); ?></p>

</div>

 

<?php

}

?>

 

<h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2>

 

<div class="contentText">

<div class="ui-widget infoBoxContainer" style="float: right;">

<div class="ui-widget-header infoBoxHeading"><?php echo

 

TITLE_BILLING_ADDRESS; ?></div>

 

<div class="ui-widget-content infoBoxContents">

<?php echo tep_address_label($customer_id, $billto, true, ' ', '<br

 

/>'); ?>

</div>

</div>

 

<?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br /><br /><?php echo

 

tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link

 

(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); ?>

</div>

 

<div style="clear: both;"></div>

 

<h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2>

 

<?php

$selection = $payment_modules->selection();

 

if (sizeof($selection) > 1) {

?>

 

<div class="contentText">

<div style="float: right;">

<?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?>

</div>

 

<?php echo TEXT_SELECT_PAYMENT_METHOD; ?>

</div>

 

<?php

} elseif ($free_shipping == false) {

?>

 

<div class="contentText">

<?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?>

</div>

 

<?php

}

?>

 

<div class="contentText">

 

<?php

$radio_buttons = 0;

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

?>

 

<table border="0" width="100%" cellspacing="0" cellpadding="2">

 

<?php

if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {

echo ' <tr id="defaultSelected" class="moduleRowSelected"

 

onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"

 

onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

} else {

echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)"

 

onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' .

 

$radio_buttons . ')">' . "\n";

}

?>

 

<td><strong><?php echo $selection[$i]['module']; ?></strong></td>

<td align="right">

 

<?php

if (sizeof($selection) > 1) {

echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection

 

[$i]['id'] == $payment));

} else {

echo tep_draw_hidden_field('payment', $selection[$i]['id']);

}

?>

 

</td>

</tr>

 

<?php

if (isset($selection[$i]['error'])) {

?>

 

<tr>

<td colspan="2"><?php echo $selection[$i]['error']; ?></td>

</tr>

 

<?php

} elseif (isset($selection[$i]['fields']) && is_array($selection[$i]

 

['fields'])) {

?>

 

<tr>

<td colspan="2"><table border="0" cellspacing="0" cellpadding="2">

 

<?php

for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {

?>

 

<tr>

<td><?php echo $selection[$i]['fields'][$j]['title']; ?></td>

<td><?php echo $selection[$i]['fields'][$j]['field']; ?></td>

</tr>

 

<?php

}

?>

 

</table></td>

</tr>

 

<?php

}

?>

 

</table>

 

<?php

$radio_buttons++;

}

?>

 

<?php

echo $order_total_modules->credit_selection(); // CCGV

?>

</div>

 

<h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>

 

<div class="contentText">

<?php echo tep_draw_textarea_field('comments', 'soft', '60', '5',

 

$comments); ?>

</div>

 

<div class="contentText">

<div style="float: left; width: 60%; padding-top: 5px; padding-left:

 

15%;">

<div id="coProgressBar" style="height: 5px;"></div>

 

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td align="center" width="33%" class="checkoutBarFrom"><?php echo

 

'<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '"

 

class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>

<td align="center" width="33%" class="checkoutBarCurrent"><?php echo

 

CHECKOUT_BAR_PAYMENT; ?></td>

<td align="center" width="33%" class="checkoutBarTo"><?php echo

 

CHECKOUT_BAR_CONFIRMATION; ?></td>

</tr>

</table>

</div>

 

<div style="float: right;"><?php echo tep_draw_button

 

(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></div>

</div>

</div>

 

<script type="text/javascript">

$('#coProgressBar').progressbar({

value: 66

});

</script>

 

</form>

 

<?php

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>ar').progressbar({

value: 66

});

</script>

 

</form>

 

<?php

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

Lisa.

Share this post


Link to post
Share on other sites

I see this twice:

 

require(DIR_WS_INCLUDES . 'template_bottom.php');

 

I don't see this code:

// BEGIN CCGV -- if we have been here before and are coming back get rid of the credit covers variable
if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');
if(tep_session_is_registered('cot_gv')) tep_session_unregister('cot_gv');
// END CCGV
// Stock Check

 

And I don't know if it's your browser's copy/paste, or if it's actually in your current file, but the following (as well as many other instances) shouldn't take multiple lines:

 

// if there is nothing in the customers cart, redirect them to the shopping
cart page

 

You should use the CODE tag when posting stuff like these. The button looks like: < >

Share this post


Link to post
Share on other sites

good job on finding that spelling error :)

Edited by mommaroodles

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

@ lisa

 

You must have copied and pasted incorrectly because this is the checkout_payment.php file which was uploaded.

<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
// if there is nothing in the customers cart, redirect them to the shopping cart page
if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
// if no shipping method has been selected, redirect the customer to the shipping method selection page
if (!tep_session_is_registered('shipping')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
// avoid hack attempts during the checkout procedure by checking the internal cartID
if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
if ($cart->cartID != $cartID) {
 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}
// if we have been here before and are coming back get rid of the credit covers variable
if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers'); //CCGV
// Stock Check
if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
 if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
 tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 break;
 }
}
}
// if no billing destination address was selected, use the customers own address as default
if (!tep_session_is_registered('billto')) {
tep_session_register('billto');
$billto = $customer_default_address_id;
} else {
// verify the selected billing address
if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {
 $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");
 $check_address = tep_db_fetch_array($check_address_query);
 if ($check_address['total'] != '1') {
 $billto = $customer_default_address_id;
 if (tep_session_is_registered('payment')) tep_session_unregister('payment');
 }
}
}
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
require(DIR_WS_CLASSES . 'order_total.php'); // CCGV
$order_total_modules = new order_total; // CCGV
if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}
$total_weight = $cart->show_weight();
$total_count = $cart->count_contents();
$total_count = $cart->count_contents_virtual(); // CCGV
// load all enabled payment modules
require(DIR_WS_CLASSES . 'payment.php');
$payment_modules = new payment;
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
require(DIR_WS_INCLUDES . 'template_top.php');
?>
<script language="javascript"><!--
var selected;
<?php /* following jscript function ADDED FOR CCGV */ ?>
var submitter = null;
function submitFunction() {
submitter = 1;
}
<?php /* END OF ADDED FOR CCGV */ ?>
function selectRowEffect(object, buttonselect) {
if (!selected) {
if (document.getElementById) {
 selected = document.getElementById('defaultSelected');
} else {
 selected = document.all['defaultSelected'];
}
}
if (selected) selected.className = 'moduleRow';
object.className = 'moduleRowSelected';
selected = object;
// one button is not an array
if (document.checkout_payment.payment[0]) {
document.checkout_payment.payment[buttonselect].checked=true;
} else {
document.checkout_payment.payment.checked=true;
}
}
function rowOverEffect(object) {
if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}
function rowOutEffect(object) {
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
<?php echo $payment_modules->javascript_validation(); ?>
<h1><?php echo HEADING_TITLE; ?></h1>
<?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?>
<div class="contentContainer">
<?php
if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
?>
<div class="contentText">
<?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?>
<p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p>
</div>
<?php
}
?>
<h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2>
<div class="contentText">
<div class="ui-widget infoBoxContainer" style="float: right;">
 <div class="ui-widget-header infoBoxHeading"><?php echo TITLE_BILLING_ADDRESS; ?></div>
 <div class="ui-widget-content infoBoxContents">
 <?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />'); ?>
 </div>
</div>
<?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br /><br /><?php echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); ?>
</div>
<div style="clear: both;"></div>
<h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2>
<?php
$selection = $payment_modules->selection();
if (sizeof($selection) > 1) {
?>
<div class="contentText">
<div style="float: right;">
 <?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?>
</div>
<?php echo TEXT_SELECT_PAYMENT_METHOD; ?>
</div>
<?php
} elseif ($free_shipping == false) {
?>
<div class="contentText">
<?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?>
</div>
<?php
}
?>
<div class="contentText">
<?php
$radio_buttons = 0;
for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {
 echo '	 <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
} else {
 echo '	 <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
}
?>
 <td><strong><?php echo $selection[$i]['module']; ?></strong></td>
 <td align="right">
<?php
if (sizeof($selection) > 1) {
 echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment));
} else {
 echo tep_draw_hidden_field('payment', $selection[$i]['id']);
}
?>
 </td>
 </tr>
<?php
if (isset($selection[$i]['error'])) {
?>
 <tr>
 <td colspan="2"><?php echo $selection[$i]['error']; ?></td>
 </tr>
<?php
} elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {
?>
 <tr>
 <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
<?php
 for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
?>
	 <tr>
	 <td><?php echo $selection[$i]['fields'][$j]['title']; ?></td>
	 <td><?php echo $selection[$i]['fields'][$j]['field']; ?></td>
	 </tr>
<?php
 }
?>
 </table></td>
 </tr>
<?php
}
?>
</table>
<?php
$radio_buttons++;
}
?>
<?php
echo $order_total_modules->credit_selection(); // CCGV
?>
</div>
<h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>
<div class="contentText">
<?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>
</div>
<div class="contentText">
<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
 <div id="coProgressBar" style="height: 5px;"></div>
 <table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
	 <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
	 <td align="center" width="33%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
	 <td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
 </tr>
 </table>
</div>
<div style="float: right;"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></div>
</div>
</div>
<script type="text/javascript">
$('#coProgressBar').progressbar({
value: 66
});
</script>
</form>
<?php
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Edited by mommaroodles

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

The email link issue has been around for some time if I recall. I don't remember if I ever looked at it properly since customers could just type in the code to redeem the amount during checkout. This isn't a text message issue, and is definitely something with the coding.

 

The settings for new customer GV is found in Configuration -> My Store

 

I'm working on this because I also use CCGV, but the much older one from osC v2.2 RC2a. I had installed its adapted 2012 version on a test osC 2.3.4 (which seemed to be working). But then deleted that test site in lieu of a test osC 2.3.3.4. I thought this module, being re-coded for this version, would come working out-of-the-box. Therefore, I installed this module for my osC 2.3.3.4 run. However, I haven't done much testing with my busy schedule. Your posts have made me realize just how much work needs to happen on this module to make it functional. And while I can post "quick" fixes for your individual needs, I'd much rather patch a majority of the necessary changes in one go (because there are more issues I found). Keep reporting and I'll keep a record of what needs to change.

 

I'm by no means a PHP coder (I mean, all I found were spelling errors), but I can figure things out. So with some patience, hopefully I can figure out how to make this add-on work later this month.

 

@@kevin

 

Would you be so kind as so point out the spelling errors so that they can be corrected


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

I am so happy that someone is taking an interest in this. It has many great features that, if it worked properly, would service the needs of many oscommerce users, like us. I had this working with that last fix of the spelling error and backed up my files as I should have.

 

My problem now is I had to reinstall my files after I broke the styling and now this mod doesn't work anymore even using the backed up files. I didn't change anything in the database at all with the my styling changes.. There is also no place in the configuration/my store area to send the gv to customer in my setup. I hate to have to go back to the simple coupon mod as I like the gift certificate feature in this one.

 

I think that you are not understanding how this module works - because everything is in place and provided you have your setup correct, the module works just fine

Edited by mommaroodles

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

Ok, now we can actually get past the payment page which is great! Thanks for that coding fix. The next issue I am seeing is with the email that contains the link to redeem the GV. When you click on the link, it takes you to a page that says the gv# is invalid. Is this simply a text message which I need to change? Also, I do not see anywhere in the admin/configuration area a link to send new customers a GV as a welcome as per the use instructions.

 

I tried to contact the original writer of this module however the website contact form is not working. I did send a message through the forums here but don't really hold out much hope of a reply. Your's was the first working fix I have found for this issue. Thank you so much! I can live with the other issues for now but do look forward to your contribution to this addon later this year. I would actually be willing to throw a few bucks your way to have a fully functioning module.

 

My web site form is working and I did get your enquiry but it landed up in my junk mail which I dont check everyday - Please also note that I am not the original author of this module, I merely updated this module so that it would work with 2.3.3.4, I've been using this module since the days of MS 2.1 and it does work.

 

So far the only real error that has been pointed out is the spelling error on the ot_coupon.php page - I'll fix it and add it to the module


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

Ok, now we can actually get past the payment page which is great! Thanks for that coding fix. The next issue I am seeing is with the email that contains the link to redeem the GV. When you click on the link, it takes you to a page that says the gv# is invalid. Is this simply a text message which I need to change? Also, I do not see anywhere in the admin/configuration area a link to send new customers a GV as a welcome as per the use instructions.

 

I tried to contact the original writer of this module however the website contact form is not working. I did send a message through the forums here but don't really hold out much hope of a reply. Your's was the first working fix I have found for this issue. Thank you so much! I can live with the other issues for now but do look forward to your contribution to this addon later this year. I would actually be willing to throw a few bucks your way to have a fully functioning module.

 

It seems I forgot to add the sql file which adds the entries to the configuration so that you can set the welcome gift voucher amount and the welcome discount coupon code - I've added that file to the package now. Please accept my apologies for that oversight.

 

Here is the full sql file

 

# phpMyAdmin MySQL-Dump
# Database : `ccgv`
#
# Table structure for table `coupon_email_track`
#
CREATE TABLE coupon_email_track (
 unique_id int(11) NOT NULL auto_increment,
 coupon_id int(11) NOT NULL default '0',
 customer_id_sent int(11) NOT NULL default '0',
 sent_firstname varchar(32) default NULL,
 sent_lastname varchar(32) default NULL,
 emailed_to varchar(32) default NULL,
 date_sent datetime NOT NULL default '0000-00-00 00:00:00',
 PRIMARY KEY  (unique_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

#
# Table structure for table `coupon_gv_customer`
#
CREATE TABLE coupon_gv_customer (
 customer_id int(5) NOT NULL default '0',
 amount decimal(8,4) NOT NULL default '0.0000',
 PRIMARY KEY  (customer_id),
 KEY customer_id (customer_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

#
# Table structure for table `coupon_gv_queue`
#
CREATE TABLE coupon_gv_queue (
 unique_id int(5) NOT NULL auto_increment,
 customer_id int(5) NOT NULL default '0',
 order_id int(5) NOT NULL default '0',
 amount decimal(8,4) NOT NULL default '0.0000',
 date_created datetime NOT NULL default '0000-00-00 00:00:00',
 ipaddr varchar(32) NOT NULL default '',
 release_flag char(1) NOT NULL default 'N',
 PRIMARY KEY  (unique_id),
 KEY uid (unique_id,customer_id,order_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

#
# Table structure for table `coupon_redeem_track`
#
CREATE TABLE coupon_redeem_track (
 unique_id int(11) NOT NULL auto_increment,
 coupon_id int(11) NOT NULL default '0',
 customer_id int(11) NOT NULL default '0',
 redeem_date datetime NOT NULL default '0000-00-00 00:00:00',
 redeem_ip varchar(32) NOT NULL default '',
 order_id int(11) NOT NULL default '0',
 PRIMARY KEY  (unique_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

#
# Table structure for table `coupons`
#
CREATE TABLE coupons (
 coupon_id int(11) NOT NULL auto_increment,
 coupon_type char(1) NOT NULL default 'F',
 coupon_code varchar(32) NOT NULL default '',
 coupon_amount decimal(8,4) NOT NULL default '0.0000',
 coupon_minimum_order decimal(8,4) NOT NULL default '0.0000',
 coupon_start_date datetime NOT NULL default '0000-00-00 00:00:00',
 coupon_expire_date datetime NOT NULL default '0000-00-00 00:00:00',
 uses_per_coupon int(5) NOT NULL default '1',
 uses_per_user int(5) NOT NULL default '0',
 restrict_to_products varchar(255) default NULL,
 restrict_to_categories varchar(255) default NULL,
 restrict_to_customers text,
 coupon_active char(1) NOT NULL default 'Y',
 date_created datetime NOT NULL default '0000-00-00 00:00:00',
 date_modified datetime NOT NULL default '0000-00-00 00:00:00',
 PRIMARY KEY  (coupon_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

#
# Table structure for table `coupons_description`
#
CREATE TABLE coupons_description (
 coupon_id int(11) NOT NULL default '0',
 language_id int(11) NOT NULL default '0',
 coupon_name varchar(32) NOT NULL default '',
 coupon_description text,
 PRIMARY KEY coupon_id (coupon_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Welcome Gift Voucher Amount', 'NEW_SIGNUP_GIFT_VOUCHER_AMOUNT', '0', 'Welcome Gift Voucher Amount: If you do not wish to send a Gift Voucher in your create account email put 0 for no amount else if you do place the amount here i.e. 10.00 or 50.00 no currency signs', 1, 31, NULL, '2003-12-05 05:01:41', NULL, NULL);
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Welcome Discount Coupon Code', 'NEW_SIGNUP_DISCOUNT_COUPON', '', 'Welcome Discount Coupon Code: if you do not want to send a coupon in your create account email leave blank else place the coupon code you wish to use', 1, 32, NULL, '2003-12-05 05:01:41', NULL, NULL);
INSERT INTO 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());
INSERT INTO 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());
INSERT INTO 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());
INSERT INTO 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());
INSERT INTO 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());
INSERT INTO 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());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Total', 'MODULE_ORDER_TOTAL_GV_STATUS', 'true', 'Do you want to display the Gift Voucher value?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_GV_SORT_ORDER', '740', 'Sort order of display.', '6', '2', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Queue Purchases', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'true', 'Do you want to queue purchases of the Gift Voucher?', '6', '3','tep_cfg_select_option(array(\'true\', \'false\'), ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Shipping', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'true', 'Include Shipping in calculation', '6', '5', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Tax', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'true', 'Include Tax in calculation.', '6', '6','tep_cfg_select_option(array(\'true\', \'false\'), ', now());
INSERT INTO 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_GV_CALC_TAX', 'None', 'Re-Calculate Tax', '6', '7','tep_cfg_select_option(array(\'None\', \'Standard\', \'Credit Note\'), ', now());
INSERT INTO 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_GV_TAX_CLASS', '0', 'Use the following tax class when treating Gift Voucher as Credit Note.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Credit including Tax', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX', 'false', 'Add tax to purchased Gift Voucher when crediting to Account', '6', '8','tep_cfg_select_option(array(\'true\', \'false\'), ', now());


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

I do apologize. When I tried to send a message from the form, it kept telling me the captcha was incorrect and displaying a new one. I never did get any indication that the form completed.

 

I understand you are not the original, ORIGINAL writer of the mod however I meant that you were the last, and best, modifier of this mod. Forgive me.

 

Thanks for the SQL. I will try and and see what happens.

Share this post


Link to post
Share on other sites

@ lisa

 

You must have copied and pasted incorrectly because this is the checkout_payment.php file which was uploaded.

 

I copied this code exactly into my catalog/checkout_payment.php file, refreshed the site and still I am getting the error message that I must select a payment method even when I tick the voucher credit field. Still not working.

Share this post


Link to post
Share on other sites

I've sen

I copied this code exactly into my catalog/checkout_payment.php file, refreshed the site and still I am getting the error message that I must select a payment method even when I tick the voucher credit field. Still not working.

 

I've sent you a PM :)


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

I've upload another package which contains the missing defines in the english/create_account.php file - another oversight of mine :wacko:

 

or you can just add the following to catalog/includes/languages/english/create_account.php

 

/* CCGV ADDED - BEGIN */
define('EMAIL_GV_INCENTIVE_HEADER', "\n\n" .'As part of our welcome to new customers, we have sent you an e-Gift Voucher worth %s');
define('EMAIL_GV_REDEEM', 'The redeem code for the e-Gift Voucher is %s, you can enter the redeem code when checking out while making a purchase');
define('EMAIL_GV_LINK', 'or by following this link ');
define('EMAIL_COUPON_INCENTIVE_HEADER', 'Congratulations, to make your first visit to our online shop a more rewarding experience we are sending you an e-Discount Coupon.' . "\n" .
								    ' Below are details of the Discount Coupon created just for you' . "\n");
define('EMAIL_COUPON_REDEEM', 'To use the coupon enter the redeem code which is %s during checkout while making a purchase');
/* CCGV ADDED - END */


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

When setting a discount coupon for NEW CUSTOMERS that sign up.

 

To set it up: First create the coupon, then add the coupon to the Welcome Discount Coupon Code in Configuration ->My Store

 

Also bear in mind the following

  1. At this stage - the module does not tell the new customer what the minimum order amount is, so it is recommended to keep the "Coupon Minimum Order" to $1 - if you set it to an higher amount - the customer wont know and therefore will not be able to use the coupon if the order total is less than the Coupon Minimum Order nor will they understand why they cant use it. Customer should also only be able to use that once only. As soon as I find time again, I'll get that sorted out. It should be easy to let the new customer know that they have a discount coupon to use on their order of X amount.
     
  2. Dont set the "Uses per Coupon" and Uses per Customer" to both 1. Only set the "Uses per Customer" to 1 and leave the "Uses per Coupon" blank. If you set both to 1 that discount coupon code will only be allowed once and any other new customer will get the coupon but upon checkout, they'll get an error message and will not be able to use the coupon.
     
  3. Check the expiry date when you edit an existing coupon - the module loses the previous setting - (i havent been able to sort this out yet - if someone else knows how to fix that, please share the knowledge)

It is very important that your order totals are set correctly, please ALWAYS CHECK THAT.

  • Discount Coupons = 3 | Include Shipping = True | Include Tax = True | Recalculate Tax = Standard
  • Gift Vouchers = 5 | Include Shipping = False | Include Tax = True | Recalculate Tax = None
  • Shipping = 2
  • Sub Total = 1
  • Tax = 4
  • Total = 6

Edited by mommaroodles

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

I've upload another package which contains the missing defines in the english/create_account.php file - another oversight of mine :wacko:

 

or you can just add the following to catalog/includes/languages/english/create_account.php

 

 

That is great, works perfectly. Melanie, I know we all are appreciative of the time you put into this addon.

Share this post


Link to post
Share on other sites

@@mommaroodles I hope all is well. I'm just starting to play around with this contribution and I'm having an issues during testing while trying to send a voucher via the admin.

 

I'm receiving this error;

 

 

Warning: mysqli_insert_id() expects parameter 1 to be mysqli, null given in /home/#######/public_html/sandbox/test/includes/functions/database.php on line 193

 

Warning: Cannot modify header information - headers already sent by (output started at /home/#######/public_html/sandbox/test/includes/functions/database.php:193) in /home/#######/public_html/sandbox/test/includes/functions/general.php on line 40

 

I'm presuming the problem is this query in admin/gv_send.php;

 

// Now create the coupon main and email entry
     $insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $HTTP_POST_VARS['amount'] . "', now())");
     $insert_id = tep_db_insert_id($insert_query);
     $insert_query = tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $mail['customers_email_address'] . "', now() )"); 
   }

 

What are your thoughts?

Share this post


Link to post
Share on other sites

Just as a quick follow up. The email was received (I forgot to mention) with a voucher;

 

test voucher

 

The Gift Voucher is worth CAD $10.00

 

To redeem this Gift Voucher, please click on the link below. Please also write down the redemption code which is d502077bb1d5 in case you have any problems.

 

http://www.mysite.com/gv_redeem.php?gv_no=d502077bb1d5

 

But the voucher did not post correctly to the DB.

 

I posted to the table "coupons". Should it not post to coupon_gv_customer?

Edited by greasemonkey

Share this post


Link to post
Share on other sites

Just as a quick follow up. The email was received (I forgot to mention) with a voucher;

 

 

 

But the voucher did not post correctly to the DB.

 

I posted to the table "coupons". Should it not post to coupon_gv_customer?

 

I'll be uploading a new package soon.

 

Buttons have been changed in fav of jquery buttons, the same goes for the date picker.

 

When you deleted a discount coupon, it wasnt being deleted from the database, it was merely updating the coupons table and setting it to inactive and was being removed from the list. I've added the ability to completely remove the coupon which also then deletes it from the database. You'll be able to set coupons active or inactive.

 

I'll cleaned up and removed a lot of code that was unnecessary in the coupon_admin.php page. The emails being sent to customers have been improved. HTML Support for the mails, so they no longer just text emails.

 

When emailing a gift voucher - the email was being sent but not being updated in the database. This has also been fixed. I am busy fixing up the code for the welcome emails, once that is done, I'll upload the package.

 

There has just been a whole general clean up and improvement.


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

I'll be uploading a new package soon.

 

Buttons have been changed in fav of jquery buttons, the same goes for the date picker.

 

When you deleted a discount coupon, it wasnt being deleted from the database, it was merely updating the coupons table and setting it to inactive and was being removed from the list. I've added the ability to completely remove the coupon which also then deletes it from the database. You'll be able to set coupons active or inactive.

 

I'll cleaned up and removed a lot of code that was unnecessary in the coupon_admin.php page. The emails being sent to customers have been improved. HTML Support for the mails, so they no longer just text emails.

 

When emailing a gift voucher - the email was being sent but not being updated in the database. This has also been fixed. I am busy fixing up the code for the welcome emails, once that is done, I'll upload the package.

 

There has just been a whole general clean up and improvement.

 

Melanie,

 

I look forward to the new version. One quick mention, if possible, could you mention in the instructions the files to edit for custom verbiage in the sent emails as well as listing any known problems in the install file for quick reference. Your instructions are quite explicit which is great however a mention would be nice as an addition.

 

Guys, this work is great. The module is perfecto and Melanie is the bomb.

Share this post


Link to post
Share on other sites

lol - Thanks sweetie pie - I wasnt going to do the instructions,but for you, I'll take a bit of time and try and make it as easy as possible - dont spend to much time on - in fact start removing the module, best to start over with the one I'm going to upload.

 

I just need to test the welcome gift voucher and discount coupon, I may make a few screen casts. I'm just so busy with work at the moment though :)


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

lol - Thanks sweetie pie - I wasnt going to do the instructions,but for you, I'll take a bit of time and try and make it as easy as possible - dont spend to much time on - in fact start removing the module, best to start over with the one I'm going to upload.

 

I just need to test the welcome gift voucher and discount coupon, I may make a few screen casts. I'm just so busy with work at the moment though :)

 

Will start removing this weekend. I had to re-do my site anyway and a new version would be wonderful for a totally new site.

Share this post


Link to post
Share on other sites

lol - Thanks sweetie pie - I wasnt going to do the instructions,but for you, I'll take a bit of time and try and make it as easy as possible - dont spend to much time on - in fact start removing the module, best to start over with the one I'm going to upload.

 

I just need to test the welcome gift voucher and discount coupon, I may make a few screen casts. I'm just so busy with work at the moment though :)

thanks for your contribution, did you upload the one you were talking but on the 16 may 2014? because the last uploaded package was uploaded on 10 may 2014

can you clear up my confusion please

Thanks

Share this post


Link to post
Share on other sites

Will start removing this weekend. I had to re-do my site anyway and a new version would be wonderful for a totally new site.

dear L Haase,

did you get the new version, around 16 may 2014?

looks like madam Melanie is very busy and not been around for a few weeks, I will love to get my hands on the new version she was working on with html emails + more, are you in touch with her?

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

×