[Skip to main content](#vessel-content)

#   Required fields when vendor adds product

##

- **[Dibben](/forum/user/6788-dibben "View Dibben's Profile")**
- [![Dibben's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6788-dibben "View Dibben's Profile") Topic Author
- [ Offline](/forum/user/6788-dibben)

Less More

- Posts: 377
- Thank you received: 7
-
-

10 years 6 months ago [\#239537](#239537) by [Dibben](/forum/user/6788-dibben "View Dibben's Profile")  *[Required fields when vendor adds product](/forum/19-hikamarket/884398-required-fields-when-vendor-adds-product#239537 "-- HikaShop version -- : 2.6.3 -- HikaMarket version -- : 1.7.0 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.5  Hi,  I have a page on website that lets vendor list their products. I've added some custom fields on this page and made them required. Now when I submit a product without filling these custom fields I get validation error. But when all the custom fields are filled and I try to add the product with out title it lists the product without any validation.  How can I make Product title and product price field mandatory. I also tried it after removing all view customizations and custom fields.  Regards")* was created by *[Dibben](/forum/user/6788-dibben "View Dibben's Profile")*

-- HikaShop version -- : 2.6.3
-- HikaMarket version -- : 1.7.0
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.5

Hi,

I have a page on website that lets vendor list their products. I've added some custom fields on this page and made them required. Now when I submit a product without filling these custom fields I get validation error. But when all the custom fields are filled and I try to add the product with out title it lists the product without any validation.

How can I make Product title and product price field mandatory. I also tried it after removing all view customizations and custom fields.

Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODg0Mzk4LXJlcXVpcmVkLWZpZWxkcy13aGVuLXZlbmRvci1hZGRzLXByb2R1Y3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

10 years 6 months ago [\#239558](#239558) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Required fields when vendor adds product](/forum/19-hikamarket/884398-required-fields-when-vendor-adds-product#239558 "-- HikaShop version -- : 2.6.3 -- HikaMarket version -- : 1.7.0 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.5  Hi,  I have a page on website that lets vendor list their products. I've added some custom fields on this page and made them required. Now when I submit a product without filling these custom fields I get validation error. But when all the custom fields are filled and I try to add the product with out title it lists the product without any validation.  How can I make Product title and product price field mandatory. I also tried it after removing all view customizations and custom fields.  Regards")*

Hi,

For the product name ; it is something that I will add into HikaMarket because the vendor should not provide an empty value for the product name (if he has the right to edit the product name).

About the price it is something more complicated because some store can authorize products without prices.
So I'll more recommend the usage of a custom plugin and the triggers "onBeforeProductCreate / onBeforeProductUpdate". Code:

public function onBeforeProductCreate(&amp;$product, &amp;$do) { $this-&gt;onBeforeProductUpdate($product, $do); } public function onBeforeProductUpdate(&amp;$product, &amp;$do) { $app = JFactory::getApplication(); if($app-&gt;isAdmin()) return; $option = JRequest::getCmd('option', ''); if($option != 'com_hikamarket' &#124;&#124; !defined('HIKAMARKET_COMPONENT')) return; // Check for empty product name if(isset($product-&gt;product_name) &amp;&amp; empty($product-&gt;product_name)) { $app-&gt;enqueueMessage(JText::sprintf('HIKAM_FIELD_REQUIRED', JText::_('PRODUCT_NAME')), 'error'); $do = false; return; } }

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODg0Mzk4LXJlcXVpcmVkLWZpZWxkcy13aGVuLXZlbmRvci1hZGRzLXByb2R1Y3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.044 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
