multi-vendor plugin - process uploaded files

  • Posts: 114
  • Thank you received: 14
11 years 2 months ago #124190

Hi

My site uses hikamarket multi-vendor to allow users to sell downloadable files.

I want to create a plugin to perform some actions on the files uploaded by my users.

I will then use this information to populate some custom fields that are viewable on the product page.

I have looked in the documentation but cannot see any events related to file handling so am not sure of how to proceed other than to make some core hacks.

Any advice, ideas or pointers greatly appreciated.

TIA

/DM

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 2 months ago #124195

Hi,

Why not use the onAfterProductCreate and onAfterProductUpdate triggers of HikaShop for that ?
Even when the products are created/edited via HikaMarket on the frontend, these triggers should allow you to plug yourself after the product edition/creation and allow you to access the files uploaded by the users.

The following user(s) said Thank You: DeeEmm

Please Log in or Create an account to join the conversation.

  • Posts: 114
  • Thank you received: 14
11 years 2 months ago #124227

Hi Nicolas.

Thanks for the prompt reply.

Was getting late last night and I seemed to have missed the obvious. Guess I was not thinking straight o_O

Can I access any of the file data information directly from within the onAfterProductCreate method? eg as an attribute of $element or will I need to extract this information manually by cross referencing #__hikashop_product.product_id and #__hikashop_file.file_ref_id

TIA

/DM

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 2 months ago #124290

Hi,

I checked the code and I see that there is no specific triggers for the "file save" in HikaShop and HikaMarket does not add triggers for the "file upload" in the front-end.
For the trigger "onAfterProductCreate" and "onAfterProductUpdate", you can have the files in some conditions but the files are stored in another table. So I think that the best will be an addition of triggers.

In the table "hikashop_file", you can find the product files using the "file_type" column ("product" value) and the "file_ref_id" (which will contains the "product id").

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: DeeEmm

Please Log in or Create an account to join the conversation.

  • Posts: 114
  • Thank you received: 14
11 years 2 months ago #124292

Hi Jerome,

Thanks for looking into that for me.

onAfterProductCreate / onAfterProductUpdate should be adequate for my needs, I can fetch the filename from the #__hikashop_file table.

Thinking about this it might actually be better to carry out the file actions that I need to do after the upload / update so that there is no delay to the user in the front end.

I have a couple of other questions related to the plugin but I will start a new thread for these as they are a bit off topic.

Thanks for your help

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum