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

#   Category Custom Field for Vendor

##

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

Less More

- Posts: 48
- Thank you received: 0
-
-

13 years 7 months ago [\#93972](#93972) by [theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")  *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#93972 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")* was created by *[theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")*

Hi,
in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.

In HikaMarket, I want to assign one or several categories to each vendor.

I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?

Is this right?

How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?

Thx

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vNzkxODEtY2F0ZWdvcnktY3VzdG9tLWZpZWxkLWZvci12ZW5kb3I/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: 26394
- Thank you received: 4077
-
- [](http://obsi.dev)
-

13 years 7 months ago [\#93994](#93994) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#93994 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")*

Hi,

What do you want to store in that category custom field ?

The HikaShop custom field system does not allow such type of "filtering" on several categories. But by improving the system, it shoud be possible.

But my main question is about what you want to do maybe it would be possible to have the same result with another "structure".

After that, I don't understand what you want to do with vendor custom fields.

Regards,

---

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

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

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

Less More

- Posts: 48
- Thank you received: 0
-
-

13 years 7 months ago [\#94520](#94520) by [theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")  Replied by *[theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")* on topic *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#94520 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")*

Hi,
actually I would like to assign one or several categories to each vendor. Ideally, it is from the same categories, which is already used for the products.

See the screenshot 1: this is, what I would like to show

See the screenshot 2: the categories, I have in the backend

Thx

- [ ![category.gif](/forum/attachment/9115) ](/forum/attachment/9115 "category.gif") [ ](/forum/attachment/9115?download=1 "category.gif")
- [ ![categoryBackend.gif](/forum/attachment/9116) ](/forum/attachment/9116 "...oryBackend.gif") [ ](/forum/attachment/9116?download=1 "...oryBackend.gif")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vNzkxODEtY2F0ZWdvcnktY3VzdG9tLWZpZWxkLWZvci12ZW5kb3I/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: 26394
- Thank you received: 4077
-
- [](http://obsi.dev)
-

13 years 7 months ago [\#94542](#94542) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#94542 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")*

Hi,

In HikaMarket, a vendor could just assign a category to a product if he has access to it.
We would add in a future release, the possibility to "share" other categories to vendors. At this moment, the vendor would be able to place his products in these categories.

After that, the listing that you want to have is quite complex to implement.
You would have to retrieve all categories of the product in the listing and display the right category name in the listing (not displaying the current "daily receipt" one, etc).
I guess that, creating a product custom field which would contains the list of the categories would be better.

You can store in the custom field possible values the couple "category id / category name" and create the special display in the table listing.
The custom field values would not be dynamic, it means that you would have to update manually the values if you create a category or if a category is modified.
It is possible to create a "custom field" plugin in order to have a dynamic and specific system. But I am not sure that you would create and modify your categories every day.

Regards,

---

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

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

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

Less More

- Posts: 48
- Thank you received: 0
-
-

13 years 7 months ago [\#94596](#94596) by [theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")  Replied by *[theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")* on topic *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#94596 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")*

Thanks Jerome,
I think this was just too complicated from my side. As you say, I will not edit the categories on a day to day basis. So the easiest will be to create a custom field for the vendor, and display the values on the product listing in the frontend.

So, what I did now:
I created a multi select custom field in the plg.hikamarket.vendor table
The column name is "vendor_category_for_product_listing"

The point is:
**what do I have to add to my product / listing\_table.php? in order to display the vendor custom field on the product listing page?**

Tried to copy some of the existing code (for the product vote) and modify it, but no success...

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vNzkxODEtY2F0ZWdvcnktY3VzdG9tLWZpZWxkLWZvci12ZW5kb3I/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: 26394
- Thank you received: 4077
-
- [](http://obsi.dev)
-

13 years 7 months ago [\#94688](#94688) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#94688 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")*

Hi,

Why a vendor custom field ?
You vendors just have one single category ?
A product custom fields could not be better ?

In the listing page, you can load and display a product custom field: Code:

if(!empty($this-&gt;rows)){ // Load the product custom fields // (in the beginning of the file) $fieldsClass = hikashop_get('class.field'); $productfields = $fieldsClass-&gt;getFields('frontcomp',$this-&gt;rows,'product'); }

Code:

// Display a custom field value for the product // (in a cell of the listing table) $fieldName = 'my_custom_field_name'; if(!empty($productfields[$fieldName]) &amp;&amp; !empty($row-&gt;$fieldName)) echo $this-&gt;fieldsClass-&gt;show($productfields[$fieldName], $row-&gt;$fieldName);

You can do quite same thing for loading and displaying a vendor custom field but the code is a little bit different because you have to load the vendors before. Code:

if(!empty($this-&gt;rows)) { // Load the vendors in the current listing // $vendorIds = array(); foreach($this-&gt;rows as $row) { $vendorIds[$row-&gt;product_vendor_id] = $row-&gt;product_vendor_id; } if(!empty($vendorIds)) { $query = 'SELECT * FROM '.hikamarket::table('vendor').' WHERE vendor_id IN ('.implode(',',$vendorIds).')'; $db = JFactory::getDBO(); $db-&gt;setQuery($query); $vendors = $db-&gt;loadObjectList('vendor_id'); } else { $vendors = array(); } // Load the vendor custom fields // $fieldsClass = hikashop_get('class.field'); $null = null; $vendorFields = $fieldsClass-&gt;getFields('frontcomp', $null, 'plg.hikamarket.vendor'); }

Code:

if(!empty($vendors[ $row-&gt;product_vendor_id ])) { $currentVendor = $vendors[ $row-&gt;product_vendor_id ]; $fieldName = 'vendor_category_for_product_listing'; if(!empty($vendorsFields[$fieldName]) &amp;&amp; !empty($currentVendor-&gt;$fieldName)) { $fieldsClass-&gt;show($vendorFields[$fieldName], $currentVendor-&gt;$fieldName); } }

Regards,

---

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

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

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

Less More

- Posts: 48
- Thank you received: 0
-
-

13 years 7 months ago -  13 years 7 months ago [\#94996](#94996) by [theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")  Replied by *[theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile")* on topic *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#94996 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")*

> Jerome wrote: Hi,
>
> Why a vendor custom field ?
> You vendors just have one single category ?
> A product custom fields could not be better ?

Hi,
because the idea is to show the "kitchen category" of the vendor as an additional info - later on, I also want to add a filter for kitchen category. For example, vendor 1 is category Italian. Vendor 2 is category International &amp; Vegetarian, etc.

The vendor can have multiple categories.

I assume the vendor field is more suitable than the product custom field.

I implemented the code as you said (added &lt;?php before and ?&gt; after) - unfortunately nothing is shown...

Last edit: 13 years 7 months ago by [theweasel68](/forum/user/13135-theweasel68 "View theweasel68's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vNzkxODEtY2F0ZWdvcnktY3VzdG9tLWZpZWxkLWZvci12ZW5kb3I/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: 26394
- Thank you received: 4077
-
- [](http://obsi.dev)
-

13 years 7 months ago [\#95116](#95116) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Category Custom Field for Vendor](/forum/23-market-how-to/79181-category-custom-field-for-vendor#95116 "Hi, in HikaShop, there are several food-categories for products defined: American, Italian, Chinese, etc.  In HikaMarket, I want to assign one or several categories to each vendor.  I thought about creating a custom field. But as it seems, I can only use a new column from the table, and not an existing (the food category)?  Is this right?  How can I define a new custom field for the vendor backend, and use the data of an existing table, in combination with a multi select drop down list?  Thx")*

Hi,

I have separate the code in two different blocks.
The first block load the custom fields (for the product or for the vendor) and the second block display the content in the loop.
The first one could be paste at the beginning of the view but the second one, should be paste at a precise place.
You have to add a new cell (and a new column) in order to display it, like the product name, the price or the code are displayed. Code:

&lt;?php if ($this-&gt;config-&gt;get('show_code')){ ?&gt; &lt;td class="hikashop_product_code_row"&gt; &lt;?php echo $this-&gt;row-&gt;product_code; ?&gt; &lt;/td&gt; &lt;?php } ?&gt;

After that, I didn't test the code that I gave you. It is some code that I have written like that. Some test and debugging could be required.

Regards,

---

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

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

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