Change order of tabs on product page

Use the code below to change the order of tabs.

 In this file: (copy from Magento vendor dir if not present in theme)

app/design/frontend/Packagename/themename/Magento_Catalog/templates/product/view/details.phtml 
Use this code: 

<?
php /**
 * Copyright © 2017 OutlandWeb - Custom ordering of tabs
 *
 */

// @codingStandardsIgnoreFile ?> <?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')):?> <?php $newOrderTabbing = array('product.info.description','reviews.tab','product.attributes'); //custom add ?> <div class="product info detailed"> <?php $layout = $block->getLayout(); ?> <div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'> <?php foreach ($newOrderTabbing 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;?>"> <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> <?php endif; ?>

 

You can change order by setting the array with your (custom) in the file above:

<?php $newOrderTabbing = array('product.info.description','reviews.tab','product.attributes'); //custom add ?> 
 
 
Hebt u meer vragen? Een aanvraag indienen

Opmerkingen

Mogelijk gemaakt door Zendesk