- Posts: 431
- Thank you received: 19
Insert data into another table (Database)
Please Log in or Create an account to join the conversation.
How are you uploading your file ? The Joomla media manager ? The upload function in the HikaShop products ? A CSV import ? Custom upload fields ?
Regarding the upload function in the HikaShop products, there are no triggers for now. You would have to use onBeforeProductCreate and onBeforeProductUpdate or onAfterProductCreate and onAfterProductUpdate to look for them in hikashop_file and add the information in the table if not already there.
We'll add triggers to the file saving process with the next version as I think it's a good idea. We'll add the triggers onBeforeFileCreate onBeforeFileUpdate onAfterFileCreate and onAfterFileUpdate
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I don't see why it wouldn't work.
Check that your plugin is installed and activated, and that you don't have a mass action on the product_quantity which could mess with this.
To check that your trigger is being called, set $do to false and save a product. If the save fails, it means that the code is being called.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You may want to update your Hikashop to 4.2.1 version. As log states it is already available:
[ www.hikashop.com/support/documentation/5...ashop-changelog.html
Thanks
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You can add the code:
We'll add that on our end too.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
You should have every information you need through the $file variable, could you give us more information about the information you'll need ? Thank you.
Kind regards,
Mohamed Thelji
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
This one is a simple one. It's just triggered when a file is being updated. It's triggered when you click on the "ok" button of the image / file edition popup of a product / category in the backend. I think you can do a var_dump of $file and then an exit in that function of your plugin to see the var_dump in the image edition popup after you click on that ok button.
Now, looking at the code of the "save" function in administrator/components/com_hikashop/classes/file.php I can see an issue with the code there.
The lines:
if(empty($new)) {
should actually be:
if($new) {
I think that's why you have that issue.
Please Log in or Create an account to join the conversation.
To clarify exactly what needs to happen, I will write in detail. After uploading a file through Hikamarket (products - front end), information is sent to the trigger, which in turn creates a new row in the database.
Please Log in or Create an account to join the conversation.
That's a good point. You can add the line:
$file->file_id = $status;
before the line:
$app->triggerEvent('onAfterFileCreate', array( &$file ));
in administrator/components/com_hikashop/classes/file.php so that you'll get the file_id in the trigger.
We'll do the change on our end too for the next version.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
There's already a trigger after delete:
onAfterFileDelete( &$ids, &$type )
where $type is the type of file being deleted (category, file, watermark, image) and $ids a list of ids of files deleted.
Please Log in or Create an account to join the conversation.