Jump to content

ERROR Warning: count(): Parameter must be an array or an object that implements


Rodrigo96

Recommended Posts

Hola! Necesito ayuda con el siguiente Warning que aparece solamente en la pagina del producto. Esta ligado al Wishlist del tema que utilizo, Clima Theme. me indica error en la linea 24. Que es lo siguiente:

if (isset($_smarty_tpl->tpl_vars['wishlists']->value) && count($_smarty_tpl->tpl_vars['wishlists']->value) > 1) {?>

Dejo adjunto una captura y el archivo .php donde figura el error.

Muchas gracias!

problem wishlist.png

f641d1c1ec12680c44c06115eb1d6c24a74ed0bd_2.file.blockwishlist-extra.tpl.php

Link to comment
Share on other sites

Gracias Luisejo. Si, intente desactivarlo. Pero se des configura gran parte de la Vista R谩pida en el catalogo de los productos. Incluso el popup cuando agrego un producto al carro tambi茅n deja de funcionar si el modulo Wishlist esta desactivado. Busque por todos lados, pero no encuentro soluci贸n alguna.聽

Link to comment
Share on other sites

hace 2 horas, Luisejo dijo:

Hola Rodrigo, buenas tardes.

Soluci贸n r谩pida, desactivar whitelist... creo que no lo utiliza nadie en Prestashop :)

Soluci贸n correcta, escribe al creador del tema y le informas del fallo.

Saludos.

*wishlist聽馃憤

Link to comment
Share on other sites

  • 1 year later...

Tuve el mismo problema en /module/blockwishlist/blockwishlist_button.tpl
El error se presenta en PHP 7.2 y no en PHP 5.6

C贸digo original:

{if isset($wishlists) && count($wishlists) > 1}   
    	{foreach name=wl from=$wishlists item=wishlist}
    		{if $smarty.foreach.wl.first}
    			<a class="addToWishlist wishlist_button_list" 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 class="popover-content">
    					<table class="table" border="1">
    						<tbody>
    		{/if}
    							<tr title="{$wishlist.name}" value="{$wishlist.id_wishlist}" onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', false, 1, '{$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 class="addToWishlist" 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}
{else}
	<a class="addToWishlist wishlistProd_{$product.id_product|intval}" title="{l s='Add to wishlist' mod='blockwishlist'}" href="#" data-rel="{$product.id_product|intval}" onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', false, 1); return false;">
		{l s='Add to wishlist' mod='blockwishlist'}
	</a>
{/if}

Reemplazado por:

{if isset($wishlists) && is_countable($wishlists)}
    {if count($wishlists) > 1}
    	{foreach name=wl from=$wishlists item=wishlist}
    		{if $smarty.foreach.wl.first}
    			<a class="addToWishlist wishlist_button_list" 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 class="popover-content">
    					<table class="table" border="1">
    						<tbody>
    		{/if}
    							<tr title="{$wishlist.name}" value="{$wishlist.id_wishlist}" onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', false, 1, '{$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 class="addToWishlist" 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}
{else}
	<a class="addToWishlist wishlistProd_{$product.id_product|intval}" title="{l s='Add to wishlist' mod='blockwishlist'}" href="#" data-rel="{$product.id_product|intval}" onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', false, 1); return false;">
		{l s='Add to wishlist' mod='blockwishlist'}
	</a>
{/if}

Edited by gjferrando (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...