Im trying to make a single page have different drop down menu functions depending on what area of the site you navigate to the page from.
For example:
home > products > product type > PAGE (with such drop down menu showing)
then
home > products > manufacturer > PAGE (with this drop down menu showing, not the one above^)

Should i use url aliases? are there better ways to do this?
Please help!

Comments

rockitdev’s picture

i know this is in the "coding" section of the form, but what you're describing sounds like a perfect case to use the Hierarchical Select module http://drupal.org/project/hierarchical_select.

Seems to me you could achieve this functionality just using taxonomy with hierarchical select and maybe some views.

jaypan’s picture

Let's say the path to your module is like this:

function my_module_menu()
{
  $menu['my_module/path'] = array
  (
    'page callback' => 'my_module_callback',
    // rest of menu definition goes here
  );
  return $menu;
}

Then you can define your callback like this:

function my_module_callback($origin = FALSE)
{
  if($origin == 'product_type')
  {
    // add stuff when the user comes from product type page
  }
  elseif($origin == 'manufacturer')
  {
    // add stuff when the user comes from manufacturer page
  }
  // add stuff that isn't dependent on the page they came from
  return $something;
}

Then from your product type pages, you link to my_module/path/product type. From manufacturers pages you link to my_module/path/manufacturer, and from any other pages you can link to my_module/path.

Contact me to contract me for D7 -> D10/11 migrations.