conditional based variation on views
15 years 6 months ago #12102
by garzarath
conditional based variation on views was created by garzarath
Hi,
I would like to make some small variations on the way a product listing is shown based on the category that is rendered.
All this using the same “listing_img_title.php” view, because for big variations I will just override a different view (and I think a may need them all).
I have created a category call “Outlet” and I want that when the user click the associate menu it will display the same “listing_img_title.php” I use for the other menu entries but with a little image in each product with the word “Outlet”.
What I don´t know is the php code to make get the current category name.
$category_name=(I don´t know how to query this)
If ($category_name==’Outlet’){
/* rendering the outlet image */
}
I appreciate any help.
Thanks
I would like to make some small variations on the way a product listing is shown based on the category that is rendered.
All this using the same “listing_img_title.php” view, because for big variations I will just override a different view (and I think a may need them all).
I have created a category call “Outlet” and I want that when the user click the associate menu it will display the same “listing_img_title.php” I use for the other menu entries but with a little image in each product with the word “Outlet”.
What I don´t know is the php code to make get the current category name.
$category_name=(I don´t know how to query this)
If ($category_name==’Outlet’){
/* rendering the outlet image */
}
I appreciate any help.
Thanks
Please Log in or Create an account to join the conversation.
15 years 6 months ago #12106
by nicolas
Replied by nicolas on topic Re: conditional based variation on views
Hi,
You will find all the current category information in the variable $this->element.
So, for the name it's: $this->element->category_name
You will find all the current category information in the variable $this->element.
So, for the name it's: $this->element->category_name
Please Log in or Create an account to join the conversation.
15 years 6 months ago #12136
by garzarath
Replied by garzarath on topic Re: conditional based variation on views
Great it worked!!!
thanks
thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.161 seconds