I need to work out how to incorporate category names into the search results url.

I found a solution using php (noted below) which adds the relevant category names into the appropriate position in the url. This works perfectly well, however i need to alter this code so that it accepts multiple category names. Currently it inserts the category names associated with 'beauty', but I also need it do do the same thing for 'hair', 'nails' etc..

I am no php expert so any help is appreciated!


<?php $autoPath = '{auto_path}';
$lastSegment = basename($autoPath);

//Beauty URL update, based on the category assigned to the entry

if(strpos($autoPath, 'beauty')){

//variable to assign the category to the appropriate URL segment for the Rule

$catVar = 1;
$basename = 'catPath';


 $tempname = $basename.$catVar;
 $$tempname = "{category_url_title}";

<?php $autoPath = "http://www.mysite.com/products/"."beauty/$catPath1/$lastSegment";
} ?>

<h3><a href="<?php echo $autoPath; ?>" title="{title}">{title}</a></h3>

  • why did you go the php route? – Mark Busnelli Jr Oct 21 '14 at 22:36
  • The other way i found was to purchase a pricey add-on. As there some easier way? – ZEDG Oct 22 '14 at 3:02
  • yeah you're probably right about that, low search is really nice though and I really hate running php in any of my templates. I would think some MySQL statements would be better but not sure how to get you started with that. – Mark Busnelli Jr Oct 22 '14 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.