Jump to content

Augmenter le nombre de caractère de la fiche produit


Recommended Posts

Bonjour à tous,

 

J'aimerais augmenter le nombre de caractère de la fiche de tous mes produits qui s'affiche quand je vais dans une catégorie. Le nom du produit est coupé par 3 petits points. Je sais qu'il y a un truncate a mettre dans un fichier pour définir la taille du nom mais je n'ai pas trouvé ou le mettre. Quelqu'un pourrait m'aider à trouver le fichier en question? Version prestashop 1.6.0.14

 

Alexandre

Edited by Alextol (see edit history)
Link to comment
Share on other sites

Bonjour,

 

c'est dans le product-list.tpl du thème ( themes/nomdutheme/product-list.tpl ), trouvez {$product.name|truncate:45:'...'|escape:'html':'UTF-8'} et augmentez le chiffre.

Il possible que ca entraine des problèmes d'affichage.

Edited by iXs (see edit history)
Link to comment
Share on other sites

Bonjour,

 

Merci pour votre réponse. En faisant différent forum j'ai effectivement vu parler de cette ligne {$product.name|truncate:45:'...'|escape:'html':'UTF-8'}

Mais il n'y a aucun ligne de ce nom dans themes/nomdutheme/product-list.tpl . N'y dans product.tpl .

Par contre j'ai trouvé dans products-comparison.tpl :

 

<a class="product-name" href="{$product->getLink()|escape:'html':'UTF-8'}" title="{$product->name|truncate:32:'...'|escape:'html':'UTF-8'}">

{$product->name|truncate:45:'...'|escape:'html':'UTF-8'}
 
et aussi :
 
<div class="product_desc"> {$product->description_short|strip_tags|truncate:60:'...'} </div> 
 
J'ai changé à 100 les 3 truncate mais rien n'y fait, je ne sais pas ou ce trouve {$product.name|truncate:45:'...'|escape:'html':'UTF-8'}
Link to comment
Share on other sites

Bonjour,

 

j'ouvre le fichier product-list.tpl et qu'est ce que je découvre :

<h5 itemprop="name">
    {if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
    <a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
        {$product.name|truncate:45:'...'|escape:'html':'UTF-8'}
    </a>
</h5>

Après peut être que vous utilisez un template personnalisé (on ne peut pas le deviner) il vous faut donc comprendre ce que vous cherchez pour le corriger.

 

ce que vous cherchez c'est juste

$product.name|truncate

après la teille du truncate peut être déjà différent dans votre cas, mais il doit être présent dans product-list.tpl.

Link to comment
Share on other sites

Bonjour,

 

J'ai acheter ce theme http://www.prestabrain.com/tf-demo/?theme=shopping

 

Je vous montre ci-après le script complet de mon fichier product-list.tpl

 

{*

* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{if isset($products) && $products}
{*define numbers of product per line in other page for desktop*}
 
{if Configuration::get('PTS_CP_PRODUCTS_ITEMROW')}
{assign var='nbItemsPerLine' value=Configuration::get('PTS_CP_PRODUCTS_ITEMROW')}
{assign var='nbItemsPerLineTablet' value=Configuration::get('PTS_CP_PRODUCTS_ITEMROW')}
{else}
{assign var='nbItemsPerLine' value=3}
{assign var='nbItemsPerLineTablet' value=3}
{/if}
 
 
{assign var='nbItemsPerLineMobile' value=4}
 
{*define numbers of product per line in other page for tablet*}
{assign var='nbLi' value=$products|@count}
{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
{math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
 
{math equation="nbLi/nbItemsPerLine" nbLi=12 nbItemsPerLine=$nbItemsPerLine assign=colLap}
{math equation="nbLi/nbItemsPerLine" nbLi=12 nbItemsPerLine=$nbItemsPerLineTablet assign=colTablet}
{math equation="nbLi/nbItemsPerLine" nbLi=12 nbItemsPerLine=$nbItemsPerLineMobile assign=colMobile}
<!-- Products list -->
<script type="text/javascript">
var colLap = {$colLap};
var colTablet = {$colTablet};
var colMobile = {$colMobile};
</script>
<ul{if isset($id) && $id} id="{$id}"{/if} class="list-unstyled product_list products-block grid row{if isset($class) && $class} {$class}{/if} {if Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style1'}style1{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style2'}style2 {elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style3'}style3 {elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style4'}style4 {elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style5'}style5{else} default nopadding{/if}">
{foreach from=$products item=product name=products}
{math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile}
{if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
{if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
{if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
<li class="ajax_block_product  col-xs-12 col-sm-{$colMobile} col-md-{$colTablet} col-lg-{$colLap}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} last-in-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} first-in-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)} last-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 0} last-item-of-tablet-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 1} first-item-of-tablet-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} last-item-of-mobile-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} first-item-of-mobile-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}" data-col-lg="{$colLap}" data-col-md="{$colTablet}" data-col-sm="{$colMobile}">
{if Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style1'}
{include file="$tpl_dir./sub/product/style1.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style2'}
{include file="$tpl_dir./sub/product/style2.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style3'}
{include file="$tpl_dir./sub/product/style3.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style4'}
{include file="$tpl_dir./sub/product/style4.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style5'}
{include file="$tpl_dir./sub/product/style5.tpl" product=$product class=''}
{else}
{include file="$tpl_dir./sub/product/default.tpl" product=$product class=''}
{/if}
</li>
{if $smarty.foreach.products.iteration%$nbItemsPerLine==0}
<li class="clearfix hidden-xs col-xs-12 col-sm-12 col-md-12"><hr /></li>
{/if}
{/foreach}
</ul>
{addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL}
{addJsDefL name=max_item}{l s='You cannot add more than %d product(s) to the product comparison' sprintf=$comparator_max_item js=1}{/addJsDefL}
{addJsDef comparator_max_item=$comparator_max_item}
{addJsDef comparedProductsIds=$compared_products}
{/if}
 
Je ne vois pas de truncate, c'est peut être ailleurs
Link to comment
Share on other sites

Bonjour,

 

ah ben oui il est très particulier ce template puisqu'il s'appuie sur un configuration de celui-ci dans le baskoffice.

 

Donc il faut modifier un ou tous les tpl listés dans ce bout de code.

{if Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style1'}
{include file="$tpl_dir./sub/product/style1.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style2'}
{include file="$tpl_dir./sub/product/style2.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style3'}
{include file="$tpl_dir./sub/product/style3.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style4'}
{include file="$tpl_dir./sub/product/style4.tpl" product=$product class=''}
{elseif Configuration::get('PTS_CP_PRODUCT_STYLE') == 'style5'}
{include file="$tpl_dir./sub/product/style5.tpl" product=$product class=''}
{else}
{include file="$tpl_dir./sub/product/default.tpl" product=$product class=''}
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...