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
want to make changes, but what to edit
- Kofod95
- 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
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
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
Here are a lot of corns: Phoenix user guide
Re: want to make changes, but what to edit
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
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
Re: want to make changes, but what to edit
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 ?
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 ?
- Kofod95
- 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
This is not something I've tried myself, so I may be way off..
I think the error comes from this:
I don't know the correct way to get things from the upload, but maybe:
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 think the error comes from this:
Code: Select all
$products_image["tmp_name"]
Code: Select all
$products_image->tmp_name
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
Re: want to make changes, but what to edit
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
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
- Kofod95
- 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
Trust me, I know that feeling!
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
Here are a lot of corns: Phoenix user guide
Re: want to make changes, but what to edit
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
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