I installed the credit module and I got the error quoted below. Does anyone know how to solve this error?
Printable View
I solved the errors I had by doing this:
tpl_store_credit.php needs to be moved from
/includes/templates/template_default/
into
includes/ templates/template_default/sideboxes/
ot_sc.php is used twice. (not the same file content)
It is in the download as:
/includes/modules/order_total/ot_sc.php
In post #17 of this thread xtremeimpulse created the other ot_sc.php needed and put it into /includes/lanquages/modules/order_total/.
But it should be put into /includes/modules/order_total/. (not in /languages)
Anyway I made those changes and it seems to work at least through step2 of checkout.
Using the information supplied by posts #17 and 22, (and a bit of tweaking) I believe I've been able to work out the issues with this very useful module.
First, as stated in post #22, the tpl_store_credit.php was misplaced in the original download. Rather than includes/templates/template_default/, it needs to be placed in includes/templates/template_default/sideboxes/.
Secondly, as xtremeimpulse mentioned in post #17, a second ot_sc.php file is needed. However, there was a bit of a glitch in that suggested code.
The following, saved as ot_sc.php and placed in includes/languages/english/modules/order_total/, did the trick for me:
Kath, (funtimesx) thanks for a terrific module!!PHP Code:
<?php
/* Start Store Credit Order Total Module */
define('MODULE_ORDER_TOTAL_SC_TITLE', 'Store Credit');
define('MODULE_ORDER_TOTAL_SC_HEADER', 'Store Credit');
define('MODULE_ORDER_TOTAL_SC_DESCRIPTION','Your balance is');
define('MODULE_ORDER_TOTAL_SC_USER_PROMPT','Prompt ');
define('MODULE_ORDER_TOTAL_SC_SORT_ORDER','Sort Order');
/* End Store Credit Order Total Module */
?>
Tim
Strange when I changed it to your script it did not work, changed back and it worked again.
But now I have a checkout error. After clicking confirm order this error appears and the checkout process stops but the credit card is charged:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where customer_id=1' at line 1
in:
[update sc_customer set amount = amount - where customer_id=1]
Any help solving this error will be appreciated!
I removed this:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
from Line 58 in /admin/store_credit.php and now everything seems to work.
Does removing that line cause some other problem?
Now another error.
When the customer has a credit due everything works fine.
But when the customer does not have credit this error occurs after clicking confirm order.
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where customer_id=1' at line 1
in:
[update sc_customer set amount = amount - where customer_id=1]
Yes, I'm getting exactly the same error. In fact, because of other more pressing site issues I've removed the SQL completely and abandoned this module for the time being. It seems the module originator may have backed out and since there isn't enough other forum traffic to help resolve some of these problems, it isn't worth having it installed.
It's a shame because I think it could be a very useful module for many people but I just don't have the php expertise to work out these problems without some guidance.
I hope down the road interest will be peaked and the thread will be brought back to life.
Well, I have it working after some tweaking. The only thing i can suggest for the above sql problem is in the ot_sc.php module in order_totals you might try someting like this
function get_user_balance(){
global $db;
if(isset($_SESSION['customer_id'])){
$check_query = $db->Execute("select amount from " . TABLE_STORE_CREDIT . " where customer_id = ".$_SESSION['customer_id']);
$amount = $check_query->fields['amount'];
return $amount;
}else{
$amount = 0;
}
}
This may not work. I honestly can't remember what I did to fix the issue earlier lol. Sorry. If this doesn't work and I remember for sure I will post it. At this point its been a long night.
WHAT I REALLY NEED FOR THIS DEAL TO DO IS allow the customer to select how much of the credit they want to use. If anyone knows how to do that I would really appreciate it. I will continue working on this option myself but any input would be great.