Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
oh, cool, thank you!
Try the script here:

Put the code somewhere in your template and visit the page once. If it works then remove the code again.
The code alters your dummy category with an extra field named 'group' and updates all existing categories so that new field can be used to sort the categories by the contents of the field.

Then you have to modify your Extender plugin additionally. A new method 'renderFrontendCategoryList()' should be implemented. Also you have to extend the renderSection() method there as well. Your new Extender methods might look like this:
perfect! it all worked perfectly.
Now im trying to actually display the group name when ever there is a new group.
So far its not working out, but im trying to do it in the loop with an if statement checking if its a new group each iteration, if so then add the group name to $rows, but so far its just outputing the name a lot (which makes sense since i dont know what is inside $rows exactly)
The $rows variable is a string it contains parsed markup, so it's a bit late to work with it, you should start a little sooner to get the values. The variable $category contains all category data, which you can display as follows:
PHP Code:
private function renderFrontendCategoryList() { 
$result['total']) && $result['total'] > && !empty($result['categories'])) {
       foreach($result['categories'] as $category) {

If you want to access a category value, you can do it this way:
PHP Code:

To check if the previous category contains a different 'group' value you could extend your foreach loop as follows:
PHP Code:
$result['categories'] as $key => $category) {
$replace['group'] = '';
$result['categories'][$key-1]) && $result['categories'][$key-1]->group != $category->group) {
$replace['group'] = $category->group// where $replace['group'] is the placeholder name in your template
great! its working perfectly!

The if statement didnt show the first group so i updated the if statement to this:
if(!isset($result['categories'][$key-1]) || (isset($result['categories'][$key-1]) && $result['categories'][$key-1]->group != $category->group))

Its all working perfectly now!
Thanks a lot for your help!
This relates to this question:

Yes, you did it correct.

There are some ways you could do that.
If a simple redirect enough, you can add a statement to your template above, for example:

PHP Code:
if($catalog->processor->config->pageSlug == 'catalog') {

But in this case you will still see the URL like: and maybe that's not what you want...

Another way to accomplish this (like you already did) is to completely customize the output (see here: by using $catalog->renderSection() method:

Just create a page with the name and slug like your category e.g. 'my-category' (the adding of [[catalog_content]] isn't necessary in this case).
Next, replace the 'get_page_content()' function in your template with following statement:
PHP Code:
if(get_page_slug(false) == 'my-category') {
$catalog->renderSection('FrontendItemList', array('routeid' => 3));
} else {

NOTE: Change the 'routeid' => 3 with the id of your real category whose items you want to show. You can find out the id by going to GS Admin > ItemManager > Categories, then click on your category name.

(2019-07-23, 04:29:26)usderofit Wrote: Also, at the moment, when going to an items page (what i will use as an album) only one image is shown, how can i show all of the images in this item?

Maybe this'll help:

Good luck.
Thanks for that!
I got most of it working, i changed the script in a few places, not sure if in the same way as you meant in your comment, but its working Smile

I think the last thing that i havent figured out yet is how to show all of the images that are related to the specific category.

To make things clearer, when im in:
I want to see all of the images that are inside the items in that category, so if i have category a, category b, and they both have 5 images, i want to see all of those images on the main /gallery/ page.

I tried your code but its rendering the section that outputs the category items instead of all of the images related to that category. Plus its rendering it in its own function and i cant add my own styles to it.
You have to hook into $controller method to customize it, as described here: To be more exact, you have to hook in __renderFrontendItemList() instead. To do that, you should expand your extender like this:

PHP Code:
public function 
renderSection($sectionName$params = array())
$sectionName == 'FrontendItemList') {

Then you have to write renderFrontendItemList($args = null) method, that replaces the default __renderFrontendItemList($args = null), see controller.php.
Attention to the potential conflicts between Util of the IM and Util of the SimpleCatalog, if you want to call the SC Util methods you'll need to use namespace in your im_sc_extender.php e.g:

PHP Code:
use ImCatalog\Util as U

Then you call it like this:

PHP Code:

In order to show all the items of all your categories, you have to paste the code from the __renderFrontendItemList($args = null) method into your renderFrontendItemList($args = null) and then change it a bit.
So, your method must look something like this (not tested):

Users browsing this thread: 1 Guest(s)