Jump to content
vekia

[module] Categories Block with number of products FREE

Recommended Posts

This module allows to create default block with categories tree with number of products

counter will be displayed automatically

This module is absolutely free and you can download it from this post

just scroll page down

 

block-categories-with-counter-big-cover.

 

 

Share this post


Link to post
Share on other sites

Oh thanks, come across this while figuring out how to show the product counter within each category.

The more I play around, the more I get frustrated with its front-end lacking of so many basic ecommerce design elements.

If not Prestashop included Rewards & Loyalty & Comprehensive Voucher Rule per individual Customer, surely I won't waste time on Prestashop, too primitive, too ugly, not presentable as a professional e-commerce cart. 

Share this post


Link to post
Share on other sites

prestashop has got rewards and loyalty modules, they are a part of default featured in ps engine.

Share this post


Link to post
Share on other sites

Vekia, it works perfect!

 

BUT I have categories and subcategories, and near the categories the count is zero.

 

Can you give me a solution please?

Share this post


Link to post
Share on other sites

your products probably aren't associated to main category, only to subcategories.

anyway, i will try to add feature to count all products, not only products associated with certain categories / subcategories

Share this post


Link to post
Share on other sites

Vekia, I would like to show some changes that could be very useful for your module. In practice, it is desirable, in my opinion, to distinguish the the category from the main sub-sectors with an uppercase font and a color. I have tried individually, but I have realized that it is necessary your intervent on your form. You think it's a doable thing?

Share this post


Link to post
Share on other sites

Vekia, it works perfect!

 

BUT I have categories and subcategories, and near the categories the count is zero.

 

Can you give me a solution please?

I managed to do this by js.

In "blockcategories2.tpl" i added this:

<!-- Block categories 2 module -->
<div id="categories_block_left" class="block">
<script>
function wylicz(id_kategori) {
	var iloscWKategorii = $('li.blockcategoryitem_'+id_kategori+'>a>span.total');
	var Podkategorie = $('li.blockcategoryitem_'+id_kategori+'>ul>li>a>span.total');
	var iloscCalkowita = 0;
	$.each(Podkategorie, function(index, value){
		iloscCalkowita += parseInt(value.innerHTML, "10");
	});
	iloscWKategorii[0].innerHTML=iloscCalkowita;
}
</script>
	<h4 class="title_block">{l s='Kategorie' mod='blockcategories2'}</h4>
	<div class="block_content">
(...)

and in "category-tree-branch2.tpl" i added two things span element and function call:

<li class="blockcategoryitem_{$node.id} {if isset($last) && $last == 'true'}last{/if}">
	<a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if}
		title="{$node.desc|strip_tags|trim|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'} (<span class="total">{$node.productsCount}</span>)</a>
	{if $node.children|@count > 0}
		<ul>
		{foreach from=$node.children item=child name=categoryTreeBranch}
			{if $smarty.foreach.categoryTreeBranch.last}
				{include file="$branche_tpl_path" node=$child last='true'}
			{else}
				{include file="$branche_tpl_path" node=$child last='false'}
			{/if}
		{/foreach}
		</ul>
		<script>wylicz({$node.id})</script>
	{/if}
</li>

NOTE: In my tree if category has children categories it DOESNT have products, only last descendant categories have them so if u add something to category with children categories it will not be counted (I going to have duplicates in this categories so I wanted this to work that way)

Sorry for my english :P hope this helps :)

Share this post


Link to post
Share on other sites

Hi,

 

The module works great, the only question is why disabled shop categories are still getting displayed? Any way to turn them off in your module without erasing them from the shop?

 

Thanks :-)

 

 

This module allows to create default block with categories tree with number of products

counter will be displayed automatically

This module is absolutely free and you can download it from this post

just scroll page down

 

 

 

 

Share this post


Link to post
Share on other sites

Hi, unfortunately your addont doesn't wokr on prestashop 1.6.1.2.

Could you do an update? I think it is for prestashop 1.5 only..

Your addon would be very useful - thank you.

Magda.

Share this post


Link to post
Share on other sites

Hi Vekia.
I would like to use this module, but the count in front of main category is 0, like for sub-categories... (see attached)
It is because all the products are at the lowest level of the tree.

Could you update your module so that it can show the real number of products in the category including the products in sub category and last level ?

 

Regards,
Laurent.

Sans titre.png

Edited by Autourdupc (see edit history)

Share this post


Link to post
Share on other sites

Hello

i updated the topic and added recent .zip file,

during the weekend i will also release a version dedicated for PrestaShop 1.7.x

Share this post


Link to post
Share on other sites
On 4/13/2018 at 10:41 PM, vekia said:

Hello

i updated the topic and added recent .zip file,

during the weekend i will also release a version dedicated for PrestaShop 1.7.x

Hi Vekia,

It's a nice module. Will you make this module compatible for PS 1.7?

Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More