Author Topic: [Solved] Category ID with category Name in product create tab?  (Read 7295 times)

studioblue

  • Beginner
  • *
  • Posts: 26
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

  • Beginner
  • *
  • Posts: 26
Re: Category ID with category Name in product create tab?
« Reply #1 on: June 15, 2013, 17:23:08 PM »
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

  • Beginner
  • *
  • Posts: 26
Re: Category ID with category Name in product create tab?
« Reply #2 on: June 15, 2013, 19:30:18 PM »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10663
  • VM4.0.232 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 4 on joomla 3
Re: [Solved] Category ID with category Name in product create tab?
« Reply #3 on: June 17, 2013, 08:55:22 AM »
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

  • Beginner
  • *
  • Posts: 26
Re: [Solved] Category ID with category Name in product create tab?
« Reply #4 on: June 18, 2013, 14:00:39 PM »
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