Hi
I am trying to add some cusom descriptions but include a link in the description, when I add the required HTML code for the link and then save it and do an import, it seems to change, here is what is showing from the source code
"The 30ft Ancol Black Nylon Tracking Line For Dogs is a great training aid for dogs who are learning their recall or similar exercises such as the retrieve or fetch, some dogs need freedom but owners need to maintain some control in order to stop dogs running off, up to other dogs without permission whilst they are learning. Using a long line can assist with this type of training. The Ancol Black Nylon line for dogs is strong and durable!"
The HTML should be
{link saved}
Not is seems to put in \ after href and after .html
Any ideas?
Stuart
Thanks David that worked a treat!
A different question, we limit the number of characters on descriptions from merchant feeds, we do this in ‘html/product.php’ on line 15 and uses the following code:
<?php
print tapestry_substr($mainProduct["description"],450," ...");
?>
We still want to do the above, but override the limit when a "Cusom Description" is used. How would we go about that please?
Thanks
Stuart
Hi Stuart,
The no-dbmod solution would be something like this:
<?php
$sql = "SELECT id FROM `".$config_databaseTablePrefix."productsmap` WHERE name='".database_safe($mainProduct["name"])."' AND description <> ''";
if (database_querySelect($sql,$result))
{
print $mainProduct["description"];
}
else
{
print tapestry_substr($mainProduct["description"],450," ...");
}
?>
Cheers,
David.
--
PriceTapestry.com
HI David another question on custom descriptions please
If we look at a category page i.e. {link saved}
There is a description for each product, I believe in most cases it is different from the description on a product page: {link saved}. Would my assumtion be correct?
Anyway, when I add a custom description it shows in both places, see: Kong Classic Red - Medium - {link saved}
What we want to do is keep the custom description as it is working now
But when it's not a custom description we want to limit the number of characters (which we already do) but need a different limit on category and product pages
Example: {link saved} limit the description to 20 characters with read more...
Example2: {link saved} - limt to 400 characters, unless it is a custom description!
Thanks again
Stuart
Hi Stuart,
The description field displayed in search results is essentially from a random merchant for that product since search results are generated by a "summary" query so the actual product record from which the fields are returned is undetermined; however when there is a custom description it will be the same since the same custom description was written to all product records for that product at import time.
As with the product page, to identify whether it's a custom description in place would require a database query within html/searchresults.php in order to identify which results have custom descriptions, and then truncate those which don't and write in the "Read More..." link. To do this, have a go with the following code, inserted at the top of html/searchresults.php:
<?php
$ins = array();
foreach($searchresults["products"] as $product)
{
$ins[] = "'".database_safe($product["name"])."'";
}
$in = implode(",",$ins);
$sql = "SELECT name FROM `".$config_databaseTablePrefix."productsmap` WHERE name IN (".$in.")";
if (database_querySelect($sql,$rows))
{
$hasCustomDesc = array();
foreach($rows as $row)
{
$hasCustomDesc[] = $row["name"];
}
foreach($searchresults["products"] as $k => $product)
{
if (!in_array($product["name"],$hasCustomDesc))
{
$searchresults["products"][$k]["description"] = tapestry_substr($product["description"],20,"[<a href='".tapestry_productHREF($product)."'>Read More</a>]");
}
}
}
?>
To change the product page non-custom description length to 400, change the constant in the following line from the previous mod (to html/product.php) as required, e.g.:
print tapestry_substr($mainProduct["description"],400," ...");
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi Stuart,
Ah - that's the "magic quotes" issue that can occur on some PHP installation. To fix this, edit includes/widget.php and look for the following code at line 119:
if (get_magic_quotes_runtime())
{
return stripslashes($text);
}
else
{
return $text;
}
...and REPLACE with just:
return stripslashes($text);
You will then need to go back to Product Mapping, correct the custom description, and then re-import...
Hope this helps!
Cheers,
David.
--
PriceTapestry.com