Jump to content
Sign in to follow this  
RoseCamp

Allowing user to expand contents of info box

Recommended Posts

I have set up a new info box to allow users to see our recommended products for each area of play (i.e. category). At the moment, the box displays all the categories that we will set up recommended products for. I've got the recommended products display working aok.

BUT what I can't get to work is... I would like the recommended info box to contain only two links initially, until the second link is selected by the user.

 

e.g.

Initially I would like the 'Basic Equipment Recommended...' box on the right to just have two links in it...

  • About the Basic List
  • Recommended List

However if they do select 'Recommended List' from the info box, I would like it to expand to list the categories that are flagged to be included on the list. i.e. as is displayed at present.

 

screenshot included...

View sample page

 

I want to do this because some users may not want to view the Recommended List, but would rather be able to view the other boxes now quite a way down on the right column.

 

Being a newbie to osCommerce and php I have attacked this various ways and am hitting the wall of my understanding and reading. Just get stumped.

 

* First I tried setting up a global variable $display_recommend_list. If it was not set or not 'y', I would display the two-option version of the infobox. But the global variable seems to get lost/reset on every repaint.

* Then I added a field to the Sessions table so that I could store whether the user had selected the Recommended List during this session. But I couldn't seem to get hold of the session id $SID. Half the time is seemed to be blank, or not in the database yet.

Just very confusing.

* Looked at using a dropdown menu i.e. hover over 'recommended list' would list all the categories. But this would display very differently from the Category /Product List in the left box, so I'm a bit uncertain about trying that. And a bit confused what contribution to use.

 

Any suggestions or pointers out there? I would greatly appreciate it!

My lack of understanding of oscommerce and php is showing!

 

Thanks

Rose

 

This was the code I was using in my info box to determine what I displayed...

***************

// test to display expanded list of categories for the Recommended List or display activate list link

if ( (!isset($SID)) && (tep_not_null($SID)) ) {

$display_recommend_list = 'n';

} else {

// echo "session id is: " . $SID;

$session_record = tep_db_query("select display_recommend_list from " . TABLE_SESSIONS . " where sesskey = '"

.tep_db_input($SID) . "'");

$want_to_see_recommended_products = tep_db_fetch_array($session_record);

$display_recommend_list = trim($want_to_see_recommended_products['display_recommend_list']);

}

// echo "one. " . '$display_recommend_list';

 

if ($display_recommend_list == 'n') {

$categories_string .= '<a href="' . tep_href_link(FILENAME_RECOMMENDED_LIST) . '">' .

BOX_INFORMATION_RECOMMENDED_LIST . '</a><br><br>';

} else {

 

.... display category list

*********************

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×