Is There a Session Variables Module to Control Content Displays?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ericshell's picture

Unfortunately I am no longer in the Lehigh Valley, but I figure you guys may still be able to help me out! I am currently working on a site on my personal server for my job:

www.eshelldesigns.com/accuair

I am currently building a site where I need to render the products (drupal commerce) on the product page and blog posts depending on whether the user clicked on one of two links of the first page. Effectively, I need to split it up between a "New Cars" and "Old Cars" section with some products in both sections. I have created a field in the products content types that references the taxonomy category that I called "Chassis Type" with the three options: "Late Model, Classic, Both"

I have never written a module before and I am fairly new at actually writing php so I am sure I have quite a few problems in my code, but I have been trying to watch and read up a lot to stay on top of this.

First, will this set a session variable?

if(isset($_GET['...node/38']) ){
    $_SESSION['...node/38']=$_GET['late model'];
}
elseif(isset($_GET['...node/38']) ){
  $_SESSION['...node/38']=$_GET['classic'];
}
else
  $_SESSION['Both']

Once I set the session variable I need to render the products only if that value equals the respective taxonomy term that I created in the "store". So far I have written this:
if ($_SESSION == 'content_variable') {
  'page callback' => 'late model', 'both',
  'access arguments' => array('access content'),
  'type' => MENU_SUGGESTED_ITEM,
}
if ($_SESSION == 'content_variable') {
  'page callback' => 'classic', 'both',
  'access arguments' => array('access content'),
  'type' => MENU_SUGGESTED_ITEM,
}
else {
  return $items;
}

I have tried to work with this but I am getting a little lsot at this point:
taxonomy_get_tree seems like a good resource as well, but the sample code is pretty intimidating and I don't know if I really need it. Any help would be appreciated!

Lehigh Valley

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: