S04e11 - Admin comments QUESTIONS/SUPPORT

Open to all! Ask other shopowners for help.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

S04E11 - Admin Notes

Post 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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: S04E11 - Admin Notes

Post by ecartz »

I uploaded a new package.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: S04E11 - Admin Notes

Post 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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: S04E11 - Admin Notes

Post by Kofod95 »

@ecartz

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

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
admin
Contributor
Posts: 217
Joined: Wed Oct 30, 2019 1:34 pm
Phoenix Version:
Has thanked: 20 times
Been thanked: 22 times

S04e11 - Admin comments QUESTIONS/SUPPORT

Post 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
azpro
Contributor
Posts: 177
Joined: Fri Nov 06, 2020 8:25 am
Phoenix Version: v1.1.0.6
Has thanked: 30 times
Been thanked: 34 times

Re: S04e11 - Admin comments

Post 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.
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 25 times

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Post by frankl »

How to delete a customer's memo when the customer is deleted?
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 25 times

Re: S04e11 - Admin comments QUESTIONS/SUPPORT

Post 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!


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply