gouna Posted September 27, 2023 Share Posted September 27, 2023 (edited) Bonjour, Je cherche à régler un problème en mode debug sur les fiches produit avec personnalisation. Au moment d'enregistrer la personnalisation, voici un bug : (1/1) ContextErrorException Notice: Undefined index: product_availability in 44905c4d138084cba0527b43f6aa8be542635a23_2.file.header.tpl.php line 93 at content_65142726a42851_34891978(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216 at Smarty_Internal_Template->render(false, 0)in smarty_internal_templatebase.php line 232 at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, null, null, 0)in smarty_internal_templatebase.php line 116 at Smarty_Internal_TemplateBase->fetch(null, null, null, null, false, true, false)in SmartyDevTemplate.php line 40 at SmartyDevTemplateCore->fetch()in Module.php line 2449 at ModuleCore->display('/home/mbcquuge/public_html/modules/ps_facebook/ps_facebook.php', 'views/templates/hook/header.tpl')in PixelHandler.php line 110 at PixelHandler->handleEvent(array('event_type' => 'CustomizeProduct', 'event_time' => 1695820244, 'user' => array('city' => null, 'countryIso' => null, 'postCode' => null, 'phone' => null, 'stateIso' => null, 'gender' => null, 'birthday' => null, 'firstname' => null, 'lastname' => null, 'email' => null), 'eventID' => 'CustomizeProduct_1695820244_651429d4f33129.43188381'), 'hookDisplayHeader')in EventDispatcher.php line 96 at EventDispatcher->dispatch('hookDisplayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6))in ps_facebook.php line 339 at Ps_facebook->hookDisplayHeader(array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6))in Hook.php line 1007 at HookCore::coreCallHook(object(Ps_facebook), 'hookDisplayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6))in Hook.php line 431 at HookCore::callHookOn(object(Ps_facebook), 'displayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6))in Hook.php line 944 at HookCore::exec('displayHeader')in FrontController.php line 598 at FrontControllerCore->initContent()in ProductController.php line 417 at ProductControllerCore->initContent()in Controller.php line 306 at ControllerCore->run()in Dispatcher.php line 525 at DispatcherCore->dispatch()in index.php line 28 Auriez-vous une solution ? Merci. Edited October 2, 2023 by gouna (see edit history) Link to comment Share on other sites More sharing options...
kerlin Posted September 28, 2023 Share Posted September 28, 2023 Bonjour, la personnalisation se fait via un module ? Si oui, mieux vaut voir avec son développeur. Link to comment Share on other sites More sharing options...
gouna Posted September 28, 2023 Author Share Posted September 28, 2023 Bonjour, j'ai un module de personnalisation pour certains articles, mais le problème exposé concerne uniquement les champs de personnalisation natifs de prestashop. Link to comment Share on other sites More sharing options...
kerlin Posted September 28, 2023 Share Posted September 28, 2023 avez-vous essayé en désactivant le module de personnalisation ? 1 Link to comment Share on other sites More sharing options...
Mediacom87 Posted September 29, 2023 Share Posted September 29, 2023 Bonjour, le souci semble venir du module ps_facebook dans le fichier header.tpl où il doit être fait référence à un élément du tableau du produit qui cherche product_availability qui n'existe pas, donc il faudrait contrôler dans le code avec un isset() avant d'appeler cet élément. 1 Link to comment Share on other sites More sharing options...
Mediacom87 Posted September 29, 2023 Share Posted September 29, 2023 Le 27/09/2023 à 4:08 PM, gouna a dit : at ModuleCore->display('/home/mbcquuge/public_html/modules/ps_facebook/ps_facebook.php', 'views/templates/hook/header.tpl')in PixelHandler.php line 110 J'appuie ma réflexion sur cette ligne 1 Link to comment Share on other sites More sharing options...
gouna Posted September 29, 2023 Author Share Posted September 29, 2023 (edited) Bonjour, Effectivement j'ai désactivé le module "PS Social with Facebook & Instagram v1.31.0" et le problème n'est plus présent. Voici la portion de code du fichier PixelHandler.php public function handleEvent($params, $hookName) { $pixel_id = $this->configurationAdapter->get(Config::PS_PIXEL_ID); if (empty($pixel_id)) { return ''; } $track = 'track'; $eventType = false; if (isset($params['event_type'])) { $eventType = $params['event_type']; } if (isset($params['user'])) { $userData = $params['user']; } $content = $eventData = []; if (isset($params['eventID'])) { $eventData = ['eventID' => $params['eventID']]; } if (isset($params['custom_data'])) { $content = $params['custom_data']; } $smartyVariables = [ 'pixel_fc' => $this->module->front_controller, 'id_pixel' => $pixel_id, 'type' => $eventType, 'content' => $this->formatPixel($content), 'track' => $track, 'eventData' => $this->formatPixel($eventData), ]; if (isset($userData)) { $smartyVariables['userInfos'] = $this->getCustomerInformation($userData); } $content = ''; if ($hookName === 'hookDisplayHeader') { $this->context->smarty->assign($smartyVariables); $content .= $this->module->display($this->module->getfilePath(), 'views/templates/hook/header.tpl'); } $this->context->smarty->assign($smartyVariables); $this->templateBuffer->add($this->module->display($this->module->getfilePath(), 'views/templates/hook/fbTrack.tpl')); // Return the existing content in case we have a display hook if (strpos($hookName, 'Display') === 4 && !$this->isCurrentRequestAnAjax()) { $content .= $this->templateBuffer->flush(); } return $content; } Edited September 29, 2023 by gouna (see edit history) Link to comment Share on other sites More sharing options...
Mediacom87 Posted September 29, 2023 Share Posted September 29, 2023 Le problème se situe dans le fichier header.tpl du module et non au niveau du PHP. 1 Link to comment Share on other sites More sharing options...
gouna Posted September 29, 2023 Author Share Posted September 29, 2023 Merci, <!-- Set Facebook Pixel Product Export --> {if isset($page) } {if $page.page_name == 'product'} <meta property="og:type" content="product"> <meta property="og:url" content="{$urls.current_url}"> <meta property="og:title" content="{$page.meta.title}"> <meta property="og:site_name" content="{$shop.name}"> <meta property="og:description" content="{$page.meta.description}"> <meta property="og:image" content="{$product.cover.large.url}"> {if $product.show_price} <meta property="product:pretax_price:amount" content="{$product.price_tax_exc}"> <meta property="product:pretax_price:currency" content="{$currency.iso_code}"> <meta property="product:price:amount" content="{$product.price_amount}"> <meta property="product:price:currency" content="{$currency.iso_code}"> {/if} {if isset($product.weight) && ($product.weight != 0)} <meta property="product:weight:value" content="{$product.weight}"> <meta property="product:weight:units" content="{$product.weight_unit}"> {/if} {if isset($product_manufacturer->id)} <meta property="product:brand" content="{$product_manufacturer->name}"> {/if} <meta property="product:availability" content="{$product_availability}"> <meta property="product:condition" content="{$product.embedded_attributes.condition}"> <meta property="product:retailer_item_id" content="{$retailer_item_id}"> <meta property="product:item_group_id" content="{$product.id_product}"> <meta property="product:category" content="{$item_group_id}"/> {/if} {/if} <!-- END OF Set Facebook Pixel Product Export --> Ca doit donc être cette section qui pose problème... Link to comment Share on other sites More sharing options...
Mediacom87 Posted September 29, 2023 Share Posted September 29, 2023 (edited) {if isset($product_availability)} <meta property="product:availability" content="{$product_availability}"> {/if} Edited September 29, 2023 by Mediacom87 (see edit history) Link to comment Share on other sites More sharing options...
gouna Posted September 29, 2023 Author Share Posted September 29, 2023 Merci, l'erreur est toujours présente : (1/1) ContextErrorException Notice: Undefined index: product_availability in 44905c4d138084cba0527b43f6aa8be542635a23_2.file.header.tpl.php line 94 at content_6516e9043b4b56_07726031(object(SmartyDevTemplate)) in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate)) in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate)) in smarty_internal_template.php line 216 at Smarty_Internal_Template->render(false, 0) in smarty_internal_templatebase.php line 232 at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, null, null, 0) in smarty_internal_templatebase.php line 116 at Smarty_Internal_TemplateBase->fetch(null, null, null, null, false, true, false) in SmartyDevTemplate.php line 40 at SmartyDevTemplateCore->fetch() in Module.php line 2449 at ModuleCore->display('/home/mbcquuge/public_html/modules/ps_facebook/ps_facebook.php', 'views/templates/hook/header.tpl') in PixelHandler.php line 110 at PixelHandler->handleEvent(array('event_type' => 'CustomizeProduct', 'event_time' => 1696000296, 'user' => array('city' => null, 'countryIso' => null, 'postCode' => null, 'phone' => null, 'stateIso' => null, 'gender' => null, 'birthday' => null, 'firstname' => null, 'lastname' => null, 'email' => null), 'eventID' => 'CustomizeProduct_1696000296_6516e92841b9e2.82557702'), 'hookDisplayHeader') in EventDispatcher.php line 96 at EventDispatcher->dispatch('hookDisplayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in ps_facebook.php line 339 at Ps_facebook->hookDisplayHeader(array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in Hook.php line 1007 at HookCore::coreCallHook(object(Ps_facebook), 'hookDisplayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in Hook.php line 431 at HookCore::callHookOn(object(Ps_facebook), 'displayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in Hook.php line 944 at HookCore::exec('displayHeader') in FrontController.php line 598 at FrontControllerCore->initContent() in ProductController.php line 417 at ProductControllerCore->initContent() in Controller.php line 306 at ControllerCore->run() in Dispatcher.php line 525 at DispatcherCore->dispatch() in index.php line 28 Link to comment Share on other sites More sharing options...
gouna Posted September 29, 2023 Author Share Posted September 29, 2023 J'ai rajouté un "$" dans "{if isset($product_availability)}", l'erreur est maintenant celle-ci : (1/1) ContextErrorException Notice: Undefined index: retailer_item_id in 44905c4d138084cba0527b43f6aa8be542635a23_2.file.header.tpl.php line 99 at content_6516ea2256d4f2_57375174(object(SmartyDevTemplate)) in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate)) in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate)) in smarty_internal_template.php line 216 at Smarty_Internal_Template->render(false, 0) in smarty_internal_templatebase.php line 232 at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, null, null, 0) in smarty_internal_templatebase.php line 116 at Smarty_Internal_TemplateBase->fetch(null, null, null, null, false, true, false) in SmartyDevTemplate.php line 40 at SmartyDevTemplateCore->fetch() in Module.php line 2449 at ModuleCore->display('/home/mbcquuge/public_html/modules/ps_facebook/ps_facebook.php', 'views/templates/hook/header.tpl') in PixelHandler.php line 110 at PixelHandler->handleEvent(array('event_type' => 'CustomizeProduct', 'event_time' => 1696000554, 'user' => array('city' => null, 'countryIso' => null, 'postCode' => null, 'phone' => null, 'stateIso' => null, 'gender' => null, 'birthday' => null, 'firstname' => null, 'lastname' => null, 'email' => null), 'eventID' => 'CustomizeProduct_1696000554_6516ea2a659c43.48206645'), 'hookDisplayHeader') in EventDispatcher.php line 96 at EventDispatcher->dispatch('hookDisplayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in ps_facebook.php line 339 at Ps_facebook->hookDisplayHeader(array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in Hook.php line 1007 at HookCore::coreCallHook(object(Ps_facebook), 'hookDisplayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in Hook.php line 431 at HookCore::callHookOn(object(Ps_facebook), 'displayHeader', array('cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 6)) in Hook.php line 944 at HookCore::exec('displayHeader') in FrontController.php line 598 at FrontControllerCore->initContent() in ProductController.php line 417 at ProductControllerCore->initContent() in Controller.php line 306 at ControllerCore->run() in Dispatcher.php line 525 at DispatcherCore->dispatch() in index.php line 28 Link to comment Share on other sites More sharing options...
Mediacom87 Posted September 29, 2023 Share Posted September 29, 2023 Je ne sais pas quelle version du module, vous utilisez, mais regardez si une mise à jour n'existerait pas pour corriger tous ces bugs, car il y a clairement un souci de développement actuellement sur ce module. Et si malgré tout les problème persistent, contactez le support du module en question. Link to comment Share on other sites More sharing options...
gouna Posted September 29, 2023 Author Share Posted September 29, 2023 Oui c'est la dernière version, je vais contacter le support. Merci. Link to comment Share on other sites More sharing options...
gouna Posted October 2, 2023 Author Share Posted October 2, 2023 Problème résolu en contactant le support (extrêmement réactif) : problème de hook, il fallait dégréffer le module du Displayheader Link to comment Share on other sites More sharing options...
wepresta Posted October 2, 2023 Share Posted October 2, 2023 1 hour ago, gouna said: Problème résolu en contactant le support (extrêmement réactif) : problème de hook, il fallait dégréffer le module du Displayheader Top ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now