0

i'm quite new to django-lfs.

I've been playing with the code trying to build a shop that fix my needs. I've have run into an issue that i'm not able to fix.

I need to access , from the product view (catalog/product/inline) to the category from where i have access this page. I can see it if y display the breadcrumbs. example : Home > category 1 > product 1 but i'm not able to access the "category" object so i can use it's data.

Is there anybody who can help me.

Thanks in advance

jpic
  • 32,891
  • 5
  • 112
  • 113
sandok
  • 53
  • 7
  • I've manage this using creating a template tag that generates my on menu.
    Not excaly what i wanted initially...
    – sandok Oct 19 '11 at 08:11

1 Answers1

0

i've manage this adding a template tag...
Not exacly what i wanted..but works fine.

@register.inclusion_tag('tagging/lateral_menu.html', takes_context=True)
def lateral_menu(context):  
    object = context.get("category") or context.get("product")

if object.__class__.__name__.lower() == "product":
    request = context.get("request")
    category=lfs.catalog.utils.get_current_product_category(request, object)
else:
    category = object

top_category=category
while top_category.parent is not None:
    top_category = category.parent

categories =top_category.get_all_children()
return {"category" :category, "top_category" : top_category, "categories" : categories }

Then in the template i can obtain al the data i need.

sandok
  • 53
  • 7