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

#   Remove default category

##

- **[DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")**
- [![DeeEmm's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26410.jpg)](/forum/user/26410-deeemm "View DeeEmm's Profile") Topic Author
- [ Offline](/forum/user/26410-deeemm)

Less More

- Posts: 114
- Thank you received: 14
-
- [](http://deeemm.com)
-

13 years 1 month ago [\#128285](#128285) by [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")  *[Remove default category](/forum/19-hikamarket/862884-remove-default-category#128285 "I've searched the forums and read the documentation and I'm sure that there must be a simple answer for this (and perhaps a configuration setting hidden in plain sight) but I cannot seem to find how...")* was created by *[DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")*

I've searched the forums and read the documentation and I'm sure that there must be a simple answer for this (and perhaps a configuration setting hidden in plain sight) but I cannot seem to find how to disable the default product category in the vendor product form.

[ ![hc8af20a.png](/forum/attachment/12926) ](/forum/attachment/12926 "hc8af20a.png")

TIA

/DM

---

[ deeemm.com](http://deeemm.com)

- [ ![hc8af20a.png](/forum/attachment/12926) ](/forum/attachment/12926 "hc8af20a.png") [ ](/forum/attachment/12926?download=1 "hc8af20a.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODYyODg0LXJlbW92ZS1kZWZhdWx0LWNhdGVnb3J5P3RtcGw9bWFya2Rvd24=) 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)
-

13 years 1 month ago [\#128317](#128317) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Remove default category](/forum/19-hikamarket/862884-remove-default-category#128317 "I've searched the forums and read the documentation and I'm sure that there must be a simple answer for this (and perhaps a configuration setting hidden in plain sight) but I cannot seem to find how...")*

Hi,

In the view "productmarket &#124; form", please replace Code:

&lt;dd class="hikamarket_product_category"&gt;&lt;?php echo $this-&gt;categoryType-&gt;displayMultiple('data[product][categories]', @$this-&gt;product-&gt;categories, '', $this-&gt;rootCategory); ?&gt;&lt;/dd&gt;

By: Code:

&lt;dd class="hikamarket_product_category"&gt;&lt;?php if(empty($this-&gt;product-&gt;product_id)) $this-&gt;product-&gt;categories = array(); echo $this-&gt;categoryType-&gt;displayMultiple('data[product][categories]', @$this-&gt;product-&gt;categories, '', $this-&gt;rootCategory); ?&gt;&lt;/dd&gt;

To remove the categories when creating a new product.

Please note that even if there is not displayed category, if you save the product HikaMarket/HikaShop will set a default one. It is not possible to have a product without a least one category.

Regards,

---

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

The following user(s) said Thank You: [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")

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

- **[DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")**
- [![DeeEmm's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26410.jpg)](/forum/user/26410-deeemm "View DeeEmm's Profile") Topic Author
- [ Offline](/forum/user/26410-deeemm)

Less More

- Posts: 114
- Thank you received: 14
-
- [](http://deeemm.com)
-

13 years 1 month ago [\#128332](#128332) by [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")  Replied by *[DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")* on topic *[Remove default category](/forum/19-hikamarket/862884-remove-default-category#128332 "I've searched the forums and read the documentation and I'm sure that there must be a simple answer for this (and perhaps a configuration setting hidden in plain sight) but I cannot seem to find how...")*

Thanks Jerome, that works great.

However, is it possible that if no category is selected that the user is prompted to add one instead of automatically assigning one?

My reasoning is as follows (perhaps a little cynical but probably fairly accurate)

- Pre-selecting a category - 90% of users will simply assume that this is normal and so they will not delete it.
- Automatically adding a category - users who forget to select a category will be unaware.

In either case I would bet that for every 100 products added I end up with 95 in the root category.

Much better to have no category automatically selected, and some basic form validation.

Is this easily achievable?

/DM

---

[ deeemm.com](http://deeemm.com)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODYyODg0LXJlbW92ZS1kZWZhdWx0LWNhdGVnb3J5P3RtcGw9bWFya2Rvd24=) 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)
-

13 years 1 month ago [\#128363](#128363) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Remove default category](/forum/19-hikamarket/862884-remove-default-category#128363 "I've searched the forums and read the documentation and I'm sure that there must be a simple answer for this (and perhaps a configuration setting hidden in plain sight) but I cannot seem to find how...")*

Hi,

It is but it will impact the HikaMarket core so that's not a modification that I will recommend.
In HikaMarket product class, you will find this Code:

if(empty($product-&gt;product_id) &amp;&amp; !count($product-&gt;categories) &amp;&amp; !empty($rootCategory)) { $product-&gt;categories = array($rootCategory); }

Maybe the best will be to add some javascript checks in the page. So when the user wants to submit the form, some checks are made and cancel the form submission if there is something wrong.

Regards,

---

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

The following user(s) said Thank You: [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")

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

- **[DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")**
- [![DeeEmm's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26410.jpg)](/forum/user/26410-deeemm "View DeeEmm's Profile") Topic Author
- [ Offline](/forum/user/26410-deeemm)

Less More

- Posts: 114
- Thank you received: 14
-
- [](http://deeemm.com)
-

13 years 1 month ago -  13 years 1 month ago [\#128382](#128382) by [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")  Replied by *[DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")* on topic *[Remove default category](/forum/19-hikamarket/862884-remove-default-category#128382 "I've searched the forums and read the documentation and I'm sure that there must be a simple answer for this (and perhaps a configuration setting hidden in plain sight) but I cannot seem to find how...")*

Thanks Jerome.

i ended up adding some simple javascript validation.

in productmarket / form.php I added a javascript function to detect the presence of submitted categories and added an onsubmit call to the form declaration
Code:

&lt;script type="text/javascript"&gt; function validateForm(){ if (document.forms["hikamarket_form"]["data[product][categories][]"] === undefined){ alert("Please Select one or more categories"); exit; } else { return; } } &lt;/script&gt; &lt;form action="&lt;?php hikamarket::completeLink('product');?&gt;" method="post" name="hikamarket_form" id="hikamarket_products_form" enctype="multipart/form-data" onsubmit="return validateForm()"&gt;

Hope this helps someone else.

/DM

---

[ deeemm.com](http://deeemm.com)

Last edit: 13 years 1 month ago by [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile").

The following user(s) said Thank You: [Jerome](/forum/user/80-jerome "View Jerome's Profile"), [master\_b](/forum/user/5077-master-b "View master&#95;b's Profile")

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

- **[master\_b](/forum/user/5077-master-b "View master&#95;b's Profile")**
- [![master&#95;b's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5077-master-b "View master&#95;b's Profile")
- [ Offline](/forum/user/5077-master-b)

Less More

- Posts: 540
- Thank you received: 49
-
-
-
- [](https://benefit.in.ua)
-

13 years 3 weeks ago [\#130406](#130406) by [master\_b](/forum/user/5077-master-b "View master&#95;b's Profile")  Replied by *[master\_b](/forum/user/5077-master-b "View master&#95;b's Profile")* on topic *[Remove default category](/forum/19-hikamarket/862884-remove-default-category#130406 "I've searched the forums and read the documentation and I'm sure that there must be a simple answer for this (and perhaps a configuration setting hidden in plain sight) but I cannot seem to find how...")*

tnx for this and i think its good be if add that as option in market config

---

сайт з перекладами [ ](https://benefit.in.ua)[ www.benefit.in.ua](http://www.benefit.in.ua)
PS. спасибо переводить Webmoney : Z207635098627 R152456839841 или ЯД 410011027999056

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODYyODg0LXJlbW92ZS1kZWZhdWx0LWNhdGVnb3J5P3RtcGw9bWFya2Rvd24=) 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.066 seconds

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