Thank you for your feedback.
I did run into that issue you are mentioning, I was getting errors from 
google-bots.
So I did exactly as you said and added a check to make sure the referral is 
from the store domain.
Great minds.. :)

lzantal



On Nov 13, 2011, at 5:00 PM, hynekcer wrote:

> Izantal,
> it looks good.
> 
>> ... Note, I don't have subcategories so I did not tested it with one...
> 
> You expect, that subcategory slugs are unique, which is true.
> 
> I see the only possible problem if the referer is coming from other
> site e.g. from advertising site and if the store uses category slugs
> with too little redundancy e.g. numeric slug, which can exist with
> completely different meaning on that advertizing site. So I would add
> eventually a condition that the referer site is equal store site,
> besides existing catname condition.
> 
> -- Hynek
> 
> On 8 lis, 01:03, lzantal <[email protected]> wrote:
>> Hi all,
>> 
>> Just wrote this to display the category where the user clicked on the
>> product in the breadcrumbs when a product is in multiple categories.
>> Thought I share it someone may find it useful.
>> 
>> def product_cat_url(context):
>>     request = context['request']
>>     product = context['product']
>>     reflist = request.META['HTTP_REFERER'].split('/')
>>     catname = product.category.filter(slug=reflist[-2])
>>     if catname:
>>         return '<a href="%s">%s</a>' % (catname[0].get_absolute_url(),
>> catname[0].translated_name())
>>     else:
>>         return '<a href="%s">%s</a>' % (product.category.all()
>> [0].get_absolute_url(), product.category.all()[0].translated_name())
>> register.simple_tag(product_cat_url, takes_context=True)
>> 
>> Use it in place of the default for loop: <li>{% product_cat_url %}</
>> li>
>> Note, I don't have subcategories so I did not tested it with one.
>> 
>> lzantal
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Satchmo users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/satchmo-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/satchmo-users?hl=en.

Reply via email to