You are here:  » Brand Logo


Brand Logo

Submitted by shaunmac on Fri, 2012-11-30 20:14 in

Is there a way I can add a logo like I have for merchants to the different brands I have?

Submitted by support on Sat, 2012-12-01 09:36

Hi Shaun,

Since there shouldn't be any overlap the same logos folder can be used - so in the first instance create logos for your brands in exactly the same way as you create / upload merchant logos.

PriceTapestry.org for WordPress doesn't currently support logos on the A-Z pages (this will be added in a forthcoming update) however it is straight forward to add. In pto_atoz.php look for the following code at line 111:

    $each = str_replace("%ITEM%",$row->$module,$each);

...and REPLACE with:

    global $pto_config_externalBaseHREF;
    global $pto_config_externalPath;
    $item_html = $row->$module;
    if ($pto_config_externalPath)
    {
      if (file_exists($pto_config_externalPath."logos/".$row->$module))
      {
        $item_html = "<img border='0' src='".$pto_config_externalBaseHREF."logos/".$row->$module."' />";
      }
    }
    $each = str_replace("%ITEM%",$item_html,$each);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by shaunmac on Mon, 2012-12-03 18:49

Ok I tried this and it doesn't show anything. I even have my merchant images uploaded and they are not showing on the merchant page. The page is {link saved} I would like to be able to show the merchant logo on the price compare part instead of just a text link and maybe on the all merchants page. I was guessing once I got the merchant loges figured out the brand should work. any idea?

Submitted by support on Mon, 2012-12-03 19:06

Hi Shaun,

Merchant logos (and ergo your brand logos mod) rely on the Base HREF and Install Path settings under the External section of the PriceTapestry.org configuration (wp-admin > Settings > PriceTapestry.org)

Check that these values match exactly the values shown on the Support Info page of the /admin/ area of the associated Price Tapestry installation and that should be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by shaunmac on Mon, 2012-12-03 19:39

Yes that was it now it works great thank you.

If I could bother you just one more time please look at this page {link saved} Im not sure how but my sidebar for whatever reason is wrong on all my products pages like this. I was editing my search results/ each, I think and it started doing this. I put everything back but cant for the life of me get it back to the way it needs to be.

Submitted by support on Tue, 2012-12-04 09:27

Hi Shaun,

Looking at the HTML output of the page it looks like the closing </div> of the main search results container *lt;div class='pto_search'> is inside the closing </table> tag, so that looks like a problem in Search Results / After rather than Each. That should be all it is, let me know if you're still not sure of course and if you could copy your Search Results Before / After / Each templates into your reply that will help...

Cheers,
David.
--
PriceTapestry.com

Submitted by shaunmac on Tue, 2012-12-04 15:33

Once again you got it. I had in my search results/before. I changed it to add the table tag before the pto search and now all is well thank you again. And well done on this great script :)

Submitted by si on Sun, 2014-04-20 23:54

Hi David

I've just set this up and it works great on the Brand page, but is it possible to also show these logos elsewhere?

I would like to show them on each product page and possible in the search results.

Is this possible?

Happy Easter

Si

Submitted by support on Mon, 2014-04-21 09:48

Hello Si,

Sure - for Search Results, `brand` first needs to be added to the query as it is not included by default. In pto_search.php, look for the following code at line 375:

  $sql2 = "SELECT id,name,normalised_name,image_url,description,price,rating FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";

...and REPLACE with;

  $sql2 = "SELECT id,name,brand,normalised_name,image_url,description,price,rating FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";

And then the following code at line 372:

  $pto_searchResults[$k]->name = $rows3[$product->id]->name;

...and REPLACE with:

  $pto_searchResults[$k]->name = $rows3[$product->id]->name;
  $pto_searchResults[$k]->brand = $rows3[$product->id]->brand;

Now to add support for a new Search Results / Each placeholder %BRAND_LOGO%, look for the following code at line 512:

    $each = str_replace("%PRODUCT_NAME%",$row->name,$each);

...and REPLACE with:

    $each = str_replace("%PRODUCT_NAME%",$row->name,$each);
    global $pto_config_externalBaseHREF;
    global $pto_config_externalPath;
    $brand_logo_html = "";
    if ($pto_config_externalPath)
    {
      if (file_exists($pto_config_externalPath."logos/".$row->brand))
      {
        $brand_logo_html = "<img border='0' src='".$pto_config_externalBaseHREF."logos/".$row->brand."' />";
      }
    }
    $each = str_replace("%BRAND_LOGO%",$brand_logo_html,$each);

Similarly, to add support for a new Product / Main placeholder %BRAND_LOGO%, in pto_product.php look for the following code at line 388:

    $html_product = str_replace("%PRODUCT_NAME%",htmlentities($product->name,ENT_QUOTES,get_settings("blog_charset")),$html_product);

...and REPLACE with:

    $html_product = str_replace("%PRODUCT_NAME%",htmlentities($product->name,ENT_QUOTES,get_settings("blog_charset")),$html_product);
    global $pto_config_externalBaseHREF;
    global $pto_config_externalPath;
    $brand_logo_html = "";
    if ($pto_config_externalPath)
    {
      if (file_exists($pto_config_externalPath."logos/".$product->brand))
      {
        $brand_logo_html = "<img border='0' src='".$pto_config_externalBaseHREF."logos/".$product->brand."' />";
      }
    }
    $html_product = str_replace("%BRAND_LOGO%",$brand_logo_html,$html_product);

Cheers,
David.
--
PriceTapestry.com

Submitted by si on Thu, 2014-04-24 16:26

Thanks very much David, I'll give it a go tonight, you're a star :)