Jump to content



Latest News: (loading..)

* * * * * 3 votes

How to create a drop down selection menu


  • Please log in to reply
73 replies to this topic

#61   protokos

protokos
  • Members
  • 2 posts
  • Real Name:Wil van Ham
  • Gender:Male
  • Location:Waalwijk

Posted 12 September 2012 - 09:01 AM

Hi all

does some1 has implemented in in version 2.33??

#62   vampirehunter

vampirehunter
  • Members
  • 274 posts
  • Real Name:vampire

Posted 07 November 2012 - 04:37 PM

is HTTP_POST_VARS deprecated?

this is still in 2.3.3 code

do i need to change this in order to make my dropdowns work?

#63   kymation

kymation

    Believers

  • Community Sponsor
  • 6,697 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 07 November 2012 - 07:53 PM

$HTTP_POST_VARS is deprecated, but there is compatibility code in osCommerce to make it function. You can change it to $_POST if you want, but it shouldn't make any difference.

Regards
Jim
My Addons

Banners Box 2.3.x  Support
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x  Support

#64   vampirehunter

vampirehunter
  • Members
  • 274 posts
  • Real Name:vampire

Posted 08 November 2012 - 01:42 AM

ok thanks, so that means it cannot be that which is causing this code not to work then.

im getting stuck on this code, i do not understand why the page URL is not being passed through the form??

tep_href_link(basename($PHP_SELF)

if i view the HTML source of this form, i can clearly see the full URL for the "action" option. But when the dropdown is selected, it just goes to the index.php page without the cpath after it. what could be preventing the cpath not to go through?

// Show Drop down menu in split_page_link :
// (You can move this part where ever you inside $display_links_string ) here it's a the very begining.
  $display_links_string .= tep_draw_form('prod_per_page', tep_href_link(basename($PHP_SELF), $parameters), 'get'). tep_draw_pull_down_menu('ppp', $ppp_list, $products_per_search_page, 'class="smallText" onchange="this.form.submit()"') ;
  $ignore = array('page', 'ppp');
  if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
	reset($HTTP_GET_VARS);
	while (list($key, $value) = each($HTTP_GET_VARS)) {
	  if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) {
		$display_links_string .= tep_draw_hidden_field($key, $value);
	  }
	}
  }
		$display_links_string .= tep_hide_session_id() . '</form>';
	   
	  }


#65   kymation

kymation

    Believers

  • Community Sponsor
  • 6,697 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 08 November 2012 - 01:50 AM

Where's the code that executes when this form is submitted? That's probably where your problem is.

Regards
JIm
My Addons

Banners Box 2.3.x  Support
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x  Support

#66   vampirehunter

vampirehunter
  • Members
  • 274 posts
  • Real Name:vampire

Posted 08 November 2012 - 01:54 AM

this code is in split_page_results.php

i used this plugin here

http://addons.oscommerce.com/info/7219

the form is actually showing the cpath, but when it submits, it doesn't pass it through.

unless there is something to do with wamp settings?

so like my page is this URL: http://localhost/testsite/index.php?cPath=3&sort=0d&page=2

if i select the dropdown which allows you to select how many products to view, say i choose 20, then the form automatically submits.

and I should b getting this URL here: http://localhost/testsite/index.php?cPath=3&sort=0d&page=2&ppp=20

but at the moment i only get this: http://localhost/testsite/index.php?&ppp=20


It doesn't seem to want to submit the entire URL path.

It should work, because I got an example from someone else and they said it was working on theirs.

I can't see what could be wrong with it.

Unless the actual form isn't constructed correctly?

Edited by vampirehunter, 08 November 2012 - 01:57 AM.


#67 ONLINE   mattjt83

mattjt83
  • Partner
  • 248 posts
  • Real Name:Matt Toste
  • Gender:Male
  • Location:CA, USA

Posted 08 November 2012 - 02:01 PM

Maybe where it says

$parameters

It is supposed to say

tep_get_all_get_params()

Just a guess though :)  Maybe it needs both of those?  I'm not sure what the $parameters variable contains...

Edited by mattjt83, 08 November 2012 - 02:03 PM.


#68   vampirehunter

vampirehunter
  • Members
  • 274 posts
  • Real Name:vampire

Posted 08 November 2012 - 09:43 PM

View Postmattjt83, on 08 November 2012 - 02:01 PM, said:

Maybe where it says

$parameters

It is supposed to say

tep_get_all_get_params()

Just a guess though :)  Maybe it needs both of those?  I'm not sure what the $parameters variable contains...

