[Skip to main content](#vessel-content)

#   conditional based variation on views

##

- **[garzarath](/forum/user/1779-garzarath "View garzarath's Profile")**
- [![garzarath's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1779-garzarath "View garzarath's Profile") Topic Author
- [ Offline](/forum/user/1779-garzarath)

Less More

- Posts: 14
- Thank you received: 0
-
- [](http://www.webemus.com)
-

15 years 7 months ago [\#12102](#12102) by [garzarath](/forum/user/1779-garzarath "View garzarath's Profile")  *[conditional based variation on views](/forum/4-how-to/12102-conditional-based-variation-on-views#12102 "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&#95;img&#95;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&#95;img&#95;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&#95;name=(I don´t know how to query this) If ($category&#95;name==’Outlet’){ /&#42; rendering the outlet image &#42;/ } I appreciate any help. Thanks")* was created by *[garzarath](/forum/user/1779-garzarath "View garzarath's Profile")*

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

---

[ www.webemus.com](http://www.webemus.com)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzEyMTAyLWNvbmRpdGlvbmFsLWJhc2VkLXZhcmlhdGlvbi1vbi12aWV3cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 7 months ago [\#12106](#12106) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: conditional based variation on views](/forum/4-how-to/12102-conditional-based-variation-on-views#12106 "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&#95;img&#95;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&#95;img&#95;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&#95;name=(I don´t know how to query this) If ($category&#95;name==’Outlet’){ /&#42; rendering the outlet image &#42;/ } I appreciate any help. Thanks")*

Hi,

You will find all the current category information in the variable $this-&gt;element.

So, for the name it's: $this-&gt;element-&gt;category_name

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzEyMTAyLWNvbmRpdGlvbmFsLWJhc2VkLXZhcmlhdGlvbi1vbi12aWV3cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[garzarath](/forum/user/1779-garzarath "View garzarath's Profile")**
- [![garzarath's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1779-garzarath "View garzarath's Profile") Topic Author
- [ Offline](/forum/user/1779-garzarath)

Less More

- Posts: 14
- Thank you received: 0
-
- [](http://www.webemus.com)
-

15 years 7 months ago [\#12136](#12136) by [garzarath](/forum/user/1779-garzarath "View garzarath's Profile")  Replied by *[garzarath](/forum/user/1779-garzarath "View garzarath's Profile")* on topic *[Re: conditional based variation on views](/forum/4-how-to/12102-conditional-based-variation-on-views#12136 "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&#95;img&#95;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&#95;img&#95;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&#95;name=(I don´t know how to query this) If ($category&#95;name==’Outlet’){ /&#42; rendering the outlet image &#42;/ } I appreciate any help. Thanks")*

Great it worked!!!
thanks

---

[ www.webemus.com](http://www.webemus.com)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzEyMTAyLWNvbmRpdGlvbmFsLWJhc2VkLXZhcmlhdGlvbi1vbi12aWV3cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.050 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
