Jump to content

Afficher si un produit est nouveau dans la liste des produits en BO (astuce)


Recommended Posts

Petite contribution :-)

 

Pour savoir si un produit est toujours considéré comme nouveauté (Prestashop 1.6.0.14)

Petite adaptation dans le fichier suivant:

 

Racine/controllers/admin/AdminProductsController.php

que vous copierez et collerez dans

Racine/override/controllers/admin/AdminProductsController.php

 

Ajout ligne +/- 264

$this->fields_list['datetime'] = array(
                'title' => $this->l('Date'),
                'width' => 130,
                'type' => 'date',
                'align' => 'right',
                'filter_key' => 'a!date_add'
            );

ensuite:

Copiez:

Racine/admin/themes/default/template/helpers/list/list-header.tpl

Racine/admin/themes/default/template/helpers/list/list-content.tpl

Collez:

Racine/override/controllers/admin/templates/products/helpers/list/list-header.tpl

Racine/override/controllers/admin/templates/products/helpers/list/list-content.tpl

 

ajout ligne +/- 294 list-header.tpl

<th class="text-center">{l s='New'} {l s='Product'}  </th>

ajout ligne +/- 369 list-header.tpl

<th class="text-center">
{assign var='nb_days_new_timestamp' value=Configuration::get('PS_NB_DAYS_NEW_PRODUCT')}
{$nb_days_new_timestamp} {l s='Days'}
</th>

ajout ligne +/- 151 list-content.tpl

<td class="text-center">
        
        {assign var='nb_days_new_timestamp' value=Configuration::get('PS_NB_DAYS_NEW_PRODUCT')}
        {assign var='nb_days_new' value=60*60*24*$nb_days_new_timestamp}
        
        {if strtotime($smarty.now|date_format:'%d-%m-%Y %H:%M:%S')-strtotime($tr.datetime|date_format:'%d-%m-%Y %H:%M:%S') >$nb_days_new}    {*30jours*}
            <i class="icon-times-circle icon-border" style="color:#e27c79;font-size: 2em;"></i>
        {else}
            <i class="icon-check-circle icon-border" style="color:#93cd60;font-size: 2em;"></i>
        {/if}
</td>

Pour terminer n'oubliez pas de recompiler

BO -> paramètres avancés -> Performances -> SMARTY -> Enregistrer

 

 

 

post-824084-0-94885200-1438109622_thumb.jpg

Edited by votre-evenement.be (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...