Jump to content

Edit History

jmauclair

jmauclair


add informations

After searching through all the Prestashop files, I've found the file : essentials.html.twig (BASE_PS_DIR\src\PrestaShopBundle\Resources\views\Admin\Product\ProductPage\Panels).

So, what would be perfect would to be able to add a tab with the description and short description tabs, what I've done thanks to cusom hooks like that :

            <div class="summary-description-container">
              <ul class="nav nav-tabs bordered">
                <li id="tab_description_short" class="nav-item"><a href="#description_short" data-toggle="tab" class="nav-link description-tab active">{{ 'Summary'|trans({}, 'Admin.Catalog.Feature') }}</a></li>
                <li id="tab_description" class="nav-item"><a href="#description" data-toggle="tab" class="nav-link description-tab">{{ 'Description'|trans({}, 'Admin.Global') }}</a></li>
                {{ renderhook('displayDescriptionAdvancedTabsHeader', { 'id_product': productId }) }}
              </ul>

              <div class="tab-content bordered">
                <div class="tab-pane panel panel-default active" id="description_short">
                  {{ form_widget(formShortDescription) }}
                </div>
                <div class="tab-pane panel panel-default " id="description">
                  {{ form_widget(formDescription) }}
                </div>
                {{ renderhook('displayDescriptionAdvancedTabsContent', { 'id_product': productId }) }}
              </div>
            </div>

Where descriptionAdvanced are customs hooks.

That calls these templates :

tabsHeader.tpl

{foreach from=$productTabs item=productTab key=tabName}
    <li id="tab_{$tabName}" class="nav-item"><a href="#{$tabName}" data-toggle="tab"
            class="nav-link description-tab">{l s="%s" sprintf=[$productTab.fullName]}</a></li>
{/foreach}

And tabsContent.tpl

{foreach from=$productTabs item=productTab key=tabName}
    <div class="tab-pane panel panel-default " id="{$tabName}">
        <textarea id="{$tabName}" class="autoload_rte form-control">{if $productTab.isContent}{$productTab.content}{/if}</textarea>
    </div>
{/foreach}

Now what I need is being able to generate my tabs content like : {{ form_widget(formCustomTab) }}

But I don't know twig templates at all, I've been looking through PS code, but I don't really understand with {{ form_widget(formDescription) }} where formDescritption is set, where the form_view is set ? How to generate a similar form view ? 

If there is any twig expert that could help, I would be really thankfull

jmauclair

jmauclair

After searching through all the Prestashop files, I've found the file : essentials.html.twig (BASE_PS_DIR\src\PrestaShopBundle\Resources\views\Admin\Product\ProductPage\Panels).

So, what would be perfect would to be able to add a tab with the description and short description tabs, what I've done thanks to cusom hooks like that :

            <div class="summary-description-container">
              <ul class="nav nav-tabs bordered">
                <li id="tab_description_short" class="nav-item"><a href="#description_short" data-toggle="tab" class="nav-link description-tab active">{{ 'Summary'|trans({}, 'Admin.Catalog.Feature') }}</a></li>
                <li id="tab_description" class="nav-item"><a href="#description" data-toggle="tab" class="nav-link description-tab">{{ 'Description'|trans({}, 'Admin.Global') }}</a></li>
                {{ renderhook('displayDescriptionAdvancedTabsHeader', { 'id_product': productId }) }}
              </ul>

              <div class="tab-content bordered">
                <div class="tab-pane panel panel-default active" id="description_short">
                  {{ form_widget(formShortDescription) }}
                </div>
                <div class="tab-pane panel panel-default " id="description">
                  {{ form_widget(formDescription) }}
                </div>
                {{ renderhook('displayDescriptionAdvancedTabsContent', { 'id_product': productId }) }}
              </div>
            </div>

Where descriptionAdvanced are customs hooks.

Now what I need is being able to generate my tabs content like : {{ form_widget(formCustomTab) }}

But I don't know twig templates at all, I've been looking through PS code, but I don't really understand with {{ form_widget(formDescription) }} where formDescritption is set, where the form_view is set ? How to generate a similar form view ? 

If there is any twig expert that could help, I would be really thankfull

×
×
  • Create New...