OK, thanks. I will do some testing to see if I can figure it out.
I haven't looked at the complete code, but I think you can use something like:
PHP Code:
if(isset($_GET['cID']) && ($_GET['cID'] == $notes_active->customers_id) && !isset($_GET['gID']) ||(($notes_customer_result->RecordCount() > 0) && ($notes_customer_result->fields['customers_id'] == $notes_active->customers_id)) && !isset($_GET['gID']))
Zen cart installation / maintenance / customisation / hosting
Supported Modules: Dutch language pack, Multi site, Dynamic Price Updater and more.
That's your answer then. Prefix references to $notes_customer_result by
!empty($notes_customer_result) && ...
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Yes, that did it. Was just about to comment before you posted. Small win for figuring it out haha. Thanks to you both for helping! For anyone else, the complete line should be:PHP Code:
if(isset($_GET['cID']) && ($_GET['cID'] == $notes_active->customers_id) && !isset($_GET['gID']) ||(!empty($notes_customer_result->fields['customers_id']) && ($notes_customer_result->fields['customers_id'] == $notes_active->customers_id)) && !isset($_GET['gID']))
Has this been tested with ZC 1.5.7 yet?
I installed on a test server. Displays the initial note on the admin page, but delivered an error log:
Code:[15-Jan-2021 16:47:17 America/Chicago] Request URI: /XXXX/index.php?cmd=notes&nID=1, IP address: XXXX #1 zen_get_notes_categories_array() called at [/XXXX/notes.php:193] #2 require(/XXXX/notes.php) called at [/XXXX/index.php:11] --> PHP Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /XXXX/notes.php on line 183.
i've never used it. in a cursory look, it could use a complete refactor. i'm guessing this is just one of many sort of errors in the code. last updated almost 4 years ago.
for your specific error, you can try replacing the appropriate section as follows:
best.PHP Code:
function zen_get_notes_categories_array($all = false){
global $db;
$categories = $db->Execute("SELECT * FROM " . TABLE_NOTES_CATEGORIES . " ORDER BY notes_categories_name");
if($all == true){
$categories_array[] = ['id' => 0, 'text' => 'All'];
}
while(!$categories->EOF){
$categories_array[] = ['id'=> $categories->fields['notes_categories_id'], 'text' => $categories->fields['notes_categories_name']];
$categories->MoveNext();
}
return $categories_array;
}
After replacing the code, this error log was created...
Code:[15-Jan-2021 20:13:43 America/Chicago] Request URI: /XXkcaz00/index.php?cmd=notes&page=1&nID=6&action=edit, IP address: 184.170.174.172 #1 require(/XXkcaz00/notes.php) called at [/XXkcaz00/index.php:11] --> PHP Warning: Use of undefined constant TEXT_INFO_NOTE_PRIORITY - assumed 'TEXT_INFO_NOTE_PRIORITY' (this will throw an Error in a future version of PHP) in /XXkcaz00/notes.php on line 425.
Bookmarks