Jump to content

[Résolu] Fil d'Ariane - tronquer le nom du produit


Recommended Posts

Bonjour,

Je souhaiterais tronquer le nom du produit dans mon fil d'Ariane.
Je pense que je dois faire les modifications dans le fichier products.php.

$smarty->assign(array(
'return_link' => (isset($category->id) AND $category->id) ? Tools::safeOutput($link->getCategoryLink($category)) : '[removed] history.back();',
'path' => ((isset($category->id) AND $category->id) ? Tools::getFullPath(intval($category->id), $product->name) : Tools::getFullPath(intval($product->id_default_category), $product->name))
));



Je ne vois pas comment utiliser la fonction truncate dans cette situation.
Je n'utilise Prestashop que depuis 5 jours. Je possède la dernière version stable.

J'ai besoin d'aide ! Merci d'avance.

Link to comment
Share on other sites

Essaye de remplacer :

$smarty->assign(array(
'return_link' => (isset($category->id) AND $category->id) ? Tools::safeOutput($link->getCategoryLink($category)) : '[removed] history.back();',
'path' => ((isset($category->id) AND $category->id) ? Tools::getFullPath(intval($category->id), $product->name) : Tools::getFullPath(intval($product->id_default_category), $product->name))
));



par :

$smarty->assign(array(
'return_link' => (isset($category->id) AND $category->id) ? Tools::safeOutput($link->getCategoryLink($category)) : '[removed] history.back();',
'path' => ((isset($category->id) AND $category->id) ? Tools::getFullPath(intval($category->id), $product->name) : Tools::getFullPath(intval($product->id_default_category), smarty_modifier_truncate($product->name, 80)))
));



Tu peux remplacer le 80 par n'importe quel nombre, cette fonction est sensée agir comme le truncate de smarty. Je n'ai pas testé le code alors dit moi si ça marche.

Link to comment
Share on other sites

Merci pour ton aide amaury !

Remplacer :

$smarty->assign(array(
'return_link' => (isset($category->id) AND $category->id) ? Tools::safeOutput($link->getCategoryLink($category)) : '[removed] history.back();',
'path' => ((isset($category->id) AND $category->id) ? Tools::getFullPath(intval($category->id), $product->name) : Tools::getFullPath(intval($product->id_default_category), $product->name))
));



Par :

$smarty->assign(array(
'return_link' => (isset($category->id) AND $category->id) ? Tools::safeOutput($link->getCategoryLink($category)) : '[removed] history.back();',
'path' => ((isset($category->id) AND $category->id) ? Tools::getFullPath(intval($category->id), smarty_modifier_truncate($product->name, 20)) : Tools::getFullPath(intval($product->id_default_category), smarty_modifier_truncate($product->name, 20)))
));



J'ai remplacé les deux $product->name.

Bonne journée !

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...