Sounds like a puzzling folder structure.
Sounds like a puzzling folder structure.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
If you have your ZenCart in a folder - - say "shop"
Try this and adjust for the folder name where you do have ZenCart installed
Code:require('shop/includes/application_top.php');
Zen-Venom Get Bitten
Zen cart is installed at root and my new folder is also placed at the root.
I'm also confused why this error comes if i remove '../' before the folder path.
I'm trying to fix this error.
Okay, if your script is stuffed into another folder, then yes you'll need to use the "../" to get it to load.
As for why your json script breaks, that's impossible to know without having a complete copy of your script and knowing what exactly it's trying to do.
Maybe you should turn on PHP error reporting and see what errors are being encountered by your script?
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Can you tell me how can I turn on PHP error reporting?
Dr. Byte, i want to store new data into the database using $db->Execute function.
Is there any specific file i can include at the top to access this function?
PHP Code:
This code works fine but if i include require('../includes/application_top.php'); at the top the script stops working.Code:require('../admin/includes/functions/database.php'); if ($_POST['submit_personal']) { /* First Name validations Start */ if (empty($_POST['firstname'])) { $message['status'] = false; $message['position'] = 'firstname'; $message['message'] = ' Enter first name...'; echo json_encode($message); } else if (!preg_match("#^[-A-Za-z' ]*$#",$_POST['firstname'])) { $message['status'] = false; $message['position'] = 'firstname'; $message['message'] = ' Not a valid first name...'; echo json_encode($message); } /* First Name validations End */ else { $query = "INSERT INTO my_table (expert_id, expert_firstname ) VALUES ('NULL', '".zen_db_prepare_input($_POST['firstname'])."' )" ; mysql_query($query); $_SESSION['expert_id'] = zen_db_insert_id(); $message['status'] = true; $message['message'] = 'Your personal data is successfully added'; echo json_encode($message); } }
You can't re-load that database.php file if you've already loaded application_top. You'll need to remove that line.
And, if this is all intended to be admin-side, then you should be loading the *admin* application_top, not the storefront one.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Dr. Byte i have found one problem when i include
require('../includes/application_top.php');
That AJAX stops working, whatever i send to JS file using echo command nothing appears on JS file.
I'm using JQUERY as shown:
success: function(response, status){
alert(response.length);
}
The length received is 0 but if i remove the application_top.php file i receive 167 bytes in response variable from PHP script.
Do you think there is any problem with application_top.php which hinders AJAX Call back?
P.S: I'm working on Store end not Admin end.
Using application top is appropriate and much safer than trying to include functions independently of their context.
However, to do so your admin ajax handler would need to be in your admin's root folder. From your path names, it looks as though you have it in a folder sitting alongside the place it needs to be.
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
Bookmarks