[MOD] Block access to Brands page if info not viewable

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:

[MOD] Block access to Brands page if info not viewable

Post by Martin »

An annoyance for ISC is that if you set your store configuration so that brand information is not displayed, it's still possible for a visitor to go to the brands.php page and start looking through your product brands information and potentially get information on where you're sourcing your products (particularly annoying if your competitors are viewing).

This mod, resolves that by providing a 404 error if the configuration variable for:
Admin > Store Settings > Display > Show Product's Brand? is set to No

Open: includes/classes/class.brands.php

Find:

Code: Select all

			$brand = MakeURLNormal($brand);

			// Get the link to the "all brands" page
			$GLOBALS['AllBrandsLink'] = BrandLink();
Before, Add:

Code: Select all

			// MOD: Show 404 if show brands is not enabled
			if(!$GLOBALS['ISC_CFG']['ShowProductBrand']) {
				$GLOBALS['ISC_CLASS_404'] = GetClass('ISC_404');
				$GLOBALS['ISC_CLASS_404']->HandlePage();
				exit;
			}
			// MOD END
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [MOD] Block access to Brands page if info not viewable

Post by Martin »

If you are using the mobile template in 6.x then you may also wish to remove the following lines in these files:

Open: templates/__mobile/Panels/IphoneTopMenu.html

Find and delete:

Code: Select all

<li><a href="#anchorBrand">Shop by Brand</a></li>
Open: templates/__mobile/Panels/PagesMenu.html

Find and delete:

Code: Select all

<li><a href="%%GLOBAL_ShopPathNormal%%/brands.php">Shop by Brand</a></li>
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [MOD] Block access to Brands page if info not viewable

Post by Martin »

This information gets EVERYWHERE...

Here's how to remove the information from your sitemap too..

Open: includes/classes/class.sitemap.model.brands.php

Find:

Code: Select all

	public function getTree($limit = null, $offset = null)
	{
		$root = new ISC_SITEMAP_ROOT();
After, Add:

Code: Select all

		if(!$GLOBALS['ISC_CFG']['ShowProductBrand']) {
			return $root;
		}
Post Reply