Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Pulldown of Products List


trex

Recommended Posts

The admin/products_attributes.php page has this. You can look at the manufacturers box to get an idea of how to adapt it to the catalog side. Hint: the filename to use in the form would be FILENAME_PRODUCT_INFO; the variable would be products_id.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Hello

 

i have here new products_pulldown.php and I get errors

Parse error: parse error, unexpected T_STRING in d:\server\htdocs\shop\includes\boxes\products_pull.php on line 13

and that is this line

 $products_query = tep_db_query("select products_id, products_name from " . TABLE_ PRODUCTS_DESCRIPTION . " order by products_name");

 

has anyone a idea?

 

<?php
/*
 $Id: manufacturers.php,v 1.19 2003/06/09 22:17:13 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $products_query = tep_db_query("select products_id, products_name from " . TABLE_ PRODUCTS_DESCRIPTION . " order by products_name");
 if ($number_of_rows = tep_db_num_rows($products_query)) {
?>
<!-- products //-->
<?php
//    $info_box_contents = array();
//    $info_box_contents[] = array('text' => BOX_HEADING_MANUFACTURERS);

//    new infoBoxHeading($info_box_contents, false, false);

   if ($number_of_rows <= MAX_DISPLAY_PRODUCTS_IN_A_LIST) {
// Display a list
     $products_list = '';
     while ($products = tep_db_fetch_array($products_query)) {
       $products_name = ((strlen($products['products_name']) > MAX_DISPLAY_PRODUCT_NAME_LEN) ? substr($products['products_name'], 0, MAX_DISPLAY_PRODUCT_NAME_LEN) . '..' : $products['products_name']);
       if (isset($HTTP_GET_VARS['products_id']) && ($HTTP_GET_VARS['products_id'] == $products['products_id'])) $products_name = '<b>' . $products_name .'</b>';
       $products_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'products_id=' . $products['products_id']) . '">' . $products_name . '</a><br>';
     }
     $products_list = substr($products_list, 0, -4);

     $info_box_contents = array();
     $info_box_contents[] = array('text' => $products_list);
   } else {
// Display a drop-down
     $products_array = array();
     if (MAX_PRODUCTS_LIST < 2) {
       $products_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
     }
     while ($products = tep_db_fetch_array($products_query)) {
       $products_name = ((strlen($products['products_name']) > MAX_DISPLAY_PRODUCT_NAME_LEN) ? substr($products['products_name'], 0, MAX_DISPLAY_PRODUCT_NAME_LEN) . '..' : $products['products_name']);
       $products_array[] = array('id' => $products['products_id'],
                                      'text' => $products_name);
     }
     $info_box_contents = array();
     $info_box_contents[] = array('form' => tep_draw_form('products', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
                                  'text' => tep_draw_pull_down_menu('products_id', $products_array, (isset($HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : ''), 'onChange="this.form.submit();" class="hersteller" size="' . MAX_PRODUCTS_LIST . '" style="width: 100%"') . tep_hide_session_id());
   }
 new manufacturersBox($info_box_contents);
 }
?>

Link to comment
Share on other sites

It looks like you have an extra space in

TABLE_ PRODUCTS_DESCRIPTION

which should be (no spaces)

TABLE_PRODUCTS_DESCRIPTION

Btw, if your store has more than one language, you probably want to limit your choices by language id. Otherwise, it will show each product multiple times (once for each language).

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Hello

 

it' work :D, thanks for your help.

i have next problem, pulldown of manufacturers and products show false, see image here. It seem to be that a <br>-tag there is. I know, it is <form>-tag. Has anyone a idea?

 

FALSE

pulldown_false.png

 

RIGHT

pulldown_right.png

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...