So I have been doing some freelance work, building an eCommerce site. The people that contracted me out have
forced asked me to use Magento.
So far my experience had been…well…painful to say the least. Mostly because the incredible learning curve that Magento requires to properly code for it. Now by no means would I say I am the greatest developer ever, but I would like to think I am at least average and one able to at least figure my way around most roadblocks (with some help from my bff google). I am not going to go on a long rant about my troubles with Magento, especially since so many others have. I just need to put something out there that I find a little ridiculous.
I have desperately been trying to figure out two things; why the hell when I supposedly get all the store categories nothing printed, and why would category pages would just show a 404 page. I took code straight out of Magento’s own base theme, yet no matter what settings I changed, the categories just wouldn’t print!
<?php foreach ($this->getStoreCategories() as $_category): ?> <li> <a href="<?php echo $this->getCategoryUrl($_category) ?>" class="nav<?php echo $i ?>"> <?php echo $this->htmlEscape($_category->getName()) ?> </a> </li> <?php endforeach ?>
After what felt like two hours of smashing my head into my desk, I came upon a blog that filled me with an odd mix of relief and rage. Apparently once again making assumptions has gotten me into hot water, where I thought “Root Categories” meant the parent categories should be printed out when running the above code, what “Root Categories” actually are to be associated with a specific store if you are running multiple.
The moral of the story is that you need to create sub-categories of a single root, then assign that root to your store in:
Manage Stores -> Store Name -> Root Category
Now if you will excuse me, back to the pain…