Hi David,
one of my merchants delivers product names including size and color etc. like that:
Hi-Tec Sierra Sneaker Boots (Dark Choco/Stone) - Men's Boots - 7.5 M
The url looks then like that:
http://www.example.com/product/Hi-Tec-Sierra-Sneaker-Boots-Dark-ChocoStone-Mens-Boots-75-M.html
Is there a possibility to shorten this to e.g.
Hi-Tec Sierra Sneaker Boots
so that the url looks like that:
http://www.example.com/product/Hi-Tec-Sierra-Sneaker-Boots.html
Regards
Roland
Hi David,
I was looking into the datafeed, and found that under the option13 there was a productname given that does not include colour, size ...etc...
I will try to register and import the feed with option13.
Regards
Roland
Hi again,
this step helped me to reduce the number of products from 330000 to 68000. Good move.
Regards
Roland
Hi David
This is well timed!! I would like to truncate the title, but only on search results and featured, not product page. I have another script for something totally different that allows me to do this by putting [50] after the title in the html/template - would something like that be possible?
---------
Jill
Hi Jill,
Sure - for search results, in html/searchresults.php look for each instance of:
<?php print $product["name"]; ?>
(within lines 16 and 18 in the distribution version)
...and REPLACE with:
<?php print tapestry_substr($product["name"],30); ?>
...for a 30 character or next space thereafter limit.
In html/featured.php, make exactly the same modification at line 9...
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi David,
I've used the above mod in a number of places on my site and it works perfectly. However, I'm struggling to truncate the product name in my products.php file. The code in product.php generating the name is :
$banner["h2"] = translate("Price search results for")." <strong>".htmlspecialchars($q,ENT_QUOTES,$config_charset)."</strong> ";
I wondered if you might be able to tell me how I could trim the output using the same criteria as the above mod to specify the number of characters or next space thereafter.
Thanks in advance.
Best regards
Chris
Hi Chris,
Use the tapestry_substr() function, for example to truncate to 50 characters or next space, use:
$banner["h2"] = translate("Price search results for")." <strong>".htmlspecialchars(tapestry_substr($q,50),ENT_QUOTES,$config_charset)."</strong> ";
Cheers,
David.
--
PriceTapestry.com
Hello Roland,
If it's manageable I would suggest using Product Mapping to translate the name - it's one of those things I'm afraid that is easy for a human to see where the name ends and additional info begins but almost impossible from a software point of view.
It would be straight forward to truncate all product names to a maximum of 4 words or something like that but probably less desirable than the longer URLs, but let me know if you want to give something like that a go...
Cheers,
David.
--
PriceTapestry.com