custom fields that only show on variants

  • Posts: 165
  • Thank you received: 3
10 years 10 months ago #139254

-- HikaShop version -- : 2.2.3
-- Joomla version -- :3.2.1


I have kind of a weird request and i cannot find a solutions to this. I have a mattress site i am making and I am almost done with it so this is urgent. I have characteristics that describe the mattress. I then have product variants of that mattress: twin, twin xl, queen etc.

I basically have 3 custom fields that I only want to show up under the variants not the main product.

Also, under the variants how can I hide all the custom fields on the main product they automatically show up on the variants and they do not need to be there.


Also if you can think of a solution to where I can make a custom field show based off of the product characteristic dropdown selection. This is what I have been trying to figure out because it seems like the easier way to go about this? I already have the 3 fields i need for each characteristic in my main product. I know this requires some javascript, but I do not quite know how to write it or where to place it at?How would I go about doing this way?
Thanks,

Josh

Last edit: 10 years 10 months ago by jschroeder.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #139358

Hi,

Restricting the custom fields display based on the characteristics selection will indeed require you to add custom javascript.
The exact code will depend on how is done your website.
Here is an example:
api.jquery.com/change/
so the code would be something like that:

$('#characteristic_dropdown_id').change(){ if($('#characteristic_dropdown_id').val()=='my_characteristic_value'){ $('#custom_field_row_id').css('display',''); }else{ $('#custom_field_row_id').css('display','block'); } }

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

Time to create page: 0.042 seconds
Powered by Kunena Forum