Is it possible to override the admin/includes/actions/catalog/update_product.php file? If so, where do I put that override file?
I have a lot of custom fields in my products tables. These are all placed on the edit product page with hooks but the only way I have been able to get changes saved to the db is by editing this core file.
Override admin file?
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: Override admin file?
You can do it changing the action name to the name of your overridden action like explained in my post for a overridden view action:
https://phoenixcart.org/forum/viewtopic ... 654#p23654
But you do not need to override the complete core action and its better not to do it. Like this, if the core action is updated, you do not have to care to apply the update to your overridden action.
There are hook listeners for the update and insert actions and you can place the functions in the same admin catalog hook you already have.
Here an example:
https://phoenixcart.org/forum/viewtopic ... 654#p23654
But you do not need to override the complete core action and its better not to do it. Like this, if the core action is updated, you do not have to care to apply the update to your overridden action.
There are hook listeners for the update and insert actions and you can place the functions in the same admin catalog hook you already have.
Here an example:
Code: Select all
function listen_productActionSave() {
global $db;
if (isset($_POST['product_id']) && isset($_POST['myinput'])) {
$products_id = Text::input($_POST['product_id']);
$sql_data_array = [
'myinput' => (int)Text::input($_POST['myinput']),
];
$db->perform('products', $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
}
}
public function listen_updateProductAction() {
$this->listen_productActionSave();
}
public function listen_insertProductAction() {
$this->listen_productActionSave();
}
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27