Custom field display for product in multiple categories

  • Posts: 4
  • Thank you received: 1
  • Hikashop Multisite
5 years 2 weeks ago #305637

-- HikaShop version -- : 4.0.3
-- Joomla version -- : 3.9.4
-- PHP version -- : 7.1.8
-- Browser(s) name and version -- : Firefox 66.0.2

On my company's website, I have used the custom fields option to add additional information to the product listing page (table layout). I have a few products that I would like to list in more than one product listing category, but the categories do not have the exact same custom fields. When the product listing for either category is displayed, all of the custom fields that apply to the product are displayed. However, I would just like the custom fields applicable to that category to be displayed.

For example, on our website I have a product that I would like to list in the two categories "Sample Holders" and "Sample Counter Head". "Sample Holders" has the following custom fields: Max. Sample Size, Features. "Sample Counter Head" has the following custom fields: Max. Sample Size, Detector Type, Efficiency. When this product is assigned to both categories, all four of the custom fields assigned to the product are shown in the category product listing (table layout), instead of just the custom fields that apply to the category.

Is there a way that I can keep the custom fields as they are, but fix when they are displayed?

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

  • Posts: 4519
  • Thank you received: 611
  • MODERATOR
5 years 2 weeks ago #305644

Hello,

I see a solution for your specific needs, use custom css command, follow me step by step :
- Get your listing Id something like "hikashop_category_information_menu_123"
- Same thing for your specific Custom field class like "hikashop_product_custom_Column_Name_line"
- Then create your custom Css command and add it to your Frontend css file, for this have a look on this tutorial .

If you follow me well, you will have something like this :
.hikashop_category_information_menu_123 .hikashop_product_custom_Column_Name1_line {
display:none;
}

=> In this specific "hikashop_category_information_menu_123" listing the custom field "Column_Name1" won't be displayed.
Hope this will fit your needs.

Regards

Last edit: 5 years 2 weeks ago by Philip.

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

  • Posts: 4
  • Thank you received: 1
  • Hikashop Multisite
5 years 2 weeks ago #305670

Hello,

Your suggestion didn't work for me, but it helped me to find a solution that worked. I ended up using something like the following:

.hikashop_category_listing_123 th:nth-of-type(#), .hikashop_category_listing_123 td:nth-of-type(#) {
display: none;
}

This will hide a column in a product listing table.

Thanks.

The following user(s) said Thank You: Jerome

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

Time to create page: 0.060 seconds
Powered by Kunena Forum