Sub-categories Tutorial

134 posts by 17 authors in: Forums > CMS Builder
Last Post: August 7, 2012   (RSS)

By rez - June 9, 2011 - edited: June 9, 2011

Right, I have that but the items (articles as shown in most the code here above) are in a different editor. So each category has items. When you add an item you assign it to one of the categories with a drop menu just as described above. Above, clicking a category loads a page and displays the items. I just want them listed all out as I have shown. Again, the items arent in the categories menu. Make sense? [blush]

Re: [rez] Sub-categories Tutorial

By Jason - June 10, 2011

Hi,

Okay, I think I see where you're going with this. If you can attach your .php file, I can give you an example based on your actual code.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By rez - June 10, 2011 - edited: June 10, 2011

Sure, its attached but currently, i am not using a category menu. That's what I am moving towards so I can display deeper sub categories, using advanced settings of breadcrumb and num for the item editor settings? Just can't get to sub categories with the attached code.
Attachments:

example_001.php 2K

Re: [rez] Sub-categories Tutorial

By Jason - June 10, 2011

Hi,

I took a look at your code, and I don't see anything in it that would restrict you outputting items within your categories.

Are you currently only seeing items in the selected category? Could you post the queries you're using along with a url to a page showing your current output? If you don't want to post this directly on the forum, you can email it to suppoer@interactivetools.com

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By rez - June 10, 2011

Yes, categories with items are working just fine. I just simply want to use a category menu editor with sub categories. Currently, I am not.

I will send you a mail.

Re: [Chris] Sub-categories Tutorial

By petejdg - November 9, 2011

Chris,
I have this solution working for a store product area. I have just one level of categories going to the category list and then product viewer page. I have the categories listed on the sidebar and they bold when I am on the category listing page. How can I get the sidebar to work on the product viewer page and also show the category name above my product.
Attachments:

storescreenshot.gif 44K

Re: [petejdg] Sub-categories Tutorial

By petejdg - November 9, 2011

Chris,
here is my file.
Attachments:

product_display.php 9K

Re: [petejdg] Sub-categories Tutorial

By Jason - November 9, 2011

Hi,

You can use the "selectedCategoryNum" option to get a value for $selectedCategory like this:

list($categoriesRecords, $selectedCategory) = getCategories(array(
'tableName' => 'categories',
'selectedCategoryNum' => @$_REQUEST['category'],
));


You can then change your if statement to set an element to bold like this:

<?php if ($categoryRecord['num'] == $selectedCategory['num']): ?><b><?php endif ?>
<a href="product_list.php?category=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['num'] == $selectedCategory['num']): ?></b><?php endif ?>


Finally, you can output the selected category name (instead of the number from the URL0 like this:

<p class="productHeader"><?php echo htmlspecialchars($selectedCategory['name']); ?></p>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By petejdg - November 9, 2011

Thank you so much. Works perfectly.