Page 1 of 2

S04E11 - Admin Notes

Posted: Sun Nov 28, 2021 10:25 pm
by Kofod95
@ecartz
1.0.8.8 on Xampp (Windows)

admin/memo.php throws:

Code: Select all

Notice: Undefined variable: products_sql in C:\Xampp\htdocs\1.0.8.8\admin\includes\actions\memo\views\default.php on line 87

Fatal error: DB: [1064] You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 
'LIMIT 0, 20' at line 1 from < LIMIT 0, 20> in C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\database_core.php on line 44
Memos are still added to the database, when saved.

On product-edit:

Code: Select all

Warning: Use of undefined constant CUSTOMERS_COMMENTS_TITLE - assumed 'CUSTOMERS_COMMENTS_TITLE' (this will throw an Error in a future version of PHP) in C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php on line 29

Warning: Use of undefined constant CUSTOMERS_COMMENTS_LABEL - assumed 'CUSTOMERS_COMMENTS_LABEL' (this will throw an Error in a future version of PHP) in C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php on line 30
And when pressing save:

Code: Select all

Fatal error: Uncaught ArgumentCountError: 
Too few arguments to function database_core::perform(), 1 passed in C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php on line 63 
and at least 2 expected in C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\database_core.php:105 
Stack trace: 
#0 C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php(63): database_core->perform(Array) 
#1 C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php(69): hook_admin_catalog_admin_comments->listen_productActionSave() 
#2 C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\hooks.php(150): hook_admin_catalog_admin_comments->listen_updateProductAction(Array) 
#3 C:\Xampp\htdocs\1.0.8.8\admin\includes\segments\process_action.php(19): hooks->cat('updateProductAc...') 
#4 C:\Xampp\htdocs\1.0.8.8\admin\catalog.php(32): require('C:\\Xampp\\htdocs...') 
#5 {main} thrown in C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\database_core.php on line 105
Memo not saved.

Same with customer-edit and order-edit

//Daniel

Re: S04E11 - Admin Notes

Posted: Wed Dec 01, 2021 2:24 pm
by ecartz
I uploaded a new package.

Re: S04E11 - Admin Notes

Posted: Wed Dec 01, 2021 6:59 pm
by Kofod95
ecartz wrote: Wed Dec 01, 2021 2:24 pm I uploaded a new package.
admin/memo.php throws:
Fatal error: DB: [1064] You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY products_name' at line 1 from
admin/memo.php?action=do_csv does not create a file for download

Editing a note throws:
Notice: Undefined index: page in C:\Xampp\htdocs\1.0.8.8\admin\includes\actions\memo\views\edit.php on line 18
Saving a product with a note throws:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function database_core::perform(), 1 passed
in C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php on line 68
and at least 2 expected in C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\database_core.php:105
Stack trace: #0 C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php(68): database_core->perform(Array)
#1 C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\catalog\admin_comments.php(74): hook_admin_catalog_admin_comments->listen_productActionSave()
#2 C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\hooks.php(150): hook_admin_catalog_admin_comments->listen_updateProductAction(Array)
#3 C:\Xampp\htdocs\1.0.8.8\admin\includes\segments\process_action.php(19): hooks->cat('updateProductAc...')
#4 C:\Xampp\htdocs\1.0.8.8\admin\catalog.php(32): require('C:\\Xampp\\htdocs...')
#5 {main} thrown in C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\database_core.php on line 105
Similar on adding comment to an order:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function database_core::perform(),
1 passed in C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\orders\admin_comments.php on line 66
and at least 2 expected in C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\database_core.php:105
Stack trace: #0 C:\Xampp\htdocs\1.0.8.8\includes\hooks\admin\orders\admin_comments.php(66): database_core->perform(Array)
#1 C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\hooks.php(150): hook_admin_orders_admin_comments->listen_updateOrderAction(Array)
#2 C:\Xampp\htdocs\1.0.8.8\admin\includes\actions\orders\update_order.php(46): hooks->cat('updateOrderActi...')
#3 C:\Xampp\htdocs\1.0.8.8\admin\includes\segments\process_action.php(18): require('C:\\Xampp\\htdocs...')
#4 C:\Xampp\htdocs\1.0.8.8\admin\orders.php(16): require('C:\\Xampp\\htdocs...')
#5 {main} thrown in C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.1\database_core.php on line 105
//Daniel

Re: S04E11 - Admin Notes

Posted: Tue Dec 14, 2021 9:54 am
by Kofod95
@ecartz

I forgot to tag you last time, sorry!
The above errors still persists

//Daniel

S04e11 - Admin comments QUESTIONS/SUPPORT

Posted: Tue Jan 04, 2022 6:23 am
by admin
Addon:
This addon allows the shopowner to make private comments about customers, products etc.

Download:
viewtopic.php?f=28&t=1069

Questions / Comments / Concerns in this Thread

Re: S04e11 - Admin comments

Posted: Thu Sep 14, 2023 9:39 pm
by azpro
I am wondering where the table memo is inserted in Database? Do I need a .sql file? Because I don't see a sql file in the package.

Or is the table memo somewhere in a file created? If yes - where?

Thanks!

EDIT
- Sorry! I missed the .md file ... my bad! The SQL is in the .md file.

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Posted: Mon Sep 30, 2024 12:34 am
by frankl
How to delete a customer's memo when the customer is deleted?

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Posted: Mon Sep 30, 2024 8:15 am
by burt
frankl wrote: Mon Sep 30, 2024 12:34 am How to delete a customer's memo when the customer is deleted?
It's a distinct possibility that I never coded in a delete feature.

Probably best way would be to add an extra listener to the customer Hook in this addon, as that won't touch core code. listen_deleteAction <-- that might be the correct listener.

If I have time later I will load the latest version.

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Posted: Mon Sep 30, 2024 9:11 am
by burt
I've not tested this, but a cursory look at the code...I think this might work;

Code: Select all

public function listen_deleteConfirmAction() {
  global $customers_id;
    
  $GLOBALS['db']->query("DELETE FROM memo WHERE memo_key = 'customers_id' AND memo_value = " . (int)$customers_id);
}
added to /includes/hooks/admin/customers/admin_comments.php

When a customer is deleted via admin/customers.php this should invoke and remove any stored memo(s) of customers_id/$customers_id

When testing, make sure it doesn't delete any other customers memos - it shouldn't. Let me know if it works or if you ake changes and I can update the download package with this new addition. Ta.

If shopowner deletes customers a different way (eg direct in phpmyadmin or whatever), this hook wouldn't invoke. I know you know that :+1: , but someone reading in the future may not realise.

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Posted: Tue Oct 01, 2024 10:41 pm
by frankl
That worked a treat!

However I couldn't find a hook anywhere in the code or database with that name.

I'm assuming it works because a hook like this will work on any action in admin/includes/actions folder? if so, excellent information!