// display split-page-number-links
	function display_links($max_page_links, $parameters = '') {
	  global $PHP_SELF, $prod_per_page, $request_type;
	  $display_links_string = '<ul>';
	  $class = 'class="navresults"';
	  if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&';
/* Customer Selected listing size */
// if your MAX_DISPLAY_SEARCH_RESULTS = 10
// Drop down menu will be :
// 10
// 20
// 30
// 40
// 50
  $ppp_list = array();
  for ($i = 1; $i <= 5; $i += 1) {
	$ppp = intval($i * MAX_DISPLAY_SEARCH_RESULTS);
	$ppp_list[] = array('id' => $ppp, 'text' => $ppp);
  }
// Show Drop down menu in split_page_link
// (You can move this part where ever you inside $display_links_string ) here it's a the very begining.
  $display_links_string .= '<div style="float: left; display:inline;">'. tep_draw_form('prod_per_page', tep_href_link(basename($PHP_SELF), $parameters), 'get'). TEXT_PPP .':'. tep_draw_pull_down_menu('ppp', $ppp_list, $products_per_search_page, 'class="smallText" onchange="this.form.submit()"');
   $ignore = array('page', 'ppp');
  if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
	reset($HTTP_GET_VARS);
	while (list($key, $value) = each($HTTP_GET_VARS)) {
	  if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) {
		$display_links_string .= tep_draw_hidden_field($key, $value);
	  }
	}
  }
		$display_links_string .= tep_hide_session_id() . '</form>';

this is the code.

still can't workout why this form is not passing the full url of the current page in the form.

if i view the html source of the current page, it clearly shows the full URL in the action path, yet it isn't being passed through the form.

completely stuck on this one.

the fact that several others have used this as it is, i seriously have no clue as to why its not working.

everything seems right.

#69   jtristan

jtristan
  • Members
  • 1 posts
  • Real Name:Gabriel

Posted 06 March 2013 - 05:55 PM

I am new to Oscommerce so bare with me and this is my first post. I am trying to move a dropdown list from the content area of three categories to the header of the page. It would display a category in the header with a dropdown list of the manufacturers that when selected would display in the content area. Does anyone know how to move the code from the content area to the header? I am using a test site at http://www.juantristan.com/store/index.php?cPath=22 there you can see in the content area a dropdown menu that says Show All Manufacturers. That is what I am trying to move to the header. Thanks for any help.

#70   Bob Terveuren

Bob Terveuren
  • Members
  • 169 posts
  • Real Name:Bob Terveuren
  • Gender:Male

Posted 06 March 2013 - 07:56 PM

Hi

You can pretty much take a bit of code from somewhere else in the files and hack sorry - edit - it to do something else - if you grab the code for the manufacturers box (top right on you right column) then you can use what's in there to get your solution. Just edit a line or a section  at a time until the display is what you want

This will give you a dropdown in the same width/style as the ones you already have
<?php ////////////////////////////////////////////////
	 $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
	
$content='<div style=" height:20px; width:190px; border:0px solid #cacaca; float:left; padding:3px; margin-bottom:5px; margin-right:2px;">';
$content.='<span style="font-weight:bold; text-transform:uppercase; margin-right:4px;">Your title</span>';
$content.='<select style="width:120px;">
			 <option>(select)</option>';

		 while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
		 $content .= '<option>'.$manufacturers['manufacturers_name'].'</option>';
}
		 $content.='</select></div>';

	
	 echo $content;

///////////////////////////////////////////////////
?>


#71   Bob Terveuren

Bob Terveuren
  • Members
  • 169 posts
  • Real Name:Bob Terveuren
  • Gender:Male

Posted 06 March 2013 - 07:58 PM

Hi

You can pretty much take a bit of code from somewhere else in the files and hack sorry - edit - it to do something else - if you grab the code for the manufacturers box (top right on you right column) then you can use what's in there to get your solution. Just edit a line or a section  at a time until the display is what you want

This will give you a dropdown in the same width/style as the ones you already have
<?php ////////////////////////////////////////////////
	 $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
	
$content='<div style=" height:20px; width:190px; border:0px solid #cacaca; float:left; padding:3px; margin-bottom:5px; margin-right:2px;">';
$content.='<span style="font-weight:bold; text-transform:uppercase; margin-right:4px;">Your title</span>';
$content.='<select style="width:120px;">
			 <option>(select)</option>';

		 while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
		 $content .= '<option>'.$manufacturers['manufacturers_name'].'</option>';
}
		 $content.='</select></div>';

	
	 echo $content;

///////////////////////////////////////////////////
?>

the dropdown you mention can be found in the index.php file in the /catalog/ folder

#72   melibee

melibee
  • Members
  • 2 posts
  • Real Name:kathy brocher

Posted 04 May 2013 - 02:57 PM

thanks for the detail but does this work for all the ecommerce site..

#73   MWebb

MWebb
  • Members
  • 46 posts
  • Real Name:Matthew
  • Gender:Male

Posted 08 May 2013 - 01:34 PM

I want to use this menu in the registration from so that customers are able to select which group they belong to to be able to get different discounts (at the moment the group can only be chosen by the administrator) How would I go about adding it to the registration form and edit the code so it relates to that?

#74   MWebb

MWebb
  • Members
  • 46 posts
  • Real Name:Matthew
  • Gender:Male

Posted Today, 01:36 PM

As mentioned in my previous post, I would like to use this drop down as part of the registration form when joining the site. Is it possible to have so that the list displays the types of groups available and then where one group needs to have some information filled in, it won't let you complete the registration until you fill in the details required for that group?