Hi David
How would I go about displaying the product mapping alternates on the prices.php page? for all products IF mapped?
thanks again in advance
Regards
Phil
Thanks David,
I meant to say the html/products.php page, i was getting the following error in the html/prices.php page.
Parse error: syntax error, unexpected T_STRING in /home/buy247/public_html/html/prices.php on line 2
I think (li) tags would be better, its just because I see many visitors coming to my site with search terms like 'what's the difference between product A and Product A_a', (they are both the same) I'm thinking that by displaying these alternatives before the price table with help clear up any confusion to the visitor.
regards
Phil Stone
www.buy24-7.net
Thanks Phil,
Corrected above, alternative version using ul / li below;
<?php
$sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap` WHERE name='".database_safe($product["products"][0]["name"])."' LIMIT 1";
if (database_querySelect($sql,$rows))
{
$alternates = explode("\n",$rows[0]["alternates"]);
print "<ul>";
foreach($alternates as $alternate)
{
print "<li>".$alternate."</li>";
}
print "</ul>";
}
?>
Cheers,
David.
--
PriceTapestry.com
Brilliant David, Thanks, one last minor request, is it possible to remove '=' from the alternatives displayed?
thanks yet again!
Phil Stone
Ah yes!... in place of:
print "<li>".$alternate."</li>";
use:
print "<li>".str_replace("=","",$alternate)."</li>";
Cheers,
David.
--
PriceTapestry.com
Hi David
just wondering if is is possible with the exact feature in product mapping to make it case insensitive, (I know this goes again the laws of exact match)
eg.
=PRODUCT ONE and =Product One would be filtered by one mapping entry? so it becomes exact base on letters in the term and not case?
regards
Phil Stone
www.buy24-7.net
Hi Phil,
Sure - if you could email me your current includes/admin.php I'll work that through for you (it's not quite as straight forward as changing from a non to a case-sensitive version of the string comparison functions but it can be done)...
Cheers,
David.
--
PriceTapestry.com
Hi Phil,
It's an easy query to select the alternates for a product (if exists) but it's really only in scope at the product level rather than the price comparison table level.
That's not to say the code to pull in the alternates can't be included in html/prices.php to add context sensitive keywords to your page, but outside the loop. For example, adding the following code at the end of that file would output each alternative within a p tag (for simplification of the example) but may be more appropriately output as list items (li) tags....
<?php
$sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap` WHERE name='".database_safe($product["products"][0]["name"])."' LIMIT 1";
if (database_querySelect($sql,$rows))
{
$alternates = explode("\n",$rows[0]["alternates"]);
foreach($alternates as $alternate)
{
print "<p>".$alternate."</p>";
}
}
?>
Cheers,
David.
--
PriceTapestry.com