Hi dave
what would be the best way of inserting a merchant logo on the product info page only?
would it just be a matter of adding a firld similar to merchant name?
Regards
phil
thanks Dave
Works a treat!
I have tried to put alt text and href text in, but it makes the file come up as an error? what way would you change the line
print "<img src='".$config_baseHREF."logos/".$product["merchant"]."' />";
to accept alt and href script
thanks
phil
If you want to make it a link to the product, with the alt text being the product name the following should work:
<?php
print "<a href='".tapestry_buyURL($product);."'><img border='0' src='".$config_baseHREF."logos/".$product["merchant"]."' alt='".$product["name"]."' /></a>";
?>
Hi dave
keeps coming up
Parse error: parse error, unexpected '.' in /home/buy247/public_html/html/prices.php on line 15
which is the line of that code? did the same for me earlier
thanks
phil
Ooops - was a spurious semi-colon in the previous example - try this:
<?php
print "<a href='".tapestry_buyURL($product)."'><img border='0' src='".$config_baseHREF."logos/".$product["merchant"]."' alt='".$product["name"]."' /></a>";
?>
just added this code thanks
how do add a default image for mechants with no logo ?
Hi Julian,
You can add image code for a default image in the second part of the else case in the above code, for example:
<?php
if (file_exists("logos/".$product["merchant"]))
{
print "<img src='".$config_baseHREF."logos/".$product["merchant"]."' />";
}
else
{
print "<img src='".$config_baseHREF."logos/default.png' />";
}
?>
That would display logos/default.png if there is no merchant logo.
Cheers,
David.
Is resizing the images easy to do in the code ?
or is it better to resize before uploading?
Thanks
Hi Julian,
In this instance it would be much better to resize the image before uploading - there's no need to waste processor resources doing it every time if you have the opportunity to do it once up front...
Cheers,
David.
Hi All
I've added the code at the top of the post along with the bit of code above to change the merchant pic to a link however I get the following error
Parse error: syntax error, unexpected '
Hi Mally,
I just tried the mods above on my test server and didn't get any syntax error. Do you want to email me (or post in the forum if you like) your full html/prices.php and i'll have a look for you...
Cheers,
David.
Hello Dave
Please could you give me an idea of why the "IF" condition test is being failed in this bit of script? It is not finding the image file but, if I make printing the image file not conditional on the IF statement, it finds the image file fine!
Thank you, Alastair
<?php
if (file_exists($config_baseHREF."images/logos/".$product["merchant"]))
{
print "<a href='".tapestry_buyURL($product)."'><img border='0'
src='".$config_baseHREF."images/logos/".$product
["merchant"]."' alt='".$product["name"]."' /></a>";
}
else
{
print "TEST TO SHOW FILE EXISTS FAILS<a href='".tapestry_buyURL($product)."'>".$product["merchant"]."</a>";
}
?>
Hello Alistair,
$config_baseHREF shouldn't be used with file_exists(), as it is only applicable to the web, not the local disk as far as PHP is concerned. This would mean that PHP is looking for the file relative to the root directory of your web server, which is why it is not finding it. The code should probably be just:
if (file_exists("images/logos/".$product["merchant"]))
Hope this helps!
Cheers,
David.
Hi David,
I have a problem and I don't know why,
When I check on my localhost it work ok, but when i check on the web server the image is empty.
The problem is only with a merchant that has a name like this e-site.com. If I put esite.com it works ok. But I have 2 merchant(you know) esite.com and e-site.com.
Please. help
here is my price.php
<div class='preturi'>
<table width='100%' cellpadding='3' cellspacing="1">
<tr bgcolor='#ADADAD'>
<th width='200' align='left'><?php print translate("Merchant"); ?></th>
<!-- blank column for merchant logo -->
<th align='left'><?php print translate("Product description"); ?></th>
<th align='left'><?php print translate("Price"); ?></th>
<th align='left'> </th>
</tr>
<?php foreach($prices["products"] as $product): ?>
<tr bgcolor='#E8EEF8'>
<td><a href='<?php print $product["merchantHREF"]; ?>'>
<?php
print "<a href='".tapestry_buyURL($product)."'><img border='0' src='".$config_baseHREF."logos/".$product["merchant"].".jpg' alt='".$product["merchant"]."' width='177' height='50' /></a>";
?>
</a></td>
<td><?php print $product["name"]; ?></td>
<td><strong><?php print $config_currencyHTML.$product["price"]; ?> EUR</strong></td>
<td align='center'><a href='<?php print tapestry_buyURL($product); ?>' <?php print javascript_statusBar("Go to ".$product["merchant"]); ?> target='_blank'><?php print translate("Buy"); ?></a></td>
</tr>
<?php endforeach; ?>
</table>
</div>
PS. Thanks for the last replay.
Hi,
Because the - is used in place of space in search engine friendly URLs, unless you have made any changes the e-site.com merchant is probably registered as "e site.com"; in which case that is what the logo file must be called. You should be OK to save a file with spaces...
Cheers,
David.
Thanks again,
I have found the problem. In my database the store name was E Site.com and the image name E site.jpg I have change the image name to E Site.jpg and now is ok
Have a nice day,
is there a way to use the default image and have site open in new window?
Hi Dean,
To open in a new window, simply add target='_BLANK' wherever the links are generated, so search for:
<a href='".tapestry_buyURL($product)."'>
...and replace with:
<a target='_BLANK' href='".tapestry_buyURL($product)."'>
Cheers,
David.
Hi David,
In relation to my previous about multiple directories, how would I change the following code in prices.php to look for the logos folder in my root directory (not my baseHREF).
src='".$config_baseHREF."logos/
to
/home/users/adrian/mysite.com/public_html/logos/
Have tried a number of things but keep on getting errors.
Thanks
Adrian
Hi Adrian,
Simply change the HTML part of the script to:
src='/logos/
However, for the file_exists() part; you would need to use the full path, for example:
if (file_exists("/home/users/adrian/mysite.com/public_html/logos/".$product["merchant"]))
Cheers,
David.
Hi David,
I am using your Price Papestry script.. i am having problem in prices. i am trying to place the merchant logo in Stocklist column,i have seen your forum and paste the code that u sent in the forum
http://www.pricetapestry.com/node/314
and paste it in my prices.php but unfortunately merchant pic didn't showup..
Please help me out
Hi Ather,
Could you follow up to your email (I just received it) and send me your modified html/prices.php and also a link to an example product page on your site and i'll take a look for you!
Cheers,
David.
Hello,
nice hacks thanks. And to add the logos into the search result?
Hi,
It's probably best to only show a logo on the search results when there
is only one merchant for a product; otherwise it might be misleading.
To do this, in html/searchresults.php, look for the
following block of code beginning at line 27:
<?php else: ?>
<strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
<span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
<?php endif; ?>
...and REPLACE with:
<?php else: ?>
<strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
<span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
<br />
<?php
if (file_exists("logos/".$product["merchant"]))
{
print "<img src='".$config_baseHREF."logos/".$product["merchant"]."' />";
}
else
{
print " ";
}
?>
<?php endif; ?>
This will display the logo beneath the more information link.
Hope this helps!
Cheers,
David.
Thanks, work fine.
And to add the logo into the home (bottom of each featured product)?
Hi,
Sure - at the bottom of html/featured.php, look for the closing TD tag, which is line 32 in the distribution:
</td>
...and then insert the following code BEFORE that line:
<?php
if (file_exists("logos/".$product["merchant"]))
{
print "<img src='".$config_baseHREF."logos/".$product["merchant"]."' />";
}
?>
Cheers,
David.
Hi David!
How can we add the merchant logo in the /merchant/ index page?
Thank you very much,
Pedro
Hi Pedro,
Assuming that there's no cross-overs, it's easiest implemented
as a generic change in html/atoz.php.
In that file, look for the following code at line 43:
print "<p><a href='".$item["href"]."'>".$item["name"]."</a></p>";
...and REPLACE with:
print "<p><a href='".$item["href"]."'>";
$filename = "logos/".$item["name"];
if (file_exists($filename))
{
print "<img border='0' src='".$config_baseHREF."logos/".$item["name"]."' />";
}
else
{
print $item["name"];
}
print "</a></p>";
...and that will support merchant/brand logos at the same time - all logos uploaded to logos/ just as per the above mod...
Cheers,
David.
--
PriceTapestry.com
Hi Phil,
I wouldn't touch the database to implement using merchant logos. Instead, what I would do is:
1) Create a sub-directory of your Price Tapestry installation called "logos".
2) Upload merchant logos into that directory using a filename that is exactly the same as the registered merchant name, without using any file extension. For example, if you have two merchants registered on your site called "Currys" and "Dixons", you would have:
/path/to/PriceTapestry/logos/Currys
/path/to/PriceTapestry/logos/Dixons
3) To add the merchant logos to the products page, in a new column in the prices table, you could create a new html/prices.php something like this:
<div class='prices'>
<table width='100%' cellpadding='4'>
<tr bgcolor='#eeeeee'>
<th width='200' align='left'><?php print translate("Stockist"); ?></th>
<th> </th> <!-- blank column for merchant logo -->
<th align='left'><?php print translate("Catalogue Product Name"); ?></th>
<th align='left'><?php print translate("Price"); ?></th>
<th align='left'> </th>
</tr>
<?php foreach($prices["products"] as $product): ?>
<tr bgcolor='#ffffcc'>
<td><a href='<?php print $product["merchantHREF"]; ?>'><?php print $product["merchant"]; ?></a></td>
<td>
<?php
if (file_exists("logos/".$product["merchant"]))
{
print "<img src='".$config_baseHREF."logos/".$product["merchant"]."' />";
}
else
{
print " ";
}
?>
</td>
<td><?php print $product["name"]; ?></td>
<td><strong><?php print $config_currencyHTML.$product["price"]; ?></strong></td>
<td align='center'><a href='<?php print tapestry_buyURL($product); ?>' <?php print javascript_statusBar("go to ".$product["merchant"]); ?>><?php print translate("Visit Store"); ?></a></td>
</tr>
<?php endforeach; ?>
</table>
</div>
All i've added there is the new blank header column for where the merchant logos will go, and then the code to look for an image file of the same name as the merchant and generate the IMG HTML if one exists.
Hope this helps!
David.