want to make changes, but what to edit

Ask the community for help with CE Phoenix Cart.
Post Reply
Boelle
Posts: 12
Joined: Tue Sep 13, 2022 4:08 pm

want to make changes, but what to edit

Post by Boelle »

basicly i want to change how products are stored

and i want pictures etc to be stored in database rather than as files

but i have searched near and far and have yet to discover what files (or multiple of them) that do the actual writing to the database when a product is saved

any pointers are welcome
User avatar
Kofod95
VIP Member
VIP Member
Posts: 661
Joined: Sat Feb 06, 2021 7:38 pm
Has thanked: 80 times
Been thanked: 145 times

Re: want to make changes, but what to edit

Post by Kofod95 »

https://github.com/CE-PhoenixCart/Phoen ... roduct.php

For insert and

https://github.com/CE-PhoenixCart/Phoen ... roduct.php

For update/edit

You can use hooks to add actions, but if you want to re-write it completely, I think you'd be best off adding a new action and then use hooks to either redirect to that or insert a button that points to that instead of the default action.

Hope this helps

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Boelle
Posts: 12
Joined: Tue Sep 13, 2022 4:08 pm

Re: want to make changes, but what to edit

Post by Boelle »

no in fact i just want to be able to add files to a product directly,

and the reason for doing it in database is that my hoster offers limited space BUT UNlimited sql

and i was pondering my mind creating a site with legal retro games, ie where copyrights have run out or where companies are not arround and no one else has the gotten the IP

i know that i can make products downloadable but i find the process a bit "tiresome" compared to just add data files and its done

looking at it now and will sure ask for help

first step is to the image to go in database, then expand on that idea
Boelle
Posts: 12
Joined: Tue Sep 13, 2022 4:08 pm

Re: want to make changes, but what to edit

Post by Boelle »

i used this small guide: https://adnan-tech.com/save-and-downloa ... mysql.html

from that i extracted that in the php file i need to change arround line 30 first to:

$products_image = new upload('products_image');
$blob = addslashes(file_get_contents($products_image["tmp_name"]));
// $products_image->set_destination(DIR_FS_CATALOG_IMAGES);
if ($products_image->parse() && $products_image->save()) {
// $sql_data['products_image'] = Text::prepare($products_image->filename);
$sql_data['products_image'] = $blob;


does that look about right? answer is no

Fatal error: Uncaught Error: Cannot use object of type upload as array in /var/www/emoncms.net/test/admin/includes/actions/catalog/insert_product.php:31 Stack trace: #0 /var/www/emoncms.net/test/admin/includes/segments/process_action.php(19): require() #1 /var/www/emoncms.net/test/admin/catalog.php(32): require('/var/www/emoncm...') #2 {main} thrown in /var/www/emoncms.net/test/admin/includes/actions/catalog/insert_product.php on line 31


So where did i F up ? :?
User avatar
Kofod95
VIP Member
VIP Member
Posts: 661
Joined: Sat Feb 06, 2021 7:38 pm
Has thanked: 80 times
Been thanked: 145 times

Re: want to make changes, but what to edit

Post by Kofod95 »

This is not something I've tried myself, so I may be way off..

I think the error comes from this:

Code: Select all

$products_image["tmp_name"]
I don't know the correct way to get things from the upload, but maybe:

Code: Select all

$products_image->tmp_name
Still, I think it would be better to place a hook in includes/hooks/admin/catalog listening to inject_redirects (or whatever it's called), that redirects the action to your new action (you'd probably need two listeners; one for insertProductAction and another for saveProductAction, and similarily two new actions).

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Boelle
Posts: 12
Joined: Tue Sep 13, 2022 4:08 pm

Re: want to make changes, but what to edit

Post by Boelle »

yeah, the problem is more my skills... simple stuff i can just get by, ie hack one block out and insert another

i wonder if it would be faster to get a dev to do it and maybe less headache..... will let me grey soup on top of the shoulders simmer on that thought...

if all it takes a few hours (1-3) then yeah i would go for that, or pile up some cash if it takes longer
User avatar
Kofod95
VIP Member
VIP Member
Posts: 661
Joined: Sat Feb 06, 2021 7:38 pm
Has thanked: 80 times
Been thanked: 145 times

Re: want to make changes, but what to edit

Post by Kofod95 »

Boelle wrote: Wed Feb 01, 2023 3:35 pm yeah, the problem is more my skills...
Trust me, I know that feeling!
Boelle wrote: Wed Feb 01, 2023 3:35 pm i wonder if it would be faster to get a dev to do it and maybe less headache.....
Often, I'm surprised at how quickly the Certified Developers are to acomplish what I think is very difficult and complicated. They really know their stuff and they know PhoenixCart, so no doubt it wouldn't hurt asking!

It's an interesting project you got going, so I'm looking forward to see how things progress :)

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Boelle
Posts: 12
Joined: Tue Sep 13, 2022 4:08 pm

Re: want to make changes, but what to edit

Post by Boelle »

yep,

the reason i came to think about it is that to find the old retro games are hard to start with

when you find them they are often cracks or otherwise modified... or if they even load in say wise

of course some may laugh at it when i say it should be legal and when copyright runs out, for c64 games that is about 1982+70years so in 29 years the first games run out of copyright

that is if those companies that published them are not bought up by others
(danish and most eu copyright says it this way)


and the mod's i want to make is as said before to make use of that i have unlimited sql database but limited space for files

and to create a "product" should be simple, ie datafiles and images and books etc should be on the same form
KISS
Post Reply