Discount Codes
Fatal Error - Discount Codes
Fatal Error
Hi dear;
I am using 1.0.8.15
When I input a discount code on checkout_payment.php
It always shows that Discount is invalid.
On further debugging I checked the Network tab of Console
The discount_code.php gives fatal error while performing xhr
Fatal error</b>: DB: [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 '@xx.com
AND customers_guest = '1')' at line 3 from <SELECT count(*) AS orders
FROM orders
WHERE customers_email_address = xx@xx.com
AND customers_guest = '1');> in <b>/xx/includes/system/versioned/1.0.8.1/database_core.php</b> on line <b>44</b><br />
Also I would like to mention that I do have PWA installed- but I tried adding a discount code with a registered account.
Please can you help fix the error dear;
Thank you in advance;
Regds./
radhavallabh
I am using 1.0.8.15
When I input a discount code on checkout_payment.php
It always shows that Discount is invalid.
On further debugging I checked the Network tab of Console
The discount_code.php gives fatal error while performing xhr
Fatal error</b>: DB: [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 '@xx.com
AND customers_guest = '1')' at line 3 from <SELECT count(*) AS orders
FROM orders
WHERE customers_email_address = xx@xx.com
AND customers_guest = '1');> in <b>/xx/includes/system/versioned/1.0.8.1/database_core.php</b> on line <b>44</b><br />
Also I would like to mention that I do have PWA installed- but I tried adding a discount code with a registered account.
Please can you help fix the error dear;
Thank you in advance;
Regds./
radhavallabh
-
- VIP Member
- Posts: 369
- Joined: Tue Oct 27, 2020 4:09 am
- Contact:
Re: Fatal Error
in includes/modules/order_total/ot_discount.php line 129
change:
to:
Please confirm and I'll update the module.
change:
Code: Select all
AND customers_guest = '1');
Code: Select all
AND customers_guest = 1
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
- PhoenixCart Developer
- Posts: 1212
- Joined: Sat Dec 21, 2019 8:08 am
- : Buy Me A Beverage
- Contact:
Re: Fatal Error
Hi dear;raiwa wrote:in includes/modules/order_total/ot_discount.php line 129
change:to:Code: Select all
AND customers_guest = '1');
Please confirm and I'll update the module.Code: Select all
AND customers_guest = 1
Error still same error persists...
this time just it changes from '1' to 1
Fatal error: DB: [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 '@xx.com AND customers_guest = 1)' at line 3 from....
Warm Regds./
radhavallabh
-
- VIP Member
- Posts: 369
- Joined: Tue Oct 27, 2020 4:09 am
- Contact:
Re: Fatal Error
Please post your modified code
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
- PhoenixCart Developer
- Posts: 1212
- Joined: Sat Dec 21, 2019 8:08 am
- : Buy Me A Beverage
- Contact:
Re: Fatal Error
Hi dear;raiwa wrote:Please post your modified code
Here it is-
Code: Select all
$check_mail = $check_query_mail->fetch_assoc();
if (!empty($check_mail['customers_email_address'])) {
$check_query_order_guest = $db->query(sprintf(<<<'EOSQL'
SELECT count(*) AS orders
FROM orders
WHERE customers_email_address = %s
AND customers_guest = 1);
EOSQL
, $check_mail['customers_email_address']));
radhavallabh
-
- VIP Member
- Posts: 369
- Joined: Tue Oct 27, 2020 4:09 am
- Contact:
Re: Fatal Error
you didn't apply the modification as posted.
This:
must be:
Remove also the parentesis and semicolon!
This:
Code: Select all
AND customers_guest = 1);
Code: Select all
AND customers_guest = 1
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
- PhoenixCart Developer
- Posts: 1212
- Joined: Sat Dec 21, 2019 8:08 am
- : Buy Me A Beverage
- Contact:
Re: Fatal Error
Hi;raiwa wrote:you didn't apply the modification as posted.
This:must be:Code: Select all
AND customers_guest = 1);
Remove also the parentesis and semicolon!Code: Select all
AND customers_guest = 1
Sorry I did not check dear-
Now the code I used is
Code: Select all
$check_mail = $check_query_mail->fetch_assoc();
if (!empty($check_mail['customers_email_address'])) {
$check_query_order_guest = $db->query(sprintf(<<<'EOSQL'
SELECT count(*) AS orders
FROM orders
WHERE customers_email_address = %s
AND customers_guest = 1
EOSQL
, $check_mail['customers_email_address']));
Fatal error: DB: [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 '@xx.com AND customers_guest = 1' at line 3 from
Please help fix the issue dear;
Very Warm Regds./
radhavallabh
-
- VIP Member
- Posts: 369
- Joined: Tue Oct 27, 2020 4:09 am
- Contact:
Re: Fatal Error
try this:
Note: single quotes added around %s
Code: Select all
WHERE customers_email_address = '%s'
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
- PhoenixCart Developer
- Posts: 1212
- Joined: Sat Dec 21, 2019 8:08 am
- : Buy Me A Beverage
- Contact:
Re: Fatal Error
Same issue dear discount code shows as invalid- Now I get a 0 as Response in console dearraiwa wrote:try this:Note: single quotes added around %sCode: Select all
WHERE customers_email_address = '%s'
Code
Code: Select all
$check_mail = $check_query_mail->fetch_assoc();
if (!empty($check_mail['customers_email_address'])) {
$check_query_order_guest = $db->query(sprintf(<<<'EOSQL'
SELECT count(*) AS orders
FROM orders
WHERE customers_email_address = '%s'
AND customers_guest = 1
EOSQL
-
- VIP Member
- Posts: 369
- Joined: Tue Oct 27, 2020 4:09 am
- Contact:
Re: Fatal Error
If you get a zero as response without error message, then it seems the discount code does not get validated for some reason. Please check all options.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
- PhoenixCart Developer
- Posts: 1212
- Joined: Sat Dec 21, 2019 8:08 am
- : Buy Me A Beverage
- Contact: