1

I want to change location button product tab:

enter image description here

I enable on the template hints and found such a file. I'm not sure if I should edit places in this file?

I would like the tab "oferty" to be displayed first.

details.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile
$_config  = $this->helper('Sm\Market\Helper\Data');
$tabStyle = $_config->getProductDetail('tab_style');

$show_custom_tab   = $_config->getProductDetail('show_custom_tab');
$custom_tab_name   = $_config->getProductDetail('custom_tab_name');
$customtab_content = $_config->getProductDetail('customtab_content');
?>
<?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')): ?>
    <div class="product info detailed">
        <?php $layout = $block->getLayout(); ?>
        <div class="product data items <?php echo $tabStyle . '-style' ?>" data-mage-init='{"tabs":{"openedState":"active"}}'>
            <?php if ($tabStyle == "default" || $tabStyle == "vertical") { ?>
                <ul class="resp-tabs-list">
                    <?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-<?= /* @escapeNotVerified */
                            $alias ?>-title"
                            data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */
                        $alias ?>">
                            <a class="data switch"
                               tabindex="-1"
                               data-toggle="switch"
                               href="#<?= /* @escapeNotVerified */
                               $alias ?>"
                               id="tab-label-<?= /* @escapeNotVerified */
                               $alias ?>-title">
                                <?= /* @escapeNotVerified */
                                $label ?>
                            </a>
                        </li>
                    <?php endforeach; ?>
                    <?php if ($show_custom_tab) { ?>
                        <li id="tab-label-customtab" class="data item title" aria-labeledby="tab-label-customtab-title" data-role="collapsible" role="tab" data-collapsible="true" aria-controls="product.info.customtab" aria-selected="false" aria-expanded="true" tabindex="0">
                                <a class="data switch"
                                   tabindex="-1"
                                   data-toggle="switch"
                                   href="#<?= /* @escapeNotVerified */
                                   $alias ?>"
                                   id="tab-label-<?= /* @escapeNotVerified */
                                   $alias ?>-title">
                                    <?php echo $custom_tab_name ?>
                                </a>
                            </li>
                    <?php } ?>
                </ul>

                <div class="resp-tabs-container">
                    <?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 content resp-tab-content" id="<?= /* @escapeNotVerified */
                        $alias ?>" data-role="content">
                            <?= /* @escapeNotVerified */
                            $html ?>
                        </div>
                    <?php endforeach; ?>
                    <?php if ($show_custom_tab) { ?>
                        <div class="data item content resp-tab-content" id="customtab" data-role="content">
                                <?php
                                echo $customtab_content;
                                ?>
                            </div>
                    <?php } ?>
                </div>
            <?php } else { ?>
                <?php foreach ($detailedInfoGroup as $name): ?>
                    <?php
                    $html = $layout->renderElement($name);
                    if (!trim($html)) {
                        continue;
                    }
                    $alias = $layout->getElementAlias($name);
                    $label = $block->getChildData($alias, 'title');
                    ?>
                    <h2 class="data item title resp-accordion"
                        aria-labeledby="tab-label-<?= /* @escapeNotVerified */
                        $alias ?>-title"
                        data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */
                    $alias ?>">
                        <a class="data switch"
                           tabindex="-1"
                           data-toggle="switch"
                           href="#<?= /* @escapeNotVerified */
                           $alias ?>"
                           id="tab-label-<?= /* @escapeNotVerified */
                           $alias ?>-title">
                            <?= /* @escapeNotVerified */
                            $label ?>
                        </a>
                    </h2>

                    <div class="data item content resp-tab-content" id="<?= /* @escapeNotVerified */
                    $alias ?>" data-role="content">
                        <?= /* @escapeNotVerified */
                        $html ?>
                    </div>
                <?php endforeach; ?>
                <?php if ($show_custom_tab) { ?>
                    <h2 id="tab-label-customtab" class="data item title resp-accordion" aria-labeledby="tab-label-customtab-title" data-role="collapsible" role="tab" data-collapsible="true" aria-controls="product.info.customtab" aria-selected="false" aria-expanded="true" tabindex="0">
                        <a class="data switch"
                           tabindex="-1"
                           data-toggle="switch"
                           href="#<?= /* @escapeNotVerified */
                           $alias ?>"
                           id="tab-label-<?= /* @escapeNotVerified */
                           $alias ?>-title">
                            <?php echo $custom_tab_name ?>
                        </a>
                    </h2>
                    <div class="data item content resp-tab-content" id="customtab" data-role="content">
                        <?php
                        echo $customtab_content;
                        ?>
                    </div>
                <?php } ?>
            <?php } ?>


        </div>
    </div>
<?php endif; ?>

1 Answer 1

2

For example you can see below from Magento v2.2.4 by default in vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml:99, but is for example, because I saw you code and you used a theme and the theme used many modules and I saw your printscreen which display a custom tab.

You can search in your theme or in your third-party modules, this group=" from XML files and you can find it.

<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.overview" template="Magento_Catalog::product/view/attribute.phtml" group="detailed_info" after="product.info.extrahint">
    <arguments>
        <argument name="at_call" xsi:type="string">getShortDescription</argument>
        <argument name="at_code" xsi:type="string">short_description</argument>
        <argument name="css_class" xsi:type="string">overview</argument>
        <argument name="at_label" xsi:type="string">none</argument>
        <argument name="title" translate="true" xsi:type="string">Overview</argument>
        <argument name="add_attribute" xsi:type="string">itemprop="description"</argument>
    </arguments>
</block>

Or you can see in Sm\Market\Helper\Data from getProductDetail method what is it in method and you can find it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.