Hi,

On Dec 16, 2010, at 22:09, Nadiah <[email protected]> wrote:

> Hi everyone
> 
> I would like to know how I might step through each of the categories
> that a product may appear in, or check if a particular category
> matches for a product, from within the templates.
> 
> For example, I have a Bali dress that is both in the "Children's
> clothes :: Dresses & skirts" category and subcategory, and in the "For
> babies" category. In detail_configurable.html I have lines like:
> 
> {% if product.get_category.name != "Accessories" and
> product.get_category.name != "Coming Soon" %}
>            <img alg="Sizing Guide" align="right" src="/static/images/
> {{ product.get_category.name }}Sizing.jpg" width="200px" align="right"/
>> 
> {% endif %}
> 
> What I would like is for this dress to display the image "Dresses%20&
> %20skirtsSizing.jpg" -- which is what it does if the dress is only in
> the "Children's clothes :: Dresses & skirts" category and subcategory.
> However, when the dress is also in the "For babies" category, the
> lines above tell it to display the image "For%20babiesSizing.jpg".
> 
> Can product.get_category give me a list of the categories? And if so,
> how would I look for a particular category name? I mean something like
> 

Not sure about it but I had a similar need before.
Write a template tag that accepts the product id. In your template tag you can 
do what ever you need and return the html with the right image.

Hope it helps

lzantal

> {% if "Dresses & skirts" is in product.get_category.thelistofthem ...
> %}
> 
> Alternatively, if product.get_category.name only gives me one of the
> categories, how is that choice made, and is there some way to induce
> it to give me the category that I want first?
> 
> 
> Cheers,
> Nadiah
> 
> Fair Trade Kids Clothes ~ http://playingfair.com.au
> 
> -- 
> 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