Prestashop 1.7.1 - Top banner which hook shall be used? - prestashop

Following this question I have created a new banner.
Now I want to insert a hook, but I am wondering which hook shall be used to display it on top of every page (as a promotional banner).
Thanks

Assuming you're using the classic theme, you can use the displayBanner hook. If you look at header.tpl you can find the following block:
{block name='header_banner'}
<div class="header-banner">
{hook h='displayBanner'}
</div>
{/block}
which should be displayed on top of every page

Related

Vue syntax rendered after page load

I am a newbie in Vue.js. I am currently using Vue.js on top of asp.net core.
I noticed that in 99% time page is served before Vue.js syntax is rendered. How can I prevent this from happening?
For example
When page load first I see
<ol>
<li v-for="u in subscribers">{{ u.name }} - {{u.email}}</li>
</ol>
And then after split of a second I see
<ol>
<li>John - john#domain.com</li>
<li>John1 - joh1n#domain.com</li>
</ol>
Since the template is written inside the page HTML code it will always be shown first by the browser when it’s loading the page. Usually Vue components include a template which is used to render the data and this won’t happen.
You can take the template that is written on the page and add it to the Vue component so it will use it to render, not the contents of the page. The simplest way is to just add the template as a parameter to the Vue component, but later on it may be better to use separate template files, or Single File Components which may take a bit more work.

django-autocomplete-light how to copy multi select fields

I'm using django-autocomplete-light with django 1.8.
I want to be able to copy the selected contents from one autocomplete field into another which requires overriding javascript code.
I tried duplicating the html content inside the autocomplete tool into another one in the browser debugger which looked good but when I click the save button in the admin page, it ignores my copied value.
Any ideas?
It works if you use an empty form for #form_template as such:
<div class = 'table' id="form_template" style="display:none">
{{ formset.empty_form }}
</div>
<div class = 'table'>
<table>
<!-- don't use #form_template in your actual form -->
From github issue

how can i add a new button button on dashboard ordres page prestashop

I am using prestashop for an ecomercial websiteand i want to export the orderss into an excel file. For that i wanted to add a new button in the dashboad orders page.
the problem is that i really don't know how and which file i have to edit.
I was thinking about adding an html code but i tried many pages, including the adminController and it didn't work using this code:
<button type="button">Click Me!</button>
I know that there a module for that, but i prefer not to us it.
If you're using Prestashop 1.6
You need to edit this file /adminxxxx/themes/default/template/controllers/orders/helpers/list/list_header.tpl
(this file extends /adminxxxx/themes/default/template/helpers/list/list_headers.tpl.)
have a look at the second file and find an appropriate empty block declaration where you want to put your button for example {block name="preTable"}{/block}.
In the first file you can override this block including your button using:
{block name=preTable}
<div><button type="button">Click Me!</button></div>
{/block}

easy durandal please wait while loading spinner

Is there an easy durandal way to clear the view and put a loading or please wait... on the screen so the user gets some feedback to know that it is working until the ajax content loads?
Right now when I click on a something that navigates to a child route and that child route loads a module that has to do a lot of stuff in activate(), it does not switch the nav or clear the screen or give any feedback to the user that it is working and I see them clicking many times over and over and getting frustrated, then just about when they want to give up, the page loads in fine.
I would like to make this default functionality for my app and not have to do something special in every module or on every page, is that possible?
Thanks.
Have you tried to use router.isNavigating? Original Durandal template contains a spinner like this:
<div class="loader pull-right" data-bind="css: { active: router.isNavigating }">
<i class="icon-spinner icon-2x icon-spin"></i>
</div>
A large percentage of the time, what you're looking for can be obtained very simply via:
<div data-bind="compose:ActiveVm">
<div class="text-center" style="margin : 75px">
<i class="fa fa-spinner fa-spin"></i>
</div>
</div>
The inner div can be any arbitrary markup which will display while the viewmodel is going through activation.
Note that this currently only displays the placeholder content the first time this dom section is composed. If you have a section of your application which is being updated via an observable viewmodel + compose approach, you could use the approach here:
Durandal: Showing a 'LOADING...' during composition
For anyone visiting from the future, this issue might be worth checking out in case native support for this is desired:
https://github.com/BlueSpire/Durandal/issues/414

how to not execute a scriptlet code in a tab when using jquery ui tab plugin

I just came across jquery ui tabs plugin.
Its a very nice implementation but what If current code is in place.
<div id="tabs">
<ul>
<li>tab1 </li>
<li>tab2</li>
</ul>
<div id="tabs-1"><%System.out.println("test1");%></div>
<div id="tabs-2"><%System.out.println("test2");%></div>
</div>
in this case, when the page initially loads, tab1 is the default tab. However, both the sys out statements are executed initially. It does not matter what the default tab is. Ideally first sys out should execute when tab1 is selected and second when tab2 is selected.
Is there any way to avoid this? Or the only way is to have different pages for different tabs?
the scriptlet will execute because it is not restrained by javascript. If you have content in tabs-1 and tabs-2 that you do not want to execute until unless the tab is clicked then you should use the 'ajax' feature of this plugin. The demo site shows how to do this.