Concept
Total Posts: 25
Joined: 2008-06-03
Worcestershire
Hello,
Where can I find the catergory ID’s for my sites catergories.
Thanks
Posted: September 1 2008
| top
harry12bar
Total Posts: 150
Joined: 2008-01-07
Hi, look in your admin in the category, there you will find the id number in the url.
cheers
Posted: September 1 2008
| top
| # 1
Concept
Total Posts: 25
Joined: 2008-06-03
Worcestershire
OK Thanks,
Is there no where i can get a list off all the catergory ID’s without going into every catagory? I keep thinking I saw something about a Catergory Tree but cant find it now?
Thanks
Posted: September 4 2008
| top
| # 2
ImpelGD
Total Posts: 21
Joined: 2008-04-16
Dundee, UK
If you take a look at your ‘catalog_category_entity_varchar’ table in the database and look at all the entries with an attribute_id of 31 (at least that’s what it’s like in my store) I think you’ll find what you want.
Posted: September 18 2008
| top
| # 3
internezzo ag
Total Posts: 16
Joined: 2008-05-19
Switzerland
harry12bar - 01 September 2008 09:30 AM
Hi, look in your admin in the category, there you will find the id number in the url.
cheers
Since version 1.1.5 or 1.1.6 it’s no longer in the URL. Now I have to look in the DB. Cumbersome…
Posted: September 19 2008
| top
| # 4
internezzo ag
Total Posts: 16
Joined: 2008-05-19
Switzerland
Hi all
I found a simpler way: Install and activate the “Tamper Data” Firefox extension.
Now click on a category. In Tamper Data you will see the URL containing the category ID (as seen in the browser address bar in earlier versions of Magento).
Hope this helps someone…
Regards
Posted: October 6 2008
| top
| # 5
ab.wdev
Total Posts: 28
Joined: 2008-04-19
Concept - 04 September 2008 03:08 AM
OK Thanks,
Is there no where i can get a list off all the catergory ID’s without going into every catagory? I keep thinking I saw something about a Catergory Tree but cant find it now?
Thanks
Here is a code that displays all the categories ids:
<?php require_once 'app/Mage.php' ; Mage :: app ( 'default' ); $categories = Mage :: getModel ( 'catalog/category' )-> getCollection (); $categ_ids = $categories -> getAllIds (); var_dump ( $categ_ids ); ?>
Posted: October 8 2008
| top
| # 6
JKwan13
Total Posts: 62
Joined: 2008-06-12
Also take a look at this thread: http://www.magentocommerce.com/boards/viewthread/17998/
It seems you can now just go to Admin -> Catalog -> URL Rewrite. If you have many categories (like I do), you can just type in name of your category in the “Request Path” to filter the list and you can see it in the “Target Path”.
Signature
Amptic.com - http://www.amptic.com - Hunting/Camping Gear & Accessories
Posted: October 8 2008
| top
| # 7
redhotrobbie
Total Posts: 4
Joined: 2008-10-27
the URL Rewrite didnt display the root category id. (why not?) So had to use the ‘dirty fix’. Why does noone display the address of the code they publish??? app/design/adminhtml/default/default/template/catalog/category/edit/form.phtml i think
Signature
Kosher Wine is what I Drink
Posted: November 4 2008
| top
| # 8
Unirgy
Total Posts: 145
Joined: 2007-09-07
If you’re looking to import categories using dataflow, try this solution:
http://www.magentocommerce.com/wiki/how_to_import_category_structure_with_products_using_dataflow
Posted: 1 month ago
| top
| # 9
davidgrun
Total Posts: 70
Joined: 2008-07-10
Here is a code that displays all the categories ids:
<?php require_once 'app/Mage.php' ; Mage :: app ( 'default' ); $categories = Mage :: getModel ( 'catalog/category' )-> getCollection (); $categ_ids = $categories -> getAllIds (); var_dump ( $categ_ids ); ?>
This is a great piece of code!
How do I get the name of each category to be displayed next to each category ID and insert a line break <br /> after each one.
Example:
Cat. Name1: ID#1
Cat. Name2: ID#2
Cat. Name3: ID#3
....
THANKS!!
Signature
I love Magento! (...just, please, make it run a bit faster...)
ab.wdev
Total Posts: 28
Joined: 2008-04-19
davidgrun - 03 December 2008 05:49 AM
Here is a code that displays all the categories ids:
<?php require_once 'app/Mage.php' ; Mage :: app ( 'default' ); $categories = Mage :: getModel ( 'catalog/category' )-> getCollection (); $categ_ids = $categories -> getAllIds (); var_dump ( $categ_ids ); ?>
This is a great piece of code!
How do I get the name of each category to be displayed next to each category ID and insert a line break <br /> after each one.
Example:
Cat. Name1: ID#1
Cat. Name2: ID#2
Cat. Name3: ID#3
....
THANKS!!
Here is the code:
$categories_collection = Mage :: getModel ( 'catalog/category' )-> getCollection (); $categories_collection -> addAttributeToSelect ( 'name' )-> setStoreId ( Mage :: app ()-> getStore ()-> getId ())-> load (); if( $categories_collection -> getSize ()) { foreach( $categories_collection as $category ) { echo $category -> getName (). ' ' . $category -> getId (). '<br />' ; } }
davidgrun
Total Posts: 70
Joined: 2008-07-10
@ab.wdev
Thanks for your help!
I’m getting this error with your new code.
Fatal error: Class ‘Mage’ not found in /home/kehothhh/public_html/category_id_list.php on line 9
This is my code.
<?php /* DISPLAY CATEGORY IDs with names */ $categories_collection = Mage :: getModel ( 'catalog/category' )-> getCollection (); $categories_collection -> addAttributeToSelect ( 'name' )-> setStoreId ( Mage :: app ()-> getStore ()-> getId ())-> load (); if( $categories_collection -> getSize ()) { foreach( $categories_collection as $category ) { echo $category -> getName (). ' ' . $category -> getId (). '<br />' ; } } ?>
Signature
I love Magento! (...just, please, make it run a bit faster...)
ab.wdev
Total Posts: 28
Joined: 2008-04-19
davidgrun - 21 December 2008 07:02 PM
@ab.wdev
Thanks for your help!
I’m getting this error with your new code.
Fatal error: Class ‘Mage’ not found in /home/kehothhh/public_html/category_id_list.php on line 9
This is my code.
<?php /* DISPLAY CATEGORY IDs with names */ $categories_collection = Mage :: getModel ( 'catalog/category' )-> getCollection (); $categories_collection -> addAttributeToSelect ( 'name' )-> setStoreId ( Mage :: app ()-> getStore ()-> getId ())-> load (); if( $categories_collection -> getSize ()) { foreach( $categories_collection as $category ) { echo $category -> getName (). ' ' . $category -> getId (). '<br />' ; } } ?>
Try this:
<?php require_once 'app/Mage.php' ; Mage :: app ( '' ); $categories_collection = Mage :: getModel ( 'catalog/category' )-> getCollection (); $categories_collection -> addAttributeToSelect ( 'name' )-> setStoreId ( Mage :: app ()-> getStore ()-> getId ())-> load (); if( $categories_collection -> getSize ()) { foreach( $categories_collection as $category ) { echo $category -> getName (). ' ' . $category -> getId (). '<br />' ; } } ?>
davidgrun
Total Posts: 70
Joined: 2008-07-10
THANKS that works!
Here is my final code with a tad of styling just to make it easier to the eye
I also attached the file for whoever wants to download it. (just place it in your root folder).
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < html xmlns = "http://www.w3.org/1999/xhtml" xml : lang = "en" lang = "en" > < head > < meta http - equiv = "Content-type" content = "text/html; charset=utf-8" /> < title >List Categories </ title > < style type = "text/css" > <!-- . row{border : 1px solid #999; padding:2px;} div . row{margin - bottom : 2px ; margin - top : 0px ; } p{font - family : verdana ; font - size : 12px ; } --> </ style > </ head > < html >< body > <!-- List Categories ' Names and IDs --> <?php require_once ' app / Mage . php '; Mage::app(''); $categories_collection = Mage::getModel(' catalog / category ')->getCollection(); $categories_collection->addAttributeToSelect(' name ')->setStoreId(Mage::app()->getStore()->getId())->load(); if($categories_collection->getSize()){ foreach($categories_collection as $category){ ?><div class="row"><p><b><?php echo $category->getName().' :</ b > '.$category->getId().' </ p ></ div >; } } ?> </ html ></ body >
Enjoy!
File Attachments
Signature
I love Magento! (...just, please, make it run a bit faster...)