Force single layer category view for mobiles

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
Post Reply
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Force single layer category view for mobiles

Post by Martin » Tue Jun 11, 2013 12:16 pm

Having just created a huge tree of categories and sub-categories as part of an accordion type overhaul of my site I realised that mobile phone users get swamped in their view so I've come up with a small mod' that fixes their view to just one level of categories. It does required them to click to reach the next levels but reduces the scrolling to a minimum.

Open: /includes/display/SideCategoryList.php

Find:

Code: Select all

$GLOBALS['SubCategoryList'] = $this->_getSubCategory($categories, $rootCat['categoryid']);
Replace with:

Code: Select all

//$GLOBALS['SubCategoryList'] = $this->_getSubCategory($categories, $rootCat['categoryid']);
				
				if($GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
					$GLOBALS['SubCategoryList'] = '';
				}
				else {
					$GLOBALS['SubCategoryList'] = $this->_getSubCategory($categories, $rootCat['categoryid']);
				}

Post Reply