Using a root path in your Ubercart catalog and need to get a block to show on those pages? Here's how...


Category: drupal

If you're using a nice root path (ie. you've dropped the default /catalog off the url alias) for Ubercart and yet you still want blocks to ONLY appear on catalog pages you can be a bit stuck... normally you'd just tell it to appear on only the catalog/* stuff, but without that option you need to resort to some PHP...

So, select that box for PHP and bung in this :-

<?php
$current_url = str_replace('q=', '', $_SERVER["REDIRECT_QUERY_STRING"]);
$original_path = drupal_lookup_path('source',$current_url);
if(strpos($original_path, 'atalog/', 0) > 0)
{
    //echo 'TRUE';
    return TRUE;
}else{
    //echo 'FALSE';
    //echo '<br/>'.$current_url.' | '.$original_path;
    return FALSE;
}
?>

And that should do the trick!


Comments

Post new comment

The content of this field is kept private and will not be shown publicly.