[Solved] Category ID with category Name in product create tab?

Started by studioblue, June 15, 2013, 00:13:13 AM

Previous topic - Next topic

studioblue

VM 2.012b
Joomla 2.5

I was wondering if, in the product information Tab where you select a category, can it also show the category id.  Just not great at php so I am not sure how to get the category-id to show after the category name.
I see in the code where the category_tree is being called but I am not sure if the id is available.?


Thanks,
Bobby


[attachment cleanup by admin]

studioblue

I see the ids in the option values but I need them to show for the client after the name of the category.  See attached.

[attachment cleanup by admin]

studioblue

HERE is the solution, thanks to PRO for the light bulb in the dark.
Thanks for your help, PRO.

in administrator/components/com_virtuemart/helpers/shopfunctions.php

Where your code above says:

} else {

                  $categoryTree .= '<option ' . $selected . ' ' . $disabled . ' value="' . $childId . '">';

                  $categoryTree .= str_repeat (' - ', ($level - 1));



                  $categoryTree .= $category->category_name . '</option>';

               }

REPLACE WITH

} else {

                  $categoryTree .= '<option ' . $selected . ' ' . $disabled . ' value="' . $childId . '">';

                  $categoryTree .= str_repeat (' - ', ($level - 1));



                  $categoryTree .= $category->category_name . "-" . $childId .'</option>';

               }

works like a charm!

Milbo

Yeh it would be intersting to add to your code a perm check, so that only admins see it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

studioblue

Hey Milbo thanks for the reply,
I placed this in this file.

administrator/components/com_virtuemart/helpers/shopfunctions.php

It's not showing in the frontend at this point so I think that the perm check is not necessary.

Thanks,

Bobby