Show Products Wishlist Count In Front End Product Details Page

People add products to wish list every day, I think it would be rather reasonable to show how many customers have particular item added in wish list ?

Try the following code

{$wl_amount = 0}
{if $smarty.session.wishlist.products}
    {foreach from=$smarty.session.cart.products item=p}
        {if $p.product_id == $product.product_id}
            {$wl_amount = $wl_amount + $p.amount}
        {/if}
    {/foreach}
{/if}
{if $wl_amount > 0}
    Wishlist contains {$wl_amount} items
{/if}

(!) Not tested

Does not work for me, thanks for try

Does not work for me, thanks for try

Please replace

$smarty.session.cart.products

with

$smarty.session.wishlist.products

When I add product to wishlist "Wishlist contains 1 items" but that's not the result I wanted.

Here is demonstration

http://www.ebay.com/itm/CURREN-New-Fashion-Mens-Date-Stainless-Steel-Military-Sport-Quartz-Wrist-Watch-/201070713357?hash=item2ed0bf9a0d:g:ickAAMXQ74JTRXny

"5814 watching" that means 5814 people have this product added to "Add to watch list" and that is visible for all.

When I add product to wishlist "Wishlist contains 1 items" but that's not the result I wanted.

Here is demonstration

http://www.ebay.com/itm/CURREN-New-Fashion-Mens-Date-Stainless-Steel-Military-Sport-Quartz-Wrist-Watch-/201070713357?hash=item2ed0bf9a0d:g:ickAAMXQ74JTRXny

"5814 watching" that means 5814 people have this product added to "Add to watch list" and that is visible for all.

Looks I misunderstood your initial request.

{$wl_amount = "SELECT COUNT(DISTINCT(user_id)) FROM ?:user_session_products WHERE type = ?s AND product_id = ?i"|db_get_field:'W':$product.product_id}
{if $wl_amount > 0}
    {$wl_amount} watching
{/if}

(!) Not tested

Unfortunately this does not work.

Just tested. It works, but old information is shown due to page cache. It is required to make additional changes in the app/schemas/block_manager/blocks.php file (or extend it with the module)

Add

'user_session_products'

to the list of "update_handlers" array for the "products.view" element

Wow, perfect! Thank you very much.

You are welcome!