Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Select Box (dropdown) outside of infobox class


_pleb

Recommended Posts

Previous to fiddling with osC, I'd not really delved *that* much into PHP, but I'd expressed an interest and vague understanding of the basics, so now its my charge to get the store configured, and up and running, and ergh! Anyway, I'd not got as far as comprehension of arrays, certainly not to the degree osC makes use of them. So, here's the issue:

 

For the sake of usability, we want a dropdown box of categories in the footer. I've looked through the contributions available (searching for select box, dropdown etc) but the only options I could find were to place a select of categories in an infobox.

 

Currently, the code in my footer looks like this:

$info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">' . tep_hide_session_id(),

                              'align' => 'left',

                              'text'  => tep_draw_pull_down_menu('cPath', tep_get_categories(array(array('id' => '', 'text' => PULL_DOWN_DEFAULT))), $cPath, 'onchange="this.form.submit();"')

);

Which prints "Array" when echo'd - not ideal :)

 

Its taken from David Watkins' Category Drop Down List

 

I have also played with the tep_draw_pull... thing, but being a beginner, and on a ridiculously tight schedule most of the time, I've not really got to grips with what I'm doing.

 

Can anyone help shed some light on arrays, and why its printing array, and stuff? Cheers.

Link to comment
Share on other sites

Aha, I've solved it, through various hit and miss stuff!

 

and now, for the sake of future proofing for other newbies with this trouble, here's the (ridiculously simple) code:

<?php 

echo '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">' . tep_hide_session_id();

echo tep_draw_pull_down_menu('cPath', tep_get_categories(array(array('id' => '', 'text' => PULL_DOWN_DEFAULT))), $cPath, 'onchange="this.form.submit();"');

echo '</form>';

?>

Its probably not perfect, by any means, despite its concise appearence, but hey; it works! And it fits my needs. Huzzah.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...