Brands in product page?

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Brands in product page?

Post by Tony Barnes »

Sorry mate, forgot that I posted in this one!! Think this should do the trick

Open up includes/classes/class.product

Find:

Code: Select all

		public $_prodbrandname = "";
After add in:

Code: Select all

		public $_prodbrandimagefile = "";
Find:

Code: Select all

				(SELECT brandname FROM [|PREFIX|]brands WHERE brandid=p.prodbrandid) AS prodbrandname,
After add in:

Code: Select all

				(SELECT brandimagefile FROM [|PREFIX|]brands WHERE brandid=p.prodbrandid) AS prodbrandimagefile,
Find:

Code: Select all

			$this->_prodbrandname = $row['prodbrandname'];
After add in:

Code: Select all

			$this->_prodbrandimagefile = $row['prodbrandimagefile'];
Find:

Code: Select all

		public function GetBrandName()
		{
			return $this->_prodbrandname;
		}
After add in:

Code: Select all

		public function GetBrandImageFile()
		{
			return $this->_prodbrandimagefile;
		}
Then you should just be able to use this in your ProductDetails.php:

Code: Select all

   /**
    * Setup selected brand for this product.
    */
   public function SetBrandDetails()
   {
      if(!$this->productClass->GetBrandName() || !GetConfig('ShowProductBrand')) {
         $GLOBALS['HideBrandLink'] = 'none';
         return false;
      }

      $GLOBALS['BrandName'] = isc_html_escape($this->productClass->GetBrandName());
      $GLOBALS['BrandLink'] = BrandLink($this->productClass->GetBrandName());
      $GLOBALS['BrandImageFile'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $this->productClass->GetBrandImageFile();
   }
And call it with %%GLOBAL_BrandImageFile%%

I've not tested it, but fingers crossed it should work for you :D
dwrs
Posts: 16
Joined: Wed Feb 03, 2010 5:30 pm

Re: Brands in product page?

Post by dwrs »

Thank you Tony ,I will try this hack :) you made my day
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Brands in product page?

Post by Tony Barnes »

No probs, seems daft it was never built in there in the first place. Do let us know if it works!!
karl800
Posts: 35
Joined: Sat Oct 03, 2009 8:43 pm
Location: Staffordshire, UK

Re: Brands in product page?

Post by karl800 »

Hi Tony this works a treat apart from just a minor tweak..

On design view to edit the panel i had edit this line

Replace this

Code: Select all

<a href="%%GLOBAL_BrandLink%%">%%GLOBAL_BrandName%%</a>

with

Code: Select all

<a  href="../brands/%%GLOBAL_BrandName%%"><img src="%%GLOBAL_BrandImageFile%%" alt="%%GLOBAL_BrandName%%" width="75" height="75" /></a>
Cheers
Karl
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Brands in product page?

Post by Tony Barnes »

Yep, you would need to alter how the brand is being displayed, I didn't look at that bit, was setting up the global for the image - the way you've posted replaces the brand link, right?

Glad it works :D
karl800
Posts: 35
Joined: Sat Oct 03, 2009 8:43 pm
Location: Staffordshire, UK

Re: Brands in product page?

Post by karl800 »

Yes it does, Also i took out the size nw as the size the shop creates them are adequete, thanks again for the details..
Post Reply