Jump to content

Erreur 500 au moment de valider une commande gratuite


Recommended Posts

Bonjour,

Je suis en création de mon site sous PS 1.7.8.8.

Je fais mes derniers tests avant mise en production.

Toutes mes commandes avec paiement se déroulent bien : par cb, par virement, paypal, tout va bien.

En revanche, je prévois de proposer des freebies en téléchargement gratuit, avec passage de commande à 0€.

Mais sur ces commandes à 0€, quand je clique sur le dernier bouton "commander" j'ai une erreur 500.

La commande est bien enregistrée et la facture est bien générée aussi mais ça n'est pas très rassurant pour les clients d'avoir un bug à ce moment-là, surtout quand on essaie de les attirer avec un produit gratuit pour qu'après ils commandent des produits payants 😉 

Voici ce que m'indique le debug.

************************************************************

(1/1) SmartyCompilerException
Syntax error in template "file:/home/"mon login personnel"/www/themes/classic/pdf/invoice.tax-tab.tpl" on line 81 "{displayPrice currency=$order->id_currency price=$line.total_tax_excl}" unknown tag 'displayPrice'

in smarty_internal_templatecompilerbase.php line 81
at Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag \'displayPrice\'', 81, true)
in smarty_internal_templatecompilerbase.php line 1761
at Smarty_Internal_TemplateCompilerBase->compileTag2('displayPrice', array(array('currency' => '$_smarty_tpl->tpl_vars[\'order\']->value->id_currency'), array('price' => '$_smarty_tpl->tpl_vars[\'line\']->value[\'total_tax_excl\']')), array())
in smarty_internal_templatecompilerbase.php line 565
at Smarty_Internal_TemplateCompilerBase->compileTag('displayPrice', array(array('currency' => '$_smarty_tpl->tpl_vars[\'order\']->value->id_currency'), array('price' => '$_smarty_tpl->tpl_vars[\'line\']->value[\'total_tax_excl\']')))
in smarty_internal_templateparser.php line 2361
at Smarty_Internal_Templateparser->yy_r25()
in smarty_internal_templateparser.php line 3481
at Smarty_Internal_Templateparser->yy_reduce(25)
in smarty_internal_templateparser.php line 3573
at Smarty_Internal_Templateparser->doParse(14, '}')
in smarty_internal_smartytemplatecompiler.php line 128
at Smarty_Internal_SmartyTemplateCompiler->doCompile('{** * Copyright since 2007 PrestaShop SA and Contributors * PrestaShop is an International Registered Trademark & Property of PrestaShop SA * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * 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 https://devdocs.prestashop.com/ for more information. * * @author PrestaShop SA and Contributors <[email protected]> * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) *}<!-- TAX DETAILS -->{if $isTaxEnabled} {if $tax_exempt} {l s=\'Exempt of VAT according to section 259B of the General Tax Code.\' d=\'Shop.Pdf\' pdf=\'true\'} {elseif (isset($tax_breakdowns) && $tax_breakdowns)} <table id="tax-tab" width="100%"> <thead> <tr> <th class="header small">{l s=\'Tax Detail\' d=\'Shop.Pdf\' pdf=\'true\'}</th> <th class="header center small">{l s=\'Tax Rate\' d=\'Shop.Pdf\' pdf=\'true\'}</th> {if $display_tax_bases_in_breakdowns} <th class="header center small">{l s=\'Base price\' d=\'Shop.Pdf\' pdf=\'true\'}</th> {/if} <th class="header-right small">{l s=\'Total Tax\' d=\'Shop.Pdf\' pdf=\'true\'}</th> </tr> </thead> <tbody> {assign var=has_line value=false} {foreach $tax_breakdowns as $label => $bd} {assign var=label_printed value=false} {foreach $bd as $line} {* We force the display of the ecotax even if the ecotax rate is equals to 0 *} {if $line.rate == 0 and $label != \'ecotax_tax\'} {continue} {/if} {assign var=has_line value=true} <tr> <td class="white"> {if !$label_printed} {if $label == \'product_tax\'} {l s=\'Products\' d=\'Shop.Pdf\' pdf=\'true\'} {elseif $label == \'shipping_tax\'} {l s=\'Shipping\' d=\'Shop.Pdf\' pdf=\'true\'} {elseif $label == \'ecotax_tax\'} {l s=\'Ecotax\' d=\'Shop.Pdf\' pdf=\'true\'} {elseif $label == \'wrapping_tax\'} {l s=\'Wrapping\' d=\'Shop.Pdf\' pdf=\'true\'} {/if} {assign var=label_printed value=true} {/if} </td> <td class="center white"> {$line.rate} % </td> {if $display_tax_bases_in_breakdowns} <td class="center white"> {if isset($is_order_slip) && $is_order_slip}- {/if} {displayPrice currency=$order->id_currency price=$line.total_tax_excl} </td> {/if} <td class="right white"> {if isset($is_order_slip) && $is_order_slip}- {/if} {displayPrice currency=$order->id_currency price=$line.total_amount} </td> </tr> {/foreach} {/foreach} {if !$has_line} <tr> <td class="white center" colspan="{if $display_tax_bases_in_breakdowns}4{else}3{/if}"> {l s=\'No taxes\' d=\'Shop.Pdf\' pdf=\'true\'} </td> </tr> {/if} </tbody> </table> {/if}{/if}<!-- / TAX DETAILS -->', true)
in smarty_internal_templatecompilerbase.php line 481
at Smarty_Internal_TemplateCompilerBase->compileTemplateSource(object(SmartyDevTemplate), false, null)
in smarty_internal_templatecompilerbase.php line 402
at Smarty_Internal_TemplateCompilerBase->compileTemplate(object(SmartyDevTemplate))
in smarty_template_compiled.php line 184
at Smarty_Template_Compiled->compileTemplateSource(object(SmartyDevTemplate))
in smarty_template_compiled.php line 141
at Smarty_Template_Compiled->process(object(SmartyDevTemplate))
in smarty_template_compiled.php line 105
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('/home/"mon login personnel"/www/themes/classic/pdf/invoice.tax-tab.tpl', null, null, null, false, true, false)
in SmartyDev.php line 40
at SmartyDev->fetch('/home/"mon login personnel"/www/themes/classic/pdf/invoice.tax-tab.tpl')
in HTMLTemplateInvoice.php line 420
at HTMLTemplateInvoiceCore->getTaxTabContent()
in HTMLTemplateInvoice.php line 355
at HTMLTemplateInvoiceCore->getContent()
in PDF.php line 152
at PDFCore->render(false)
in PaymentModule.php line 601
at PaymentModuleCore->validateOrder(45, '2', 0, 'Commande gratuite', null, array(), null, false, '38fbdc37143380776359e0b046f4ed02')
in OrderConfirmationController.php line 159
at OrderConfirmationControllerCore->checkFreeOrder()
in OrderConfirmationController.php line 49
at OrderConfirmationControllerCore->init()
in Controller.php line 287
at ControllerCore->run()
in Dispatcher.php line 525
at DispatcherCore->dispatch()
in index.php line 28

 

***********************************************************

Est-ce qu'il y aurait par ici quelqu'un qui comprendrait mieux que moi le html pour me dire comment je peux corriger ça ?

Merci beaucoup 🙂

 

Link to comment
Share on other sites

  • 1 month later...

Bonjour,

Dans invoice.tax-tab.tpl, à la ligne 81, il y a une erreur de syntaxe car la balise 'displayPrice' utilisée n'est pas reconnue. Cela peut être dû à une mauvaise utilisation de la balise ou à l'absence d'un module ou d'une fonctionnalité nécessaire pour interpréter cette balise

Link to comment
Share on other sites

Bonjour,

La fonction 'displayPrice' est "deprecated" depuis la version 1.7.6.0. Vous avez sûrement utilisé un module qui n'est plus compatible avec votre Prestashop.

Idéalement, il faudrait soit vérifier si le module propose une mise à jour ou changer de module.

Sinon, essayer de modifier le fichier en remplaçant:

Le 26/05/2023 à 7:02 PM, Orely a dit :

{displayPrice currency=$order->id_currency price=$line.total_tax_excl}

par :

{assign var=formated_price value=Context::getContext()->currentLocale->formatPrice($line.total_tax_excl, $order->id_currency)}
{$formated_price}

 

  • Like 1
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...