Jump to content

[Résolu] Erreur nouveau format d'image module produits phares


Recommended Posts

Bonjour,

 

Je cherchais à créer un format d'image unique au module produits phares sur la page d'accueil, après avoir créer le format voulu, nommé "home_featured" dans le back-office de prestashop, j'ai donc modifié dans homefeatured.tpl la ligne :

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /> 

par

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_featured')}" height="{$home_featured.height}" width="{$home_featured.width}" alt="{$product.name|escape:html:'UTF-8'}" /> 

Je viens d'essayer cette technique, les images apparaissent bien sous leur nouveaux format mais j'ai maintenant une erreur sous chaque image (erreur affiché avec le mode dev activé) où le nom du produits, le prix etc.... n'apparaissent plus: 

( ! ) Notice: Undefined index: home_featuredSize in C:\wamp\www\prestashop156\cache\smarty\compile\20\15\cb\2015cbe3ac457e2b329e1251728ef40cdc1768aa.file.homefeatured.tpl.cache.php on line 83 Call Stack #TimeMemoryFunctionLocation 10.000632444384{main}( )..\index.php:0 20.112341747328DispatcherCore->dispatch( )..\index.php:28 30.119642637408ControllerCore->run( )..\Dispatcher.php:348 40.186148292024IndexControllerCore->initContent( )..\Controller.php:167 52.601165772208HookCore::exec( )..\IndexController.php:39 62.785266043912HomeFeatured->hookDisplayHome( )..\Hook.php:457 73.141666709736ModuleCore->display( )..\homefeatured.php:133 83.141866722816Smarty_Internal_TemplateBase->fetch( )..\Module.php:1662 93.397266995704content_52726cfd2347f5_96171589( )..\smarty_internal_templatebase.php:180
( ! ) Notice: Trying to get property of non-object in C:\wamp\www\prestashop156\cache\smarty\compile\20\15\cb\2015cbe3ac457e2b329e1251728ef40cdc1768aa.file.homefeatured.tpl.cache.php on line 83
Call Stack
#    Time    Memory    Function    Location
1    0.0006    32444384    {main}( )    ..\index.php:0
2    0.1123    41747328    DispatcherCore->dispatch( )    ..\index.php:28
3    0.1196    42637408    ControllerCore->run( )    ..\Dispatcher.php:348
4    0.1861    48292024    IndexControllerCore->initContent( )    ..\Controller.php:167
5    2.6011    65772208    HookCore::exec( )    ..\IndexController.php:39
6    2.7852    66043912    HomeFeatured->hookDisplayHome( )    ..\Hook.php:457
7    3.1416    66709736    ModuleCore->display( )    ..\homefeatured.php:133
8    3.1418    66722816    Smarty_Internal_TemplateBase->fetch( )    ..\Module.php:1662
9    3.3972    66995704    content_52726cfd2347f5_96171589( )    ..\smarty_internal_templatebase.php:180
" width="
( ! ) Notice: Undefined index: home_featuredSize in C:\wamp\www\prestashop156\cache\smarty\compile\20\15\cb\2015cbe3ac457e2b329e1251728ef40cdc1768aa.file.homefeatured.tpl.cache.php on line 84
Call Stack
#    Time    Memory    Function    Location
1    0.0006    32444384    {main}( )    ..\index.php:0
2    0.1123    41747328    DispatcherCore->dispatch( )    ..\index.php:28
3    0.1196    42637408    ControllerCore->run( )    ..\Dispatcher.php:348
4    0.1861    48292024    IndexControllerCore->initContent( )    ..\Controller.php:167
5    2.6011    65772208    HookCore::exec( )    ..\IndexController.php:39
6    2.7852    66043912    HomeFeatured->hookDisplayHome( )    ..\Hook.php:457
7    3.1416    66709736    ModuleCore->display( )    ..\homefeatured.php:133
8    3.1418    66722816    Smarty_Internal_TemplateBase->fetch( )    ..\Module.php:1662
9    3.3972    66995704    content_52726cfd2347f5_96171589( )    ..\smarty_internal_templatebase.php:180

Selon le rapport d'erreur, l'erreur à l'air de venir de ces 2 lignes, mais je ne vois pas le problème :

" height="<?php echo $_smarty_tpl->tpl_vars['home_featuredSize']->value['height'];?>
" width="<?php echo $_smarty_tpl->tpl_vars['home_featuredSize']->value['width'];?>
Edited by Nekoid (see edit history)
Link to comment
Share on other sites

Bonjour,

 

En quelle version de Prestashop ?

 

En règle générale, tu vas trouver cette information dans un controlleur / fichier principal du module.

Pour les produits phares, ils sont dans /modules/homefeatured/homefeatured.php

 


$this->smarty->assign(array(
				'products' => $products,
				'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
				'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			));
Edited by Whoami (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...