Adding content to tabs
Tinkering with the display options, i've found the tabular view ideal for a clean look in the site in progress (considering the amount of text i need to add). I've succesfully added 3 tabs to the product display, by followind www.hikashop.com/support/documentation/106-faq.html#layo
if i'm doing this right that's at line 243 after the
1. All tabs "work" besides the last one. If i click on the last one it "jumps" down from being tab title to looking like text. Clicking on the other tabs then keeps the title of the last tab present and in that position. It's no longer a tab see attachments
2. I have no idea how to add text to each seperate tab. There doesn't seam to be an option for that after doing this when adding/editing a product.
Adding content doesn't seem right to do it directly in the template. That would make the tabular content IDENTICAL for each and every product. I must be misunderstanding something here.
Please Log in or Create an account to join the conversation.
If you follow the instructions of the FAQ, your modifications will be saved in an override view file.
So you won't loose them when you update but you also won't get the future improvements we'll make in that view file.
Now regarding your first question, I'm not sure but I would say you made a mistake.
Regarding the second question, I've actually updated the FAQ to mention this as it's been asked several times so I think it's worth mentioning in the FAQ:
And if you want to display dynamic content in the tab, you can create a custom field of the table "product" via the menu Display>Custom fields (Essential and Business editions only). Then, you'll be able to enter the text you want in the custom field when you're editing your product.
And instead of <!-- Your div content --> in the previous code, you can use:
<?php echo $this->element->XXX;?>
where XXX is to be replaced by the column name of the custom product field.
Please Log in or Create an account to join the conversation.
Assuming i read that correctly, in my case, for the second tab that would mean i need to make custom field of the table "product" with name "USE_ME" since USE_ME is the tab id for the tab with display name "USE.ME" (i found that using a . in the id caused problems)? and then in the view template instead of that DIV i would enter
<?php echo $this->element->USE_ME; ?>
is that correct?
Any idea's on why that last tab "jumps position"? I would be happy to provide back-end access.
Please Log in or Create an account to join the conversation.
I suppose yes.
I don't need a backend access for that.
What I need is:
- a link to the page with the issue
- a screenshot of the code you added in the view file.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I checked your frontend but I can see two issues:
You use for example the id USE_ME_li in your first li tag. But it should be: hikashop_show_tabular_use_me_li
Also, you're missing completely the code:
<div class="hikashop_tabs_content" id="hikashop_show_tabular_use_me">
<?php echo $this->element->use_me; ?>
</div>
that you should put in the <ul class="hikashop_tabs_ul"> as explained in the FAQ.
That's because of these two things that the tabs don't work.
Please Log in or Create an account to join the conversation.
I'll try your fix this evening.
Please Log in or Create an account to join the conversation.
I had to manually drop the field from the database table before i could add it again.
That said, still can't get it to work.
Custom field settings:
- label: USE.ME
- table: product
- column name: use_me
- field type: text (trying to add a plugin shortcode so it'll render a video)
- published: yes
- Display: Front-end: yes
It created an extra tab "Specificaties" on the front-end instead of using the tab "USE.ME" (with id hikashop_show_tabular_use_me_li) itself.
Now here's the kicker.
Adding the shortcode in only the "video" custom field > video isn't rendered
Adding the shortcode in any other custom field AND the video wysiwyg editor > video gets displayed
but still not in the proper tab
Please Log in or Create an account to join the conversation.
- You should turn off the display setting of your custom fields if you don't want them to appear in the specifications tab, since you're displaying them yourself
- you still had incorrect ids in your divs as they had an extra _li at the end of the id. That's why the tabs were not working
- also, you have variants in your product, so you need extra code to get the data from the main product
- also, since you want to replace tags from content plugins, you need extra code to process the content tags
I've done the modifications for you with the access you provided. Please note however that this goes way beyond user support. That's custom development work. If you need our help for similar things in the future, we'll have to charge you for that.
Please Log in or Create an account to join the conversation.
just compared my image with the current template code. Are you referring to this?
If there were NO variants, then the default FAQ instructions of using
would apply?
With content prepare this would become
Trying to get all angles here so i have everything in need for future usecases
As to the li part. I thought (or understood the instructions as) needing to copy the EXACT li id. But if i read you correctly this is incorrect? The _li is only used to tell hikashop it's an li but for the tab content section the _li from the tab id needs to be removed? Is that correct?
What about the custom field deletion i mentioned. Did i stumble on a bug?
Either way. Thanks for the excellent support, which deserves to be rewarded. Snapped up the PDF plugin and mollie.com paid addons. Maybe that will compensate a little for the time spent!
Please Log in or Create an account to join the conversation.
Yes, the code of the documentation would apply for products without variants and if you don't need content plugin replacement. We try to keep it simple for people not knowing much about code that's why the code in the FAQ doesn't handle edge cases.
Regarding the custom field deletion, it's not a bug. It's done on purpose so that if someone inadvertently delete the custom field, the data is not lost but still in the database. So you can always retrieve it by manually changing the namekey of the field in the hikashop_field table after creating a custom field with another column name.
And similarly, when you create a new custom field, we check that there isn't already a column with the name you want to use as it could break the system.
Thanks for the purchases !
Please Log in or Create an account to join the conversation.
As to the custom field. Please tell me if i read you correctly
1. Delete custom field > field deleted from visible list, but db entry retained
2. creating new field with same id = error
3. Create new random field with some id
4. Look up the random column name in the db and change it to the one from (2)
5. data restored?
Please Log in or Create an account to join the conversation.
1. The thing is that in $this->element you have either: the data of the product if it has no variants, or the data of the default variant of the product.
So if you add the values you want in the custom fields of the default variant you could indeed always use $this->element.
2. No, it's not the column name of the field in the hikashop_product table that you need to change. It's the value of the field_namekey column for the custom field in the table hikashop_field that you need to change.
Please Log in or Create an account to join the conversation.
Some products don't have a video. Is there a way to hide a specific tab only on specific products?
Please Log in or Create an account to join the conversation.
You can add a condition around the li. That should be before:
Please Log in or Create an account to join the conversation.
Perhaps also something to mention in the FAQ
Please Log in or Create an account to join the conversation.
Seems to be hiding the tab entirely, even for products WITH a video. Ideal option would be to surround the entire section of the 5 custom tabs with a php statement that would work on all tabs, and not require a specific statement for each li
I guess i could change from using the main to variant specific info but considering there's over 100 products, nearly each with 3 or more variants that's a bucketload of work.
Please Log in or Create an account to join the conversation.
Your code will display the "VIDEO" tab only if there is something in the custom field "video" of the main product.
I don't see why this wouldn't work.
I guess there is something you're not telling me about the situation. Like you actually want the tab to appear because you display several fields in that tab ?
In that case, you should add the check around the display of the custom field, and not around the tab title.
And around the tab title, you would need a more complex check to display the tab if at least one field is set.
Please Log in or Create an account to join the conversation.
I only want the tab to appear IF the related custom field has been filled in. Any other case i want the tab hidden. I'm not using the variant specific custom field. Maybe that has something to do with it. Currently that code is hiding the video tab for ALL products including the ones that have video (including the ANGEL.MASQUE product being shown here www.hikashop.com/forum/product-category-...nagement.html#318461 )
(You can find that product under the category: Product type > Behandeling > top left one)
It's not a super big deal if what i'd like to do isn't possible without major customisation. It's just that i'd like not to show tabs for that specific product, if the tab has no data for that specific product.
1 last thing i tried is that i have front-end css file set to "default", so figured i'd set it back to "none" but that screws up the tabs completely. They still work, they're just no longer physical tabs.
Please Log in or Create an account to join the conversation.
Well, in that case, either your code is wrong, or the field is not empty for the product you're looking at.
Note that if you use a custom field of the type WYSIWYG, it's possible that your HTML editor adds extra HTML tags, even if you didn't enter anything in the field.
So try to check the type to "textarea" to see if that's the case. If so, it explains why you see the tab even though you believe it's empty.
Please Log in or Create an account to join the conversation.