Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Drop Down List Empty


skyylar

Recommended Posts

I installed the manufacturers2 contribution per the instructions. I ran into a few problems that I managed to fix that I'm assuming came from my shop being so highly customized and altered from the original setup. The main problem I'm having now that I cannot find a solution to is the fact my second manufacturer box that I named "Artists" is coming up empty. Can someone please take a look and point me in the right direction? Thanks in advance.

 

http://moongoddessgifts.com/boutique/index.php

Link to comment
Share on other sites

I installed the manufacturers2 contribution per the instructions. I ran into a few problems that I managed to fix that I'm assuming came from my shop being so highly customized and altered from the original setup. The main problem I'm having now that I cannot find a solution to is the fact my second manufacturer box that I named "Artists" is coming up empty. Can someone please take a look and point me in the right direction? Thanks in advance.

 

http://moongoddessgifts.com/boutique/index.php

 

 

Looks like you are successully selecting data from the database that is either :

1) storing this value :

''

 

or 2) you are successfully selecting data from the database, but you are select the wrong fieldname.

 

You need to post your select satement inside the includes/boxes/<box name>.php file in order to properly troubleshoot.

 

Corrina

Link to comment
Share on other sites

Looks like you are successully selecting data from the database that is either :

1) storing this value :

''

 

or 2) you are successfully selecting data from the database, but you are select the wrong fieldname.

 

You need to post your select satement inside the includes/boxes/<box name>.php file in order to properly troubleshoot.

 

Corrina

 

Thanks for the help. Basically what I did was take the manufacturers2.php file and replace all references to "manufacturer" with "artist". I tried duplicating as much info as possible using the manufacturers box as a reference. All my artist names are in the field "artist_name", etc. Silly me....I thought it would work. lol Any suggestions?

 

<?php

/*

$Id: artist.php,v 1.19 2003/06/09 22:17:13 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

$artist_query = tep_db_query("select artist_id, artist_name from " . TABLE_ARTIST . " order by artist_name");

if ($number_of_rows = tep_db_num_rows($artist_query)) {

?>

<!-- artist //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_ARTISTS);

 

new infoBoxHeading($info_box_contents, false, false);

 

if ($number_of_rows <= MAX_DISPLAY_ARTIST_IN_A_LIST) {

// Display a list

$artist_list = '';

while ($artist = tep_db_fetch_array($artist_query)) {

$artist_name = ((strlen($artist['artist_name']) > MAX_DISPLAY_ARTIST_NAME_LEN) ? substr($artist['artist_name'], 0, MAX_DISPLAY_ARTIST_NAME_LEN) . '..' : $artist['artist_name']);

if (isset($HTTP_GET_VARS['artist_id']) && ($HTTP_GET_VARS['artist_id'] == $artist['artist_id'])) $artist_name = '<b>' . $artist_name .'</b>';

$artist_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'artist_id=' . $artist['artist_id']) . '">' . $artist_name . '</a><br>';

}

 

$artist_list = substr($artist_list, 0, -4);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $artist_list);

} else {

// Display a drop-down

$artist_array = array();

if (MAX_ARTIST_LIST < 2) {

$artist_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);

}

 

while ($artist = tep_db_fetch_array($artist_query)) {

$artist_name = ((strlen($artist['artist_name']) > MAX_DISPLAY_ARTIST_NAME_LEN) ? substr($artist['artist_name'], 0, MAX_DISPLAY_ARTIST_NAME_LEN) . '..' : $artist['artist_name']);

$artist_array[] = array('id' => $artist['artist_id'],

'text' => $artist_name);

}

 

$info_box_contents = array();

$info_box_contents[] = array('form' => tep_draw_form('artist', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),

'text' => tep_draw_pull_down_menu('artist_id', $artist_array, (isset($HTTP_GET_VARS['artist_id']) ? $HTTP_GET_VARS['artist_id'] : ''), 'onChange="this.form.submit();" size="1" style="width: 100%"') . tep_hide_session_id());

}

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- artist_eof //-->

<?php

}

?>

Link to comment
Share on other sites

Thanks for the help. Basically what I did was take the manufacturers2.php file and replace all references to "manufacturer" with "artist". I tried duplicating as much info as possible using the manufacturers box as a reference. All my artist names are in the field "artist_name", etc. Silly me....I thought it would work. lol Any suggestions?

$artist_name = ((strlen($artist['artist_name']) > MAX_DISPLAY_ARTIST_NAME_LEN) ? substr($artist['artist_name'], 0, MAX_DISPLAY_ARTIST_NAME_LEN) . '..' : $artist['artist_name']);

 

$artist_name = ((strlen($artist['artist_name']) > MAX_DISPLAY_ARTIST_NAME_LEN) ? substr($artist['artist_name'], 0, MAX_DISPLAY_ARTIST_NAME_LEN) . '..' : $artist['artist_name']);

 

here's your culprit :

 

$artist_name = ((strlen($artist['artist_name']) > MAX_DISPLAY_ARTIST_NAME_LEN) ? substr($artist['artist_name'], 0, MAX_DISPLAY_ARTIST_NAME_LEN) . '..' : $artist['artist_name']);

 

why are you doing a substring on the name ? is there a good reason for this ?

Link to comment
Share on other sites

here's your culprit :

 

$artist_name = ((strlen($artist['artist_name']) > MAX_DISPLAY_ARTIST_NAME_LEN) ? substr($artist['artist_name'], 0, MAX_DISPLAY_ARTIST_NAME_LEN) . '..' : $artist['artist_name']);

 

why are you doing a substring on the name ? is there a good reason for this ?

 

Honestly I have no clue what all that code means. Some of it I can figure out, but I'm very new to sql and it's still very confusing. I didn't even realize that's what the code was doing. Like I said, I basically just edited the original file and left the structure in tact. What do you suggest? By the way, you're a Godsend. :)

Link to comment
Share on other sites

Honestly I have no clue what all that code means. Some of it I can figure out, but I'm very new to sql and it's still very confusing. I didn't even realize that's what the code was doing. Like I said, I basically just edited the original file and left the structure in tact. What do you suggest? By the way, you're a Godsend. :)

 

Problem solved. I retraced my steps and found a few syntax errors among other things that I corrected and now everything is working fine. Thanks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...