- Posts: 1
- Thank you received: 0
file uploading will be Required
10 years 1 month ago #249595
by m2008
file uploading will be Required was created by m2008
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).
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.
10 years 1 month ago #249606
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic file uploading will be Required
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
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,
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
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.
Please Log in or Create an account to join the conversation.
Moderators: Obsidev
Time to create page: 0.130 seconds