Hello David,
once again me and i hope i´m not irritating.
Following i want to realize, but on my way it didn´t work.
On the productdescription page in the tables are ...
Shop Name - Product Name - Price - To the Shop
Now when you click on the shop name, all products from this shop are showing.
But i whant, when you click on the shop name, the same product from this shop is showing on the productdescription page.
For example:
Now:
http://www.aio24.com/pv/search.php?q=merchant:Abo+Direkt.de+Zeitschriften:
http://www.aio24.com/pv/products.php?q=100+Idees+Jardin
Thanks a lot, Peter
Hi David,
no. If it´s possible to display:
Price: 0.00 from Merchant
Best Price: 0.00 from Merchant
Thank you very much, Peter
Hi Peter,
This requires quite comprehensive mods to html/prices.php and html/product.php. In the price list, it involves adding changing the URL to the product page (instead of the search results), and adding an index number so that the product page knows what to display.
In the product HTML module, it involves checking whether a merchant index was provided on the URL and use that as the mainProduct instead of the cheapest. The same test is used to display the additional "Price: 0.00 from Merchant" line.
html/prices.php
<div class='prices'>
<table width='100%' cellpadding='4'>
<tr bgcolor='#eeeeee'>
<th width='200' align='left'><?php print translate("Stockist"); ?></th>
<th align='left'><?php print translate("Catalogue Product Name"); ?></th>
<th align='left'><?php print translate("Price"); ?></th>
<th align='left'> </th>
</tr>
<?php $merchant = 0; ?>
<?php foreach($prices["products"] as $product): ?>
<tr bgcolor='#ffffcc'>
<td><a href='products.php?q=<?php print urlencode($product["name"]); ?>&merchant=<?php print $merchant++; ?>'><?php print $product["merchant"]; ?></a></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>
html/product.php
<div class='product'>
<?php
if (isset($_GET["merchant"]))
{
$mainProduct = $product["products"][$_GET["merchant"]];
}
else
{
$mainProduct = $product["products"][0];
}
?>
<table width='100%'>
<tr>
<td width='200'>
<?php if ($mainProduct["image_url"]): ?>
<img width='180' src='<?php print $mainProduct["image_url"]; ?>' alt='<?php print $mainProduct["name"]; ?>' />
<?php endif; ?>
</td>
<td valign='top'>
<h3><a href='<?php print tapestry_buyURL($mainProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$mainProduct["merchant"]); ?>><?php print $mainProduct["name"]; ?></a></h3>
<?php if ($mainProduct["description"]): ?>
<p><?php print $mainProduct["description"]; ?></p>
<?php
if (isset($_GET["merchant"]))
{
print "<p><strong>".translate("Price").":</strong> ".$config_currencyHTML.$mainProduct["price"]." ".translate("from")." ".$mainProduct["merchant"]."</p>";
}
?>
<?php endif; ?>
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top' style='padding:0px;margin:0px;'>
<?php if (count($product["products"]) > 1): ?>
<strong><?php print translate("Best Price"); ?>:</strong>
<?php else: ?>
<strong><?php print translate("Price"); ?>:</strong>
<?php endif; ?>
<?php print $config_currencyHTML.$mainProduct["price"]; ?> <?php print translate("from"); ?>
</td>
<td valign='top' style='padding:0px;margin:0px;'>
<?php foreach($product["products"] as $priceProduct): ?>
<?php if ($priceProduct["price"] == $mainProduct["price"]): ?>
<a href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?>><strong><?php print $priceProduct["merchant"]; ?></strong></a><br />
<?php else: ?>
<?php break; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if (isset($mainProduct["extraHTML"])) print $mainProduct["extraHTML"]; ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
Please note that this is hard coded for not using mod_rewrite as I notice from your example URLs that are not using this.
Hope this helps!
Cheers,
David.
Hello David,
you made a great work, but something goes wrong by the price and merchant.
The Best Price merchant is correct.
When i click on another merchant, it shows me the correct price. That´s ok.
But the Best Price is not the best price, it´s the price from the merchant i clicked. And no merchant name appears.
Look HERE
Thank you very much, Peter
Hi Peter,
I think you just need to change it to use the first product rather than the displayed product in the price list; so where you have (in html/product.php):
if ($priceProduct["price"] == $mainProduct["price"]):
use:
if ($priceProduct["price"] == $product["products"][0]["price"]):
Cheers,
David.
Ah yes,
You'll also need to reference product 0 rather than product n in this line:
<?php print $config_currencyHTML.$product["products"][0]["price"]; ?> <?php print translate("from"); ?>
If this still displays an empty merchant name in best price, can you post your modified code and i'll take a look!
Cheers,
David.
Great work David, you made a perfect job.
Thanks a lot, Peter
Hi Peter,
It will be possible to do this. But what do you want to be displayed where it currently says:
Best Price: 0.00 from Merchant
Would you want it to show the price from the merchant clicked?