Hi every one,
I would like to know if there are any nice way to retrieve current category while navigating to selected product?
Let say I have two categories:
And I have one product which belongs to both categories: fruit and vegetable;
1. Let say it's a Tomato
So, user navigates to "Vegetables" category and sees here is a Tomato. He likes Tomatoes so he decides to buy it
So he click on Tomato product and navigates to it's description view.
At this point I would like to display a breadcrumb for my visitor so he knows in what category he came:
AllCategories -> Vegetables: Tomato
The problem is, that I can't just take myProduct.getDefaultCategory() as this might be Fruits category or other (if Tomato would belong to more than these two categories).
The only thing I could think off is to insert category ID value into product link, and then resolve it by overriding ProductHandlerMapping service and adding currentCategory model attribute for ProductController. But this does'nt look very nice to mee.
Maybe you know some better way to do it. Thanks in advance