file uploading will be Required

  • Posts: 1
  • Thank you received: 0
8 years 2 months ago #249595

Hi an Thank you for your good component

I want that user upload file via product creation and it must be (Required)
how can i do this?! (uploading file will be Required).

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #249606

Hi,

There is no built-in option for that kind of check ; but it is possible to add it using a small custom plugin.

Thanks to the trigger "onBeforeProductCreate" you can catch the product creation.
In that function you can check that you're in the front-end (so in HikaMarket) and get the current logged vendor.
Afterwards, you can check the product content and set the variable " $do " to False if you want to refuse the product creation.
www.hikashop.com/support/documentation/6...ntation.html#product

To check that HikaMarket is initialized and get the current vendor you can use that code

if(!defined('HIKAMARKET_COMPONENT')) // Do nothing if we are not in HikaMarket
  return;
$vendor_id = hikamarket::loadVendor(false);
if($vendor_id == 1) // Do not block the main vendor
  return ;

You can also use the trigger "onBeforeProductUpdate" if you also want to check the product files for the updates (and not just the creation) but you'll have to add more checks because a product can be update partially ; so you have to be sure that the product update is coming from the HikaMarket product edition (reading the parameters in the URL could be a good solution).

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.

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

Moderators: Obsidev
Time to create page: 0.056 seconds
Powered by Kunena Forum