image upload on account edit/create

Open to all! Ask other shopowners for help.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

image upload on account edit/create

Post by LeeFoster »

Afternoon all,

I am working on adding an image upload to the account edit & create pages using a hook, I believe I have most of it done but I am having an issue when trying to upload the image.

When I try to do the upload I am getting the below error. I know I must have missed something or I'm not including a connection to the class so if someone can help it is much appreciated.
Fatal error: Uncaught Error: Class 'upload' not found


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: image upload on account edit/create

Post by ecartz »

You have to copy the class from admin/includes/classes/ to one of the catalog locations, e.g. includes/system/override/
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: image upload on account edit/create

Post by LeeFoster »

ecartz wrote: Thu Feb 17, 2022 2:23 pm You have to copy the class from admin/includes/classes/ to one of the catalog locations, e.g. includes/system/override/
Yep, that got rid of the error. Now I just need to figure out why it doesn't upload the file or insert the file name into the DB.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: image upload on account edit/create

Post by ecartz »

LeeFoster wrote: Thu Feb 17, 2022 2:44 pm Now I just need to figure out why it doesn't upload the file or insert the file name into the DB.
Did you change the form enctype to match the other forms where an upload occurs? E.g. https://github.com/CE-PhoenixCart/Phoen ... t.php#L114
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: image upload on account edit/create

Post by LeeFoster »

ecartz wrote: Thu Feb 17, 2022 3:30 pm
LeeFoster wrote: Thu Feb 17, 2022 2:44 pm Now I just need to figure out why it doesn't upload the file or insert the file name into the DB.
Did you change the form enctype to match the other forms where an upload occurs? E.g. https://github.com/CE-PhoenixCart/Phoen ... t.php#L114
I'm gonna say yes but we both know I didn't so I'm going to go look into that now
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: image upload on account edit/create

Post by LeeFoster »

Made progress and have the function working for when I'm editing an account, need to get it to insert now for new accounts.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: image upload on account edit/create

Post by LeeFoster »

@ecartz is a hook the right way to do this or is creating a customer data module a better option?
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: image upload on account edit/create

Post by ecartz »

You can use the same customer data module on both pages. You'd need two hooks for that.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: image upload on account edit/create

Post by LeeFoster »

ecartz wrote: Thu Feb 17, 2022 6:13 pm You can use the same customer data module on both pages. You'd need two hooks for that.
So customer data module is better then
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: image upload on account edit/create

Post by LeeFoster »

Working with the cd modules and have the file upload showing I just need to get the file to upload and the data in the the db now.

If anyone has done this or has any ideas please shout up.


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