You are here:  » Brand Name on products pages

Support Forum



Brand Name on products pages

Submitted by 0U812 on Fri, 2007-04-13 17:41 in

I am wanting to add the brand name of a product to the product page. Possibly in the body, description and title.

How would I go about doing this?

thanks,
Joe

Submitted by support on Mon, 2007-04-16 08:06

Hi Joe,

The bulk of the product page is displayed by the code in the file html/product.php.

In this script, you will see references to $mainproduct array to display the title, description, price etc. This array also contains the brand, so you can display the brand within this file as follows:

<p><?php print $mainProduct["brand"]; ?></p>

You don't need the P tags, i've just copied the way the description is displayed here. Basically, you can use $mainproduct["brand"] in exactly the same way as you see it being used for any of the other fields in that file.

If you're still not quite sure where to use the code, let me know exactly where you would like the brand to be displayed within your product page and i'll show you where to make the modifications.

Cheers,
David.

Submitted by 0U812 on Fri, 2007-04-20 16:52

Thanks David,

That worked great.

How would I go about making a link to the brand page on the product page?

regards,
Joe

Submitted by support on Sat, 2007-04-21 16:46

Hi Joe,

To create a link to the brand search results from a product page, look for the following line in html/product.php:

<?php if (isset($mainProduct["extraHTML"])) print $mainProduct["extraHTML"]; ?>

Then, insert the following code immediately following;

              <?php
              if ($mainProduct["brand"])
              {
                if ($config_useRewrite)
                {
                  $brandHREF = $config_baseHREF."brand/".tapestry_hyphenate($mainProduct["brand"])."/";
                }
                else
                {
                  $brandHREF = $config_baseHREF."search.php?q=brand:".urlencode($mainProduct["brand"]);
                }
                print "<p><a href='".$brandHREF."'>More ".$mainProduct["brand"]."...</a></p>";
              }
              ?>

Hope this helps!
Cheers,
David.