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

#   Check programatically if product is in a category

##

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

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 1 month ago [\#124072](#124072) by [piggyslasher](/forum/user/24504-piggyslasher "View piggyslasher's Profile")  *[Check programatically if product is in a category](/forum/26-product-category-display/862120-check-programatically-if-product-is-in-a-category#124072 "I am making changes on the product page and already have the $product object. It doesnt have any value inside that denotes category. How do I find out if a certain product is in a certain category, and get the category id?")* was created by *[piggyslasher](/forum/user/24504-piggyslasher "View piggyslasher's Profile")*

I am making changes on the product page and already have the $product object. It doesnt have any value inside that denotes category. How do I find out if a certain product is in a certain category, and get the category id?

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

13 years 1 month ago -  13 years 1 month ago [\#124085](#124085) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Check programatically if product is in a category](/forum/26-product-category-display/862120-check-programatically-if-product-is-in-a-category#124085 "I am making changes on the product page and already have the $product object. It doesnt have any value inside that denotes category. How do I find out if a certain product is in a certain category, and get the category id?")*

Hi,

You'll be able to get it by editing your "show default" file of the product view of your front-end template through "*Hikashop-&gt;Display-&gt;Views*", and by using this variable : Code:

$this-&gt;element-&gt;category_id

Last edit: 13 years 1 month ago by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NjIxMjAtY2hlY2stcHJvZ3JhbWF0aWNhbGx5LWlmLXByb2R1Y3QtaXMtaW4tYS1jYXRlZ29yeT90bXBsPW1hcmtkb3du) 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.114 seconds

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

[](#top)
