Can anybody give me the Code I need to place the merchant logos on the merchant site instead of the texts that are on there now?
hi david
I would want to place a logo of each merchant on the merchant.php listing page. if possible with a small secription of each merchant and the title in text next to it.....for search engine optimizsation...
can you get me that code?
cheers
chris
Hi Chris,
I'll work out the mods for that now - in the mean time, you will still need to create the directory containing merchant logos as described in the other thread if you want to be getting on with that...
Cheers,
David.
Hi Again,
Here's the code for a new version of the merchants index incorporating logos and a description of each merchant. This method uses files to hold the descriptions, so there's no database work involved.
As per the mods described in the other thread, this mod needs a directory called logos/ to be created in your Price Tapestry installation folder. Inside this folder, upload the logos using a filename that EXACTLY MATCHES the merchant name, as you have called it in your site. For the description, create a text file with the merchant's name followed by ".txt". For example, for the merchant Advanced MP3 Players, you would upload:
logos/Advanced MP3 Players
logos/Advanced MP3 Players.txt
The logos and descriptions are optional. If the files don't exist, just the merchant name is displayed as before. Here's the code...
merchants.php:
<?php
require("includes/common.php");
$banner["h2"] = "<strong>".translate("Merchant")." A-Z</strong>";
require("html/header.php");
require("html/menu.php");
require("html/searchform.php");
require("html/banner.php");
$atoz["items"] = array();
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER BY merchant";
$currentLetter = "";
if (database_querySelect($sql,$rows))
{
foreach($rows as $feed)
{
$firstLetter = strtoupper(substr($feed["merchant"],0,1));
if ($firstLetter <> $currentLetter)
{
print "<h4>".$firstLetter."</h4>";
$currentLetter = $firstLetter;
}
if ($config_useRewrite)
{
$href = tapestry_hyphenate($feed["merchant"])."/";
}
else
{
$href = "search.php?q=merchant:".urlencode($feed["merchant"]).":";
}
print "<a href='".$href."'>";
if (file_exists("logos/".$feed["merchant"]))
{
print "<img src='".$config_baseHREF."logos/".$feed["merchant"]."' border='0' />";
}
else
{
print $feed["merchant"];
}
print "</a>";
if (file_exists("logos/".$feed["merchant"].".txt"))
{
print "<p>";
require("logos/".$feed["merchant"].".txt");
print "</p>";
}
}
}
require("html/footer.php");
?>
Hope this helps!
Cheers,
David.
Hello David,
I copy and use the script below. But the output looks like
M (example for merchants in alphabet M)
Modern ShirtMike BikeMonde Clock
3 merchants in one line. How to make it look like below.
M (example for merchants in alphabet M)
Modern Shirt
Mike Bike
Monde Clock
Also i follow your node on merchant logo.
logos/Modern Shirt
logos/Modern Shirt.txt
But the output for the logo doesn't appear. However the default.png i created and uploaded to logos works. This is if there is no logos then print default.png. Now back to the merchant logo. From the output we can like Modern Shirt but when we see the URL it is www.url.com/merchant/Modern-Shirt or something like Modern%20Shirt
How to solve this.
thanks
jack
<?php
require("includes/common.php");
$banner["h2"] = "<strong>".translate("Merchant")." A-Z</strong>";
require("html/header.php");
require("html/menu.php");
require("html/searchform.php");
require("html/banner.php");
$atoz["items"] = array();
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER BY merchant";
$currentLetter = "";
if (database_querySelect($sql,$rows))
{
foreach($rows as $feed)
{
$firstLetter = strtoupper(substr($feed["merchant"],0,1));
if ($firstLetter <> $currentLetter)
{
print "<h4>".$firstLetter."</h4>";
$currentLetter = $firstLetter;
}
if ($config_useRewrite)
{
$href = tapestry_hyphenate($feed["merchant"])."/";
}
else
{
$href = "search.php?q=merchant:".urlencode($feed["merchant"]).":";
}
print "<p>";
print "<a href='".$href."'>";
if (file_exists("logos/".$feed["merchant"]))
{
print "<img src='".$config_baseHREF."logos/".$feed["merchant"]."' border='0' />";
}
else
{
print $feed["merchant"];
}
print "</a>";
if (file_exists("logos/".$feed["merchant"].".txt"))
{
print "<div>";
require("logos/".$feed["merchant"].".txt");
print "</div>";
}
print "</p>";
}
}
require("html/footer.php");
?>
Hello David,
I managed to get the logos up. Its working fine. How to do the row adjustment.
thanks
jack
Hello Jack,
The best way to do this would be to enclose each merchant within P tags. I've edited the code in your post above to include these in the correct places...
Cheers,
David.
Hello David,
Thk you very much. Perfect.
cheers
jack
Hi David,
great modification.
Just wondering if it's possible to have the merchant information appear on the following page structure.
http://www.domainname.com/merchant/merchant-store-name/
this page would be the Merchant product listing page. I was thinking of adding the Merchants details above the product listings instead of on the merchant list.
Is this a quick mod?
regards
Rod
Hi Rod,
Sure - you could patch the same code into search.php. To show merchant information above the search results, look for the following code on line 183:
require("html/banner.php");
...and REPLACE this with:
require("html/banner.php");
if ($parts[0]=="merchant")
{
if (file_exists("logos/".$parts[1].".txt"))
{
print "<div>";
require("logos/".$parts[1].".txt");
print "</div>";
}
}
Cheers,
David.
Hi!
See the following thread for code to display merchant logos in place of the name. The code given is for the prices table, which gives you a merchant logo in stead of the name. If you want to use the logos elsewhere and not sure of the code just let me know where you want to use it and i'll work out the code changes for you...!
http://www.pricetapestry.com/node/314
Cheers,
David.