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

#   Transfer product category to order items

##

- **[Joris](/forum/user/29711-joris "View Joris's Profile")**
- [![Joris's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/fish.gif)](/forum/user/29711-joris "View Joris's Profile") Topic Author
- [ Offline](/forum/user/29711-joris)

Less More

- Posts: 16
- Thank you received: 1
-
-
-

11 years 10 months ago [\#184292](#184292) by [Joris](/forum/user/29711-joris "View Joris's Profile")  *[Transfer product category to order items](/forum/26-product-category-display/873825-transfer-product-category-to-order-items#184292 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.35 -- Browser(s) name and version -- : Firefox 34.0.5  For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.  Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order&#95;product' or 'cart&#95;product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div. Maybe I should make an override for , but at least for , I think.  But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).  For the URL I need in  something like:  TIA for any help, Joris")* was created by *[Joris](/forum/user/29711-joris "View Joris's Profile")*

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.35
-- Browser(s) name and version -- : Firefox 34.0.5

For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.

Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order_product' or 'cart_product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div.
Maybe I should make an override for &lt;listing_div.php&gt;, but at least for &lt;add_to_cart_listing.php&gt;, I think.

But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).

For the URL I need in &lt;add_to_cart_listing.php&gt; something like: Code:

&lt;?php echo hikashop_currentURL(); ?&gt;

TIA for any help,
Joris

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzM4MjUtdHJhbnNmZXItcHJvZHVjdC1jYXRlZ29yeS10by1vcmRlci1pdGVtcz90bXBsPW1hcmtkb3du) 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: 86555
- Thank you received: 14304
-
-

11 years 10 months ago [\#184359](#184359) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Transfer product category to order items](/forum/26-product-category-display/873825-transfer-product-category-to-order-items#184359 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.35 -- Browser(s) name and version -- : Firefox 34.0.5  For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.  Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order&#95;product' or 'cart&#95;product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div. Maybe I should make an override for , but at least for , I think.  But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).  For the URL I need in  something like:  TIA for any help, Joris")*

Hi,

There is no need to add anything in the database.
In the hikashop_cart_product and the hikashop_order_product tables, you have the product_id column where is stored the product id of each product of the cart/order.
So just do a query on the table hikashop_product_category to get the list of categories of each product, and then another one in the hikashop_category table to load the data from each category and you'll be able to display the category name next to each product on the cart and order products listing.

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

- **[Joris](/forum/user/29711-joris "View Joris's Profile")**
- [![Joris's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/fish.gif)](/forum/user/29711-joris "View Joris's Profile") Topic Author
- [ Offline](/forum/user/29711-joris)

Less More

- Posts: 16
- Thank you received: 1
-
-
-

11 years 10 months ago [\#184372](#184372) by [Joris](/forum/user/29711-joris "View Joris's Profile")  Replied by *[Joris](/forum/user/29711-joris "View Joris's Profile")* on topic *[Transfer product category to order items](/forum/26-product-category-display/873825-transfer-product-category-to-order-items#184372 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.35 -- Browser(s) name and version -- : Firefox 34.0.5  For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.  Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order&#95;product' or 'cart&#95;product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div. Maybe I should make an override for , but at least for , I think.  But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).  For the URL I need in  something like:  TIA for any help, Joris")*

Thank you, Nicolas. But most of the products are in multiple categories (sometimes over 20). And we just want to show the category from which the items were ordered (during the making of the wishlist or shopping cart).

So someone orders a component (product) for a Mercedes Vito (one of the categories). You can buy this component for many other cars (other categories, but not all). But in the order/wishlist I want to see that the client selected the (category) Mercedes Vito (or other car) before clicking the Add to cart button. So I want to know his order path. In that way, we can assure the client buys only correct products, without mistakes.

I hope you can help me to solve this problem.

Kind regards,
merry christmas,
Joris

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzM4MjUtdHJhbnNmZXItcHJvZHVjdC1jYXRlZ29yeS10by1vcmRlci1pdGVtcz90bXBsPW1hcmtkb3du) 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: 86555
- Thank you received: 14304
-
-

11 years 10 months ago [\#184382](#184382) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Transfer product category to order items](/forum/26-product-category-display/873825-transfer-product-category-to-order-items#184382 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.35 -- Browser(s) name and version -- : Firefox 34.0.5  For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.  Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order&#95;product' or 'cart&#95;product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div. Maybe I should make an override for , but at least for , I think.  But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).  For the URL I need in  something like:  TIA for any help, Joris")*

Hi,

In that case, make sure that the "simplified breadcrumb" option is turned off in the hikashop configuration and create a custom field of the table "item" and the type "text" and the column name "category_pathway".
Then, you can just hide that custom field with some simple CSS where needed.
That custom field will be available in both tables order_product and cart_product with the id of the category from which the user is coming for each product and you'll just have to do one query to load the category name for that id in order to display it in your cart/order products listings.

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

- **[Joris](/forum/user/29711-joris "View Joris's Profile")**
- [![Joris's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/fish.gif)](/forum/user/29711-joris "View Joris's Profile") Topic Author
- [ Offline](/forum/user/29711-joris)

Less More

- Posts: 16
- Thank you received: 1
-
-
-

11 years 10 months ago -  11 years 10 months ago [\#184427](#184427) by [Joris](/forum/user/29711-joris "View Joris's Profile")  Replied by *[Joris](/forum/user/29711-joris "View Joris's Profile")* on topic *[Transfer product category to order items](/forum/26-product-category-display/873825-transfer-product-category-to-order-items#184427 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.35 -- Browser(s) name and version -- : Firefox 34.0.5  For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.  Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order&#95;product' or 'cart&#95;product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div. Maybe I should make an override for , but at least for , I think.  But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).  For the URL I need in  something like:  TIA for any help, Joris")*

Hi Nicolas,

That sounds hopefull. But after following your instructions, there is no catgerory id in the tables added.

Simplified breadcrumb is turned off now.
I created a custom field as you said. The config is presented in the first screenshot. Of course I have tried some other settings too.
For testing purpose I do not hide anything at this moment.
In the database I can see the new table column "category_pathway" in both tables.
But in the List-Div view (shown in the second screenshot), you see the value of this new custom field is nothing more than "category_pathway".
After adding to cart, the table fields "category_pathway" stay NULL.

In the view files (list and add) I do not see any declaration of the category pathway, so I do not understand where to look for better results. Any idea what I am missing or doing wrong?

Thanks again.

- [ ![ScreenshotCustomField.jpg](/forum/attachment/21369) ](/forum/attachment/21369 "...ustomField.jpg") [ ](/forum/attachment/21369?download=1 "...ustomField.jpg")
- [ ![ScreenshotFieldInListDiv.jpg](/forum/attachment/21370) ](/forum/attachment/21370 "...dInListDiv.jpg") [ ](/forum/attachment/21370?download=1 "...dInListDiv.jpg")

Last edit: 11 years 10 months ago by [Joris](/forum/user/29711-joris "View Joris's Profile"). Reason: no large images

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzM4MjUtdHJhbnNmZXItcHJvZHVjdC1jYXRlZ29yeS10by1vcmRlci1pdGVtcz90bXBsPW1hcmtkb3du) 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: 86555
- Thank you received: 14304
-
-

11 years 10 months ago [\#184428](#184428) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Transfer product category to order items](/forum/26-product-category-display/873825-transfer-product-category-to-order-items#184428 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.35 -- Browser(s) name and version -- : Firefox 34.0.5  For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.  Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order&#95;product' or 'cart&#95;product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div. Maybe I should make an override for , but at least for , I think.  But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).  For the URL I need in  something like:  TIA for any help, Joris")*

Hi,

The category_pathway is a parameter which is added to the product page link on the products listing in order to display the full breadcrumb on the product page. It contains the id of the category from which the user is coming before reaching the product page.
And the custom item fields will automatically use the value of a parameter in the URL if it has the same name as their column name, which would be the case here.
You don't see it because you're displaying your custom item field on the products listing page, not on the product page, which I wasn't expecting.
In that case, try to create a custom item field with the column "cid" which is the name of the category id parameter on the products listing pages and you should be able to achieve the same result but on the products listing (and you can see the "simplified breadcrumb" option to whatever you want in that case.

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

- **[Joris](/forum/user/29711-joris "View Joris's Profile")**
- [![Joris's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/fish.gif)](/forum/user/29711-joris "View Joris's Profile") Topic Author
- [ Offline](/forum/user/29711-joris)

Less More

- Posts: 16
- Thank you received: 1
-
-
-

11 years 10 months ago [\#184636](#184636) by [Joris](/forum/user/29711-joris "View Joris's Profile")  Replied by *[Joris](/forum/user/29711-joris "View Joris's Profile")* on topic *[Transfer product category to order items](/forum/26-product-category-display/873825-transfer-product-category-to-order-items#184636 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.35 -- Browser(s) name and version -- : Firefox 34.0.5  For my client it is important to show the category from which the items were ordered (during the making of the wishlist or shopping cart). My client wants to retrace the path of the ordering process. That's why I want to add a field for every order item in which that category is listed.  Therefore I thought to add a custom field 'item' via your custom fields menu, or add a table column myself in table 'order&#95;product' or 'cart&#95;product. I think ordering in this case only may be possible from the category list (not from product details, because the category is lost over there) called from the menu list / div. Maybe I should make an override for , but at least for , I think.  But how to do this? How to transfer the (sub)category which is shown, to the new database field, at the moment of ordering. And what is the best information to transfer? Perhaps the title (page title) and may be the url, but otherwise the category ID (but than i hav to translate this later on to a category name in the order).  For the URL I need in  something like:  TIA for any help, Joris")*

Strange, but this transfers the product id... (not category id).
And I need to make use of the product detail page first.

Is there any other parameter I can use to transfer the category id when submitting the order button in the list/div view (products in category)?
Or otherwise the page url and page title, at the moment of ordering (from the product in categerory view)?

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

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