I’m needing to replace white spacing with a plus sign “+” for the code displayed below.
I’m in the process of modifying some code which generates the label and url for products displayed in my catalog. The problem I face is that my current code doesn’t do the replacement. Can someone please modify the code, replacing a spacing for a plus sign “+”.
<h5><a href="http://www.efficienttrade.co.nz/catalogsearch/result/order=relevance&dir=desc&q=<?php echo $this->stripTags($_product->getName(), null, true) ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h5>
and will return a url something like this:
http://www.efficienttrade.co.nz/catalogsearch/result/?order=relevance&dir=desc&q=potassium nitrate
However, when getName() function is used, names which have a space don’t work for the generated search query. So I need to replace the space with a “+” to make the search query url work.
Thanks
As far as i understand your problem, you need to replace spaces by hypens in your product name. This can be achieved by replacing the following code in your href
with