I want change tabs on opencart (admin view) with twitter bootstrap 3.0, the code following :
catalog_form.tpl
<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#tab-general" data-toggle="tab"><?php echo $tab_general; ?></a></li>
<li class=""><a href="#tab-data" data-toggle="tab"><?php echo $tab_data; ?></a></li>
<li class=""><a href="#tab-design" data-toggle="tab"><?php echo $tab_design; ?></a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div id="tab-general" class="tab-pane fade active in">
<ul id="languages" class="nav nav-tabs">
<?php $i = 0; ?>
<?php foreach ($languages as $language) { ?>
<li class="<?php if ($i == 0) { echo 'active'; } ?>">
<a href="#language<?php echo $language['language_id']; ?>" data-toggle="tab"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /> <?php echo $language['name']; ?></a>
</li>
<?php $i++; } ?>
</ul>
<div id="Mylanguages" class="tab-content">
<?php $a = 0; ?>
<?php foreach ($languages as $language) { ?>
<div id="language<?php echo $language['language_id']; ?>" class="tab-pane fade <?php if ($a == 0) { echo 'active'; } ?> in">
<?php echo $language['language_content']; ?>
</div>
<?php $a++; } ?>
</div>
</div>
<div id="tab-data" class="tab-pane fade">
...
</div>
<div id="tab-design" class="tab-pane fade">
...
</div>
</div>
Parent tabs (tab-general, tab-data, tab-design) without foreach work perfectly
First reload, language 1 is active tab
When click language 2's tab
#language2
tag have selected
classdiv
tag with id language2
have display block but not have active
class li
still have active
class but language 2 li
have not active
class.When I try copy html (via inspect element) and make on jsfiddle (modify content not html tag) it's works perfectly. Jsfiddle
Problem Solved
Just remove default jquery tabs on opencart
<script type="text/javascript"><!--
$('#tabs a').tabs();
$('#languages a').tabs();
//--></script>
This script will you see on template file using language tabs admin/view/template/xxx/xxxx_form.tpl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With