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

#   $Product does not hold categories, why not

##

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

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 2 months ago [\#210184](#210184) by [jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")  *[$Product does not hold categories, why not](/forum/28-shipping-methods/878490-product-does-not-hold-categories-why-not#210184 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.1 -- PHP version -- : 5.4.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : $product variable does not print the categories.  Hi, I am following the documentation here on the $Product variable, and I need to access the categories array. When I print the $Product variable I can see that the categories are not in the array. Nothing at all, not even an empty categories array. My product all have categories, how or where do I get access to those product categories? I'm working on a shipping plugin. Thanks!  doc link:   www.hikashop.com/support/documentation/157")* was created by *[jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")*

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.1
-- PHP version -- : 5.4.3
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : $product variable does not print the categories.

Hi,
I am following the documentation here on the $Product variable, and I need to access the categories array. When I print the $Product variable I can see that the categories are not in the array. Nothing at all, not even an empty categories array.
My product all have categories, how or where do I get access to those product categories? I'm working on a shipping plugin.
Thanks!

doc link:
[ www.hikashop.com/support/documentation/157](http://www.hikashop.com/support/documentation/157)

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

11 years 2 months ago [\#210191](#210191) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[$Product does not hold categories, why not](/forum/28-shipping-methods/878490-product-does-not-hold-categories-why-not#210191 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.1 -- PHP version -- : 5.4.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : $product variable does not print the categories.  Hi, I am following the documentation here on the $Product variable, and I need to access the categories array. When I print the $Product variable I can see that the categories are not in the array. Nothing at all, not even an empty categories array. My product all have categories, how or where do I get access to those product categories? I'm working on a shipping plugin. Thanks!  doc link:   www.hikashop.com/support/documentation/157")*

Hi,

Would it be possible to have the exact context where you are using that $product variable ?
Depending how you access it and which variable it is exactly, the category might not be available (depending if it's just the product which has been loaded or the "full product").

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

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

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

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 2 months ago [\#210328](#210328) by [jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")  Replied by *[jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")* on topic *[$Product does not hold categories, why not](/forum/28-shipping-methods/878490-product-does-not-hold-categories-why-not#210328 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.1 -- PHP version -- : 5.4.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : $product variable does not print the categories.  Hi, I am following the documentation here on the $Product variable, and I need to access the categories array. When I print the $Product variable I can see that the categories are not in the array. Nothing at all, not even an empty categories array. My product all have categories, how or where do I get access to those product categories? I'm working on a shipping plugin. Thanks!  doc link:   www.hikashop.com/support/documentation/157")*

Hi Jerome,
That sounds like my issue. I am just doing a print_r($product) inside a function I passed the $order variable to. I didn't do a full load.
I'll try this below....from the docs website.....Thank you very much.

If you want to load the whole information of an order, you can use the code :
$orderClass = hikashop_get('class.order');
$order = $orderClass-&gt;loadFullOrder($order_id, true, false);
Similarly to the cart, the products will be available in the attribute as an array of product objects:
$order-&gt;products

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

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

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 2 months ago [\#210333](#210333) by [jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")  Replied by *[jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")* on topic *[$Product does not hold categories, why not](/forum/28-shipping-methods/878490-product-does-not-hold-categories-why-not#210333 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.1 -- PHP version -- : 5.4.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : $product variable does not print the categories.  Hi, I am following the documentation here on the $Product variable, and I need to access the categories array. When I print the $Product variable I can see that the categories are not in the array. Nothing at all, not even an empty categories array. My product all have categories, how or where do I get access to those product categories? I'm working on a shipping plugin. Thanks!  doc link:   www.hikashop.com/support/documentation/157")*

I am trying to access those categories from a shipping plugin that extends the hikashopshipping plugin.
How can I access it from there?
It is needed in the onShippingDisplay function.

Thanks.

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

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

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 2 months ago [\#210344](#210344) by [jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")  Replied by *[jdouglas](/forum/user/38148-jdouglas "View jdouglas's Profile")* on topic *[$Product does not hold categories, why not](/forum/28-shipping-methods/878490-product-does-not-hold-categories-why-not#210344 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.1 -- PHP version -- : 5.4.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : $product variable does not print the categories.  Hi, I am following the documentation here on the $Product variable, and I need to access the categories array. When I print the $Product variable I can see that the categories are not in the array. Nothing at all, not even an empty categories array. My product all have categories, how or where do I get access to those product categories? I'm working on a shipping plugin. Thanks!  doc link:   www.hikashop.com/support/documentation/157")*

I think i got it. This has been an invaluable exercise in understanding Hikashop.

$productClass = hikashop_get('class.product');
$product=$productClass-&gt;getCategories(79);

This returns an array. Pretty cool, now I know how to access the other classes and their functions.

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

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

[](#top)
