Jump to content

[Résolu] Merci Warning: count(): Parameter must be an array or an object that implements Countable in /home


Recommended Posts

Posted (edited)

Bonjour,

Je rencontre une erreur Warning: count(): Parameter must be an array or an object that implements Countable in /home/xxxx/www/cache/smarty/compile/85/02/3d/85023de276e3a15a97cadc8a76e7c62d060150c7_0.file.blockwishlist-extra.tpl.php on line 26

ligne 26 {if $wishlists|count == 1}

J'ai essayer de changer la valeur mais rien ne change.

Merci de votre aide

Edited by Phenomene (see edit history)
Link to comment
Share on other sites

Le fichier /votre_theme/modules/blockwishlist/blockwishlist-extra.tpl doit contenir ceci (vous devez avoir un vieux tpl pas à jour)

{if is_array($wishlists)}
<p class="buttons_bottom_block no-print">
{if !empty($wishlists) && $wishlists|count == 1}
    <a id="wishlist_button_nopop" href="#" onclick="WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value); return false;" rel="nofollow"  title="{l s='Add to my wishlist' mod='blockwishlist'}">
        {l s='Add to wishlist' mod='blockwishlist'}
    </a>
{else}
    {foreach name=wl from=$wishlists item=wishlist}
        {if $smarty.foreach.wl.first}
            <a id="wishlist_button" tabindex="0" data-toggle="popover" data-trigger="focus" title="{l s='Wishlist' mod='blockwishlist'}" data-placement="bottom">{l s='Add to wishlist' mod='blockwishlist'}</a>
                <div hidden id="popover-content">
                    <table class="table" border="1">
                        <tbody>
        {/if}
                            <tr title="{$wishlist.name|escape:'html':'UTF-8'}" value="{$wishlist.id_wishlist}" onclick="WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value, '{$wishlist.id_wishlist}');">
                                <td>
                                    {l s='Add to %s' sprintf=[$wishlist.name] mod='blockwishlist'}
                                </td>
                            </tr>
        {if $smarty.foreach.wl.last}
                    </tbody>
                </table>
            </div>
        {/if}
    {foreachelse}
        <a href="#" id="wishlist_button_nopop" onclick="WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value); return false;" rel="nofollow"  title="{l s='Add to my wishlist' mod='blockwishlist'}">
            {l s='Add to wishlist' mod='blockwishlist'}
        </a>
    {/foreach}
{/if}
</p>
{/if}

 

Link to comment
Share on other sites

il y a 1 minute, Phenomene a dit :

PS 1.6.2.34 phenix suite PHP 7.3 Qu'entendez-vous par module utilisé ?

Alors phenix suite est un fork de PS 1.6, il faut voir avec l'auteur @Eolia ...  Concernant l'erreur il s'agit du module whishlist. Cela étant c'est juste un warning.

Link to comment
Share on other sites

Oui mais là peu importe la version, le mode debug fait apparaitre ce genre d'erreurs et il est bon de corriger les tpls des thèmes qui ne sont pas conformes.

Link to comment
Share on other sites

1 hour ago, Eolia said:

Le fichier /votre_theme/modules/blockwishlist/blockwishlist-extra.tpl doit contenir ceci (vous devez avoir un vieux tpl pas à jour)

{if is_array($wishlists)}
<p class="buttons_bottom_block no-print">
{if !empty($wishlists) && $wishlists|count == 1}
    <a id="wishlist_button_nopop" href="#" onclick="WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value); return false;" rel="nofollow"  title="{l s='Add to my wishlist' mod='blockwishlist'}">
        {l s='Add to wishlist' mod='blockwishlist'}
    </a>
{else}
    {foreach name=wl from=$wishlists item=wishlist}
        {if $smarty.foreach.wl.first}
            <a id="wishlist_button" tabindex="0" data-toggle="popover" data-trigger="focus" title="{l s='Wishlist' mod='blockwishlist'}" data-placement="bottom">{l s='Add to wishlist' mod='blockwishlist'}</a>
                <div hidden id="popover-content">
                    <table class="table" border="1">
                        <tbody>
        {/if}
                            <tr title="{$wishlist.name|escape:'html':'UTF-8'}" value="{$wishlist.id_wishlist}" onclick="WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value, '{$wishlist.id_wishlist}');">
                                <td>
                                    {l s='Add to %s' sprintf=[$wishlist.name] mod='blockwishlist'}
                                </td>
                            </tr>
        {if $smarty.foreach.wl.last}
                    </tbody>
                </table>
            </div>
        {/if}
    {foreachelse}
        <a href="#" id="wishlist_button_nopop" onclick="WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value); return false;" rel="nofollow"  title="{l s='Add to my wishlist' mod='blockwishlist'}">
            {l s='Add to wishlist' mod='blockwishlist'}
        </a>
    {/foreach}
{/if}
</p>
{/if}

 

J'ai copier coller votre code hélas cela ne fonctionne pas

Link to comment
Share on other sites

1 hour ago, Eolia said:

Ben pareil.

Remplacez les fichiers du module blockwishlist de votre thème par ceux contenus dans le thème default-bootstrap (qui eux sont à jour)

Merci ça à fonctionner.

Link to comment
Share on other sites

  • Phenomene changed the title to [Résolu] Merci Warning: count(): Parameter must be an array or an object that implements Countable in /home

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