hello,
I was able, as you can see here:
http://www.coronelli.it/it/topping/topping-primessenza/topping-fragola-al-miele-cp40019.html
to show a custom tab "valori nutrizionali" in the product view page, but it appears as first tab, how do I make it the last one?
thanks
You can change your custom tab position by override details.phtml file into your theme/module.
for theme level,
app/design/frontend/{Vendorname}/{themename}/Magento_Catalog/templates/product/view/details.phtml
Now keep your code as below,
<?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')):?>
<?php
$detailedInfoGroup = array('valori_nutrizionali.tab','product.info.description');
?>
<div class="product info detailed">
<?php $layout = $block->getLayout(); ?>
<div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'>
<div class="sticky-wrapper">
<div class="topNav">
<ul class="tabs-header">
<?php foreach ($detailedInfoGroup as $name):?>
<?php
$html = $layout->renderElement($name);
if (!trim($html)) {
continue;
}
$alias = $layout->getElementAlias($name);
$label = $block->getChildData($alias, 'title');
?>
<li class="data item title"
aria-labeledby="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>-title"
data-role="collapsible" id="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>">
<a class="data switch"
tabindex="-1"
data-toggle="switch"
href="#<?php /* @escapeNotVerified */ echo $alias; ?>"
id="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>-title">
<?php /* @escapeNotVerified */ echo $label; ?>
</a>
</li>
<?php endforeach;?>
</ul>
</div>
</div>
<div class="wid1030 navData">
<?php foreach ($detailedInfoGroup as $name):?>
<?php
$html = $layout->renderElement($name);
if (!trim($html)) {
continue;
}
$alias = $layout->getElementAlias($name);
$label = $block->getChildData($alias, 'title');
?>
<div class="data item title"
aria-labeledby="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>-title"
data-role="collapsible" id="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>" style="display:none">
<a class="data switch"
tabindex="-1"
data-toggle="switch"
href="#<?php /* @escapeNotVerified */ echo $alias; ?>"
id="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>-title">
<?php /* @escapeNotVerified */ echo $label; ?>
</a>
</div>
<div class="data item content" id="<?php /* @escapeNotVerified */ echo $alias; ?>" data-role="content">
<?php /* @escapeNotVerified */ echo $html; ?>
</div>
<?php endforeach;?>
</div>
</div>
</div>
<?php endif; ?>
YOu can change your tab position by changes using below line in above code,
$detailedInfoGroup = array('valori_nutrizionali.tab','product.info.description');
If issue solved, Click Kudos/Accept As Solutions.
Hi Rakesh,
I tried but not working for me, the order stays the same (I also did empty cache).
Thanks
@agiorgini, Can you debug your code using keep,
echo "<pre>";print_r($detailedInfoGroup);exit;
in above file. and check which value return above array.