Page 1 of 1

BLC-version3-add new category

Posted: Tue Sep 10, 2013 4:48 am
by hourieh
hi there
I'm new in broadleaf ecommerce.in admin module I add 8 category but in site just show 6 of them what happen for rrest of them and how can I show rest of them in my site?
thank you so much

Re: BLC-version3-add new category

Posted: Wed Nov 13, 2013 8:43 am
by Theo Schumacher
Hi have a look into th file

/site/src/main/webapp/WEB-INF/templates/layout/partials/nav.html

you will find the limitation defined:

<blc:categories resultVar="navCategories" parentCategory="Primary Nav" maxResults="6" />


regards

Re: BLC-version3-add new category

Posted: Fri Aug 01, 2014 11:19 pm
by kushagrajain
Hi,

Can you please assist actually what exactly this code means :

<blc:categories resultVar="navCategories" parentCategory="Primary Nav" maxResults="6" />

How is it internally populating the navCategories variable by just speifying the parentCategory="Primary Nav"?

Many thanks!

Re: BLC-version3-add new category

Posted: Sat Aug 02, 2014 3:17 am
by prabhat.kataria
Kushagra, the code that you have posted is a type of thymeleaf processor. These processors are java objects that have logic to be applied on DOM nodes. They are almost same as jsp custom tags but are alot more powerful.

To see what blc:categories processor does go to https://github.com/BroadleafCommerce/BroadleafCommerce/blob/4674db5d16118e404452a166eff52637a7c748e0/core/broadleaf-framework-web/src/main/java/org/broadleafcommerce/core/web/processor/CategoriesProcessor.java

You can find more information on thymeleaf processor on http://www.thymeleaf.org/doc/extendingthymeleaf.html#processors.

Re: BLC-version3-add new category

Posted: Sun Aug 03, 2014 4:51 am
by kushagrajain
Thanks a lot Prabhat. It helped me a lot! One small thing, in the same code:

<blc:categories resultVar="navCategories" parentCategory="Primary Nav" maxResults="6" />

I am trying to make this code generic and want set the parentCateogory from category currently selected,then, it must be like :

<blc:categories resultVar="navCategories" parentCategory="${category.name}"/>

But ${category.name} is not rendered as actual category name and parentCategory is set to this ${category.name} text only.

Am I making any syntax error? Because the value of ${category.name} is coming correctly on HTML when I write [[${category.name}]].


Thanks for your enormous support!

Regards

Re: BLC-version3-add new category

Posted: Mon Aug 11, 2014 12:07 pm
by kushagrajain
Looking for any help regarding my query in last post. Would be grateful for any support for the same!

Re: BLC-version3-add new category

Posted: Wed Aug 13, 2014 2:11 am
by prabhat.kataria
Hi Kushagra, I tried to dig into why ${category.name} is not being evaluated as an expression. I suspect it is something to do with the type of processor but does not have concrete proof about it. Someone from BLC team can surely throw some light on this.

Re: BLC-version3-add new category

Posted: Thu Aug 14, 2014 11:09 pm
by phillipuniverse
Sorry for the late reply. The 'category' variable in this case is set by the CategoryHandlerMapping via:

Code: Select all

public static final String CURRENT_CATEGORY_ATTRIBUTE_NAME "category";

context.getRequest().setAttribute(CURRENT_CATEGORY_ATTRIBUTE_NAMEcategory);
 


Thymeleaf makes request attributes available on the model to be referenced as normal variables.