user2861455
user2861455

Reputation: 55

PRESTASHOP - additional configuration page

I'm working on a custom prestashop module and i need to add more configuration page.

For the time being i can configure it on only a single page by using the getContent() function, how to add more pages.

Upvotes: 0

Views: 449

Answers (1)

Dovis
Dovis

Reputation: 167

I would suggest using tabs.

You can get content for your tabs in the getContent() function from other functions in your module. You can use FormHelper for both forms.

Let's assume you have settings form and statuses form. You can do something like this:

public function getContent()
{
    $this->context->smarty->assign(array(
        'settingsHtml' => $this->renderSettingsForm(),
        'statusesHtml' => $this->renderStatusesForm()
    ));

    $configurationForm = $this->context->smarty->fetch($this->local_path.'views/templates/admin/configure.tpl');
    $this->html .= $configurationForm;

    return $this->html;
}

And then in your configure.tpl file you can do like this:

<ul class="nav nav-tabs">
    <li role="presentation" class="settings"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">{l s='Settings' mod='yourmodulename'}</a></li>
    <li role="presentation" class="statuses"><a href="#statuses" aria-controls="statuses" role="tab" data-toggle="tab">{l s='Statuses' mod='yourmodulename'}</a></li>
</ul>

<div class="tab-content">
    <div role="tabpanel" class="tab-pane" id="settings">
        {$settingsHtml}
    </div>

    <div role="tabpanel" class="tab-pane" id="statuses">
        {$statusesHtml}
    </div>
</div>

Upvotes: 1

Related Questions