Page 2 of 2

Re: Brands in product page?

Posted: Tue Oct 26, 2010 4:40 pm
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

Re: Brands in product page?

Posted: Thu Oct 28, 2010 1:30 pm
by dwrs
Thank you Tony ,I will try this hack :) you made my day

Re: Brands in product page?

Posted: Thu Oct 28, 2010 4:58 pm
by Tony Barnes
No probs, seems daft it was never built in there in the first place. Do let us know if it works!!

Re: Brands in product page?

Posted: Tue Nov 16, 2010 10:01 pm
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

Re: Brands in product page?

Posted: Wed Nov 17, 2010 10:11 am
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

Re: Brands in product page?

Posted: Wed Nov 17, 2010 8:10 pm
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..