Récemment


Error logs (null object)



  • Alors, dans le but de supprimer un max d'erreur, je compilerai ici celles trouvées dans les logs. Sachant que je suis confronté régulièrement à de nouvelles découvertes (celles qui n'empêchent pas le site de tourner, mais qui doivent quand même; disparaître). Celle-ci est nouvelle, depuis peu :
    PHP message: PHP Notice: Undefined index: cover in /var/www/clients/client3/web3/web/cache/smarty/compile/b7/5d/e7/b75de7cecb5353150f8b82a4fba797a03d112b90_0.file.product-list.tpl.php on line 106PHP message: PHP Notice: Trying to access array offset on value of type null in /var/www/clients/client3/web3/web/cache/smarty/compile/b7/5d/e7/b75de7cecb5353150f8b82a4fba797a03d112b90_0.file.product-list.tpl.php on line 106PHP message: PHP Notice: Trying to access array offset on value of type null in /var/www/clients/client3/web3/web/cache/smarty/compile/b7/5d/e7/b75de7cecb5353150f8b82a4fba797a03d112b90_0.file.product-list.tpl.php on line 106 (Idem sur la ligne 107)

    qui correspond donc à ça :
    ligne 106 -> " data-width="<?php echo $_smarty_tpl->tpl_vars['product']->value['cover']['bySize']['home_default']['width'];?>
    ligne 107 -> " data-height="<?php echo $_smarty_tpl->tpl_vars['product']->value['cover']['bySize']['home_default']['height'];?>



  • Faudrait voir le code du product-list.tpl du thème pour en savoir plus, car ce n'est pas dans le thème de base.



  • Tu vas te régaler (j'y ai quand même apporté des modifs suite à ton ajout du from_price) :

    {*

    • 2007-2015 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:

    • http://opensource.org/licenses/afl-3.0.php

    • 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 license@prestashop.com 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 contact@prestashop.com

    • @copyright 2007-2015 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 number of products per line in other page for desktop}
      {if $page_name !='index' && $page_name !='product'}
      {assign var='nbItemsPerLine' value=4}
      {assign var='nbItemsPerLineTablet' value=2}
      {assign var='nbItemsPerLineMobile' value=3}
      {else}
      {assign var='nbItemsPerLine' value=6}
      {assign var='nbItemsPerLineTablet' value=3}
      {assign var='nbItemsPerLineMobile' value=2}
      {/if}
      {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}
      <!-- Products list -->
      <ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/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{if $page_name == 'index' || $page_name == 'product'} col-xs-6 col-sm-4 col-md-2{elseif $page_name == 'category'} col-xs-6 col-sm-6 col-md-3{else} col-xs-12 col-sm-6 col-md-3{/if}{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}">
      <div class="product-container" itemscope itemtype="https://schema.org/Product">
      {if isset($product.new) && $product.new == 1}
      <a class="new-box" href="{$product.link|escape:'html':'UTF-8'}">
      <span class="new-label">{l s='New'}</span>
      </a>
      {/if}
      {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE }
      <a class="sale-box" href="{$product.link|escape:'html':'UTF-8'}">
      <span class="sale-label">{l s='Sale!'}</span>
      </a>
      {/if} <div class="left-block">

                   <div class="product-image-container">
                       <a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
                           <img class="replace-2x img-responsive b-lazy" src="/modules/anlazyloading/views/img/loading.gif" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" isset width="{$homeSize.width}" height="{$homeSize.height}" itemprop="image" data-src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" data-width="{$product.cover.bySize.home_default.width}" data-height="{$product.cover.bySize.home_default.height}" content="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}">
      
                       </a>
                       {if isset($quick_view) && $quick_view}
                           <div class="quick-view-wrapper-mobile">
                           <a class="quick-view-mobile" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
                               <i class="icon-eye-open"></i>
                           </a>
                       </div>
                       <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
                           <span>{l s='Quick view'}</span>
                       </a>
                       {/if}
                       {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                           <div class="content_price" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
                                                          {if $logged == false}
                                                           <a class="see_pro_price" href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}">{l s='Voir prix Pro'}</a>
                                                           {/if}
                                                           {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                                   <span itemprop="price" class="price product-price">
                                       {if $product.from_price}<span class="apartirde survol">{l s='from'}</span>{/if}
                                       {if $product.from_price}
                                           {if !$priceDisplay}
                                               {convertPrice price=$product.from_price} <span class="apartirde survol">TTC</span>
                                           {else}
                                               {convertPrice price=$product.from_price} <span class="apartirde survol">HT</span>
                                           {/if}
                                       {else}
                                           {if !$priceDisplay}
                                               {convertPrice price=$product.price} <span class="apartirde survol">TTC</span>
                                           {else}
                                               {convertPrice price=$product.price_tax_exc} <span class="apartirde survol">HT</span>
                                           {/if}
                                       {/if} 
                                   </span>
                                   <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
                                   {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
                                       {hook h="displayProductPriceBlock" product=$product type="old_price"}
                                       <span class="old-price product-price">
                                           {displayWtPrice p=$product.price_without_reduction}
                                       </span>
                                       {if $product.specific_prices.reduction_type == 'percentage'}
                                           <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
                                       {/if}
                                   {/if}
                                   {hook h="displayProductPriceBlock" product=$product type="price"}
                                   {hook h="displayProductPriceBlock" product=$product type="unit_price"}
                               {/if}
                           </div>
                       {/if}
      
                   </div>
                   {hook h="displayProductDeliveryTime" product=$product}
                   {hook h="displayProductPriceBlock" product=$product type="weight"}
               </div>
               <div class="right-block">
                   <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>
                   {hook h='displayProductListReviews' product=$product}
                   <p class="product-desc" itemprop="description">
                       {$product.description_short|strip_tags:'UTF-8'|truncate:100:'...'}
                   </p>
                   {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                   <div itemprop="offers" itemscope itemtype="https://schema.org/Offer" class="content_price">
                       {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                           <span itemprop="price" class="price product-price">
                               {if $product.from_price}<span class="apartirde survol">{l s='from'}</span>{/if}
                               {if $product.from_price}
                                   {if !$priceDisplay}
                                       {convertPrice price=$product.from_price} <span class="apartirde survol">TTC</span>
                                   {else}
                                       {convertPrice price=$product.from_price} <span class="apartirde survol">HT</span>
                                   {/if}
                               {else}
                                   {if !$priceDisplay}
                                       {convertPrice price=$product.price} <span class="apartirde survol">TTC</span>
                                   {else}
                                       {convertPrice price=$product.price_tax_exc} <span class="apartirde survol">HT</span>
                                   {/if}
                               {/if}
                                                               
                           </span>
                           <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
                           {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
                               {hook h="displayProductPriceBlock" product=$product type="old_price"}
                               <span class="old-price product-price">
                                   {displayWtPrice p=$product.price_without_reduction}
                               </span>
                               
                               {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
                               {if $product.specific_prices.reduction_type == 'percentage'}
                                   <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
                               {/if}
                           {/if}
                           {hook h="displayProductPriceBlock" product=$product type="price"}
                           {hook h="displayProductPriceBlock" product=$product type="unit_price"}
                       {/if}
                   </div>
                   {/if}
                   <div class="button-container">
                       {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE}
                           {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}
                               {capture}add=1&amp;id_product={$product.id_product|intval}{if isset($static_token)}&amp;token={$static_token}{/if}{/capture}
                               <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity > 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}">
                                   <span>{l s='Add to cart'}</span>
                               </a>
                           {else}
                               <span class="button ajax_add_to_cart_button btn btn-default disabled">
                                   <span>{l s='Add to cart'}</span>
                               </span>
                           {/if}
                       {/if}
                       <a itemprop="url" class="button lnk_view btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}">
                           <span>{if (isset($product.customization_required) && $product.customization_required)}{l s='Customize'}{else}{l s='More'}{/if}</span>
                       </a>
                   </div>
                   {if isset($product.color_list)}
                       <div class="color-list-container">{$product.color_list}</div>
                   {/if}
                   <div class="product-flags">
                       {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                           {if isset($product.online_only) && $product.online_only}
                               <span class="online_only">{l s='Online only'}</span>
                           {/if}
                       {/if}
                       {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                           {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                               <span class="discount">{l s='Reduced price!'}</span>
                           {/if}
                   </div>
                   {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                       {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                           <span itemprop="offers" itemscope itemtype="https://schema.org/Offer" class="availability">
                               {if ($product.allow_oosp || $product.quantity > 0)}
                                   <span class="{if $product.quantity <= 0 && !$product.allow_oosp}out-of-stock{else}available-now{/if}">
                                       <link itemprop="availability" href="https://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
                                   </span>
                               {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                                   <span class="available-dif">
                                       <link itemprop="availability" href="https://schema.org/LimitedAvailability" />{l s='Product available with different options'}
                                   </span>
                               {else}
                                   <span class="out-of-stock">
                                       <link itemprop="availability" href="https://schema.org/OutOfStock" />{l s='Out of stock'}
                                   </span>
                               {/if}
                           </span>
                       {/if}
                   {/if}
               </div>
               {if $page_name != 'index'}
                   <div class="functional-buttons clearfix">
                       {hook h='displayProductListFunctionalButtons' product=$product}
                       {if isset($comparator_max_item) && $comparator_max_item}
                           <div class="compare">
                               <a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}">{l s='Add to Compare'}</a>
                           </div>
                       {/if}
                   </div>
               {/if}
           </div><!-- .product-container> -->
       </li>
      

      {/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}



  • du coup c'est là :

    <img class="replace-2x img-responsive b-lazy" src="/modules/anlazyloading/views/img/loading.gif" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" isset width="{$homeSize.width}" height="{$homeSize.height}" itemprop="image" data-src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" data-width="{$product.cover.bySize.home_default.width}" data-height="{$product.cover.bySize.home_default.height}" content="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}">



  • version corrigée:

    {*
    
        2007-2015 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:
    
        http://opensource.org/licenses/afl-3.0.php
    
        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 license@prestashop.com 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 contact@prestashop.com
    
        @copyright 2007-2015 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 number of products per line in other page for desktop}
        {if $page_name !='index' && $page_name !='product'}
        {assign var='nbItemsPerLine' value=4}
        {assign var='nbItemsPerLineTablet' value=2}
        {assign var='nbItemsPerLineMobile' value=3}
        {else}
        {assign var='nbItemsPerLine' value=6}
        {assign var='nbItemsPerLineTablet' value=3}
        {assign var='nbItemsPerLineMobile' value=2}
        {/if}
        {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}
        <!-- Products list -->
        <ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/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{if $page_name == 'index' || $page_name == 'product'} col-xs-6 col-sm-4 col-md-2{elseif $page_name == 'category'} col-xs-6 col-sm-6 col-md-3{else} col-xs-12 col-sm-6 col-md-3{/if}{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}">
        <div class="product-container" itemscope itemtype="https://schema.org/Product">
        {if isset($product.new) && $product.new == 1}
        <a class="new-box" href="{$product.link|escape:'html':'UTF-8'}">
        <span class="new-label">{l s='New'}</span>
        </a>
        {/if}
        {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE }
        <a class="sale-box" href="{$product.link|escape:'html':'UTF-8'}">
        <span class="sale-label">{l s='Sale!'}</span>
        </a>
        {/if} <div class="left-block">
    
                     <div class="product-image-container">
                         <a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
                             <img class="replace-2x img-responsive b-lazy" src="/modules/anlazyloading/views/img/loading.gif" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" isset width="{$homeSize.width}" height="{$homeSize.height}" itemprop="image" data-src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" {if isset($homeSize)} data-width="{$homeSize.width}" data-height="{$homeSize.height}"{/if} content="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}">
    
                         </a>
                         {if isset($quick_view) && $quick_view}
                             <div class="quick-view-wrapper-mobile">
                             <a class="quick-view-mobile" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
                                 <i class="icon-eye-open"></i>
                             </a>
                         </div>
                         <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
                             <span>{l s='Quick view'}</span>
                         </a>
                         {/if}
                         {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                             <div class="content_price" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
                                                            {if $logged == false}
                                                             <a class="see_pro_price" href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}">{l s='Voir prix Pro'}</a>
                                                             {/if}
                                                             {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                                     <span itemprop="price" class="price product-price">
                                         {if $product.from_price}<span class="apartirde survol">{l s='from'}</span>{/if}
                                         {if $product.from_price}
                                             {if !$priceDisplay}
                                                 {convertPrice price=$product.from_price} <span class="apartirde survol">TTC</span>
                                             {else}
                                                 {convertPrice price=$product.from_price} <span class="apartirde survol">HT</span>
                                             {/if}
                                         {else}
                                             {if !$priceDisplay}
                                                 {convertPrice price=$product.price} <span class="apartirde survol">TTC</span>
                                             {else}
                                                 {convertPrice price=$product.price_tax_exc} <span class="apartirde survol">HT</span>
                                             {/if}
                                         {/if} 
                                     </span>
                                     <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
                                     {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
                                         {hook h="displayProductPriceBlock" product=$product type="old_price"}
                                         <span class="old-price product-price">
                                             {displayWtPrice p=$product.price_without_reduction}
                                         </span>
                                         {if $product.specific_prices.reduction_type == 'percentage'}
                                             <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
                                         {/if}
                                     {/if}
                                     {hook h="displayProductPriceBlock" product=$product type="price"}
                                     {hook h="displayProductPriceBlock" product=$product type="unit_price"}
                                 {/if}
                             </div>
                         {/if}
    
                     </div>
                     {hook h="displayProductDeliveryTime" product=$product}
                     {hook h="displayProductPriceBlock" product=$product type="weight"}
                 </div>
                 <div class="right-block">
                     <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>
                     {hook h='displayProductListReviews' product=$product}
                     <p class="product-desc" itemprop="description">
                         {$product.description_short|strip_tags:'UTF-8'|truncate:100:'...'}
                     </p>
                     {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                     <div itemprop="offers" itemscope itemtype="https://schema.org/Offer" class="content_price">
                         {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                             <span itemprop="price" class="price product-price">
                                 {if $product.from_price}<span class="apartirde survol">{l s='from'}</span>{/if}
                                 {if $product.from_price}
                                     {if !$priceDisplay}
                                         {convertPrice price=$product.from_price} <span class="apartirde survol">TTC</span>
                                     {else}
                                         {convertPrice price=$product.from_price} <span class="apartirde survol">HT</span>
                                     {/if}
                                 {else}
                                     {if !$priceDisplay}
                                         {convertPrice price=$product.price} <span class="apartirde survol">TTC</span>
                                     {else}
                                         {convertPrice price=$product.price_tax_exc} <span class="apartirde survol">HT</span>
                                     {/if}
                                 {/if}
                                                                 
                             </span>
                             <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
                             {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
                                 {hook h="displayProductPriceBlock" product=$product type="old_price"}
                                 <span class="old-price product-price">
                                     {displayWtPrice p=$product.price_without_reduction}
                                 </span>
                                 
                                 {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
                                 {if $product.specific_prices.reduction_type == 'percentage'}
                                     <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
                                 {/if}
                             {/if}
                             {hook h="displayProductPriceBlock" product=$product type="price"}
                             {hook h="displayProductPriceBlock" product=$product type="unit_price"}
                         {/if}
                     </div>
                     {/if}
                     <div class="button-container">
                         {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE}
                             {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}
                                 {capture}add=1&amp;id_product={$product.id_product|intval}{if isset($static_token)}&amp;token={$static_token}{/if}{/capture}
                                 <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity > 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}">
                                     <span>{l s='Add to cart'}</span>
                                 </a>
                             {else}
                                 <span class="button ajax_add_to_cart_button btn btn-default disabled">
                                     <span>{l s='Add to cart'}</span>
                                 </span>
                             {/if}
                         {/if}
                         <a itemprop="url" class="button lnk_view btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}">
                             <span>{if (isset($product.customization_required) && $product.customization_required)}{l s='Customize'}{else}{l s='More'}{/if}</span>
                         </a>
                     </div>
                     {if isset($product.color_list)}
                         <div class="color-list-container">{$product.color_list}</div>
                     {/if}
                     <div class="product-flags">
                         {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                             {if isset($product.online_only) && $product.online_only}
                                 <span class="online_only">{l s='Online only'}</span>
                             {/if}
                         {/if}
                         {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                             {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                                 <span class="discount">{l s='Reduced price!'}</span>
                             {/if}
                     </div>
                     {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                         {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                             <span itemprop="offers" itemscope itemtype="https://schema.org/Offer" class="availability">
                                 {if ($product.allow_oosp || $product.quantity > 0)}
                                     <span class="{if $product.quantity <= 0 && !$product.allow_oosp}out-of-stock{else}available-now{/if}">
                                         <link itemprop="availability" href="https://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
                                     </span>
                                 {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                                     <span class="available-dif">
                                         <link itemprop="availability" href="https://schema.org/LimitedAvailability" />{l s='Product available with different options'}
                                     </span>
                                 {else}
                                     <span class="out-of-stock">
                                         <link itemprop="availability" href="https://schema.org/OutOfStock" />{l s='Out of stock'}
                                     </span>
                                 {/if}
                             </span>
                         {/if}
                     {/if}
                 </div>
                 {if $page_name != 'index'}
                     <div class="functional-buttons clearfix">
                         {hook h='displayProductListFunctionalButtons' product=$product}
                         {if isset($comparator_max_item) && $comparator_max_item}
                             <div class="compare">
                                 <a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}">{l s='Add to Compare'}</a>
                             </div>
                         {/if}
                     </div>
                 {/if}
             </div><!-- .product-container> -->
         </li>
    
        {/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}
    
    


  • Oups !
    {define number of products per line in other page for desktop}
    (**)



  • C'est tout bon !
    Par contre toujours les mêmes problèmes sur crossselling (avec thème modifié, parce que dans le thème natif, le crossselling change en permanence alors qu'il est identique sur le thème modifié) :

    Got error 'PHP message: PHP Notice: Undefined index: product in /var/www/clients/client3/web3/web/modules/crossselling/crossselling.php on line 253PHP message: PHP Notice: Trying to get property 'id' of non-object in /var/www/clients/client3/web3/web/modules/crossselling/crossselling.php on line 253', referer: https://www.google.com/

    public function hookProductFooter($params)
        {
            *****$cache_id = 'crossselling|productfooter|'.(int)$params['product']->id;*****
    
            if (!$this->isCached('crossselling.tpl', $this->getCacheId($cache_id))) {
                $final_products_list = $this->getOrderProducts(array($params['product']->id));
    
                if (count($final_products_list) > 0) {
                    $this->smarty->assign(
                        array(
                            'orderProducts' => $final_products_list,
                            'middlePosition_crossselling' => round(count($final_products_list) / 2, 0),
                            'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE')
                        )
                    );
                }
            }
    
            return $this->display(__FILE__, 'crossselling.tpl', $this->getCacheId($cache_id));
        }
    


  • Ben si il n'y a pas $params['product']->id il y a un gros problème^^
    Défini dans ProductController.php
    4218eb49-c42b-41f0-9f45-1eeb62bf0593-image.png



  • Et il me fait la même chose sur socialsharing (je crois que c'est les deux seules erreurs qu'il reste) :

    Got error 'PHP message: PHP Notice: Undefined index: PS_SC_GOOGLE in /var/www/clients/client3/web3/web/cache/smarty/compile/81/1f/94/811f940f06a3f697d7194319073874f8deee9fbb_0.file.socialsharing.tpl.cache.php on line 45

    <?php if ($_smarty_tpl->tpl_vars['PS_SC_GOOGLE']->value) {?>```


  • Google Plus n'existe plus donc reprend le tpl de base du module^^

    {if $PS_SC_TWITTER || $PS_SC_FACEBOOK || $PS_SC_PINTEREST}
        <p class="socialsharing_product list-inline no-print">
            {if $PS_SC_TWITTER}
                <button data-type="twitter" type="button" class="btn btn-default btn-twitter social-sharing">
                    <i class="icon-twitter"></i> {l s="Tweet" mod='socialsharing'}
                    <!-- <img src="{$link->getMediaLink("`$module_dir`img/twitter.gif")}" alt="Tweet" /> -->
                </button>
            {/if}
            {if $PS_SC_FACEBOOK}
                <button data-type="facebook" type="button" class="btn btn-default btn-facebook social-sharing">
                    <i class="icon-facebook"></i> {l s="Share" mod='socialsharing'}
                    <!-- <img src="{$link->getMediaLink("`$module_dir`img/facebook.gif")}" alt="Facebook Like" /> -->
                </button>
            {/if}
            {if $PS_SC_PINTEREST}
                <button data-type="pinterest" type="button" class="btn btn-default btn-pinterest social-sharing">
                    <i class="icon-pinterest"></i> {l s="Pinterest" mod='socialsharing'}
                    <!-- <img src="{$link->getMediaLink("`$module_dir`img/pinterest.gif")}" alt="Pinterest" /> -->
                </button>
            {/if}
        </p>
    {/if}
    


  • Ok, du coup va falloir faire le tour de tous les modules et leur tpl dans le thème.



  • Est-ce que le problème sur crossselling peut venir de ça (c'est la suite affichée) :

    PHP message: PHP Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 4 in /var/www/clients/client3/web3/web/classes/db/DbPDO.php on line 151PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/clients/client3/web3/web/modules/crossselling/crossselling.php on line 137PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client3/web3/web/modules/crossselling/crossselling.php on line 139PHP message: PHP Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')\n AND pl.id_lang = 2\n AND cl.id_lang = 2\n ...' at line 22 in /var/www/clients/client3/web3/web/classes/db/DbPDO.php on line 151PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client3/web3/web/modules/crossselling/crossselling.php on line 183', referer: https://url/produit

    Edit : j'arrive pas à avoir cette erreur sql à chaque appel...



  • Ben là tu as une erreur dans la requête donc ça renvoie false et donc count() de false, ça ne le fait pas.
    C'est cette requête qui pète:

        $q_orders = 'SELECT o.id_order
        FROM '._DB_PREFIX_.'orders o
        LEFT JOIN '._DB_PREFIX_.'order_detail od ON (od.id_order = o.id_order)
        WHERE o.valid = 1 AND od.product_id IN ('.implode(',', $products_id).')';
        $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($q_orders);
    

    $products_id étant les id_product contenus dans le panier ou le produit de la page en cours. Donc on en revient à ton pb du hookFooter qui ne fait pas son job (à vérifier si tu n'as pas un override de ProductController.php)



  • @eolia Tiens d'ailleurs (suggestion) ne serait-il pas possible d'activer le mod debug uniquement pour les employés (vu que les clients ça risque de leur péter à la figure) et même qu'à certains employés (permissions) ? Ce serait-y pas cool ça ?
    "Comment ça c'est pas cool l'alcool ? Alors pourquoi y'a "cool" dans "alcool" ?



  • Mon override de productcontroller :
    (j'ai nettoyé, c'est pas de moi, mais y'avait tout le productcontroller là-dedans)

    <?php
    class ProductController extends ProductControllerCore
    {
        /*
        * module: alinkoverrideproductcontroller
        * date: 2023-12-02 10:00:22
        * version: 0.1
        */
            
        public function initContent()
        {
            parent::initContent();
            
            $tab = explode("<h3>", strip_tags($this->product->description, '<p><a><img><span><h3><div><li><ul><br><strong><b><iframe>')) ;
            foreach ($tab as $value)
            {
              if(strpos($value,'</h3>')>0)
                $tab_w[] = substr($value, strpos($value,'</h3>') + 5);
            }
            if(!empty($tab_w)) $this->context->smarty->assign('ONGLETS_CONTENT', $tab_w);
            preg_match_all("/<h3>(.*)<\/h3>/",$this->product->description,$out,PREG_PATTERN_ORDER);
            $this->context->smarty->assign('ONGLETS', $out[0]);
            $ONGLETS = $out[0];
        }
    }
    

    C'est pour mettre en forme d'onglets :

    Capture d’écran 2023-12-13 à 20.52.30.png

    Mais j'avoue que ton module pour les onglets me fait de l'oeil...



  • Il est bien hooké dans displayFooterProduct et displayHeader, j'ai réinitialisé le module, placé en première position sur ces 2 hooks, mais toujours pareil.



  • la requête a un argument vide :
    SELECT o.id_order
    FROM rm_orders o
    LEFT JOIN rm_order_detail od ON (od.id_order = o.id_order)
    WHERE o.valid = 1 AND od.product_id IN ()

    Notice: Undefined index: product in /var/www/clients/client1/web4/web/modules/crossselling/crossselling.php on line 253
    Notice: Trying to get property 'id' of non-object in /var/www/clients/client1/web4/web/modules/crossselling/crossselling.php on line 253
    Notice: Undefined index: product in /var/www/clients/client1/web4/web/modules/crossselling/crossselling.php on line 256
    Notice: Trying to get property 'id' of non-object in /var/www/clients/client1/web4/web/modules/crossselling/crossselling.php on line 256

    pourtant d(array($params['product']->id)) me retourne bien :
    Array
    (
    [0] => 6748
    )



  • Si je remplace :
    $cache_id = 'crossselling|productfooter|'.(int)$params['product']->id;
    par
    $cache_id = 'crossselling|productfooter|ID du produit';
    ça fonctionne, alors que d((int)$params['product']->id) me retourne bien l'ID du produit aussi...



  • 3404a216-3769-4d2b-b9e2-da9e91748f35-image.png

    A ajouter.
    Je ne sais pas pourquoi chez toi cette variable n'est pas systématiquement remplie.
    On peut aussi récupérer l'ID produit comme ça:
    $id_product = (int)Tools::getValue('id_product');



  • Le problème c'est qu'elle l'est. d((int)$params['product']->id) avant ou après $cache_id me retourne bien l'ID produit.
    Vu qu'il ne trouve pas l'index product, ne devrais-je pas faire un array_key_exists ?

    Cannot use isset() on the result of an expression (you can use "null !== expression" instead)


Se connecter pour répondre