shish Posted July 25, 2014 Share Posted July 25, 2014 Hello. I'm wondering how to display some of my product attributes on the top of the page and some on the bottom. Picture example: http://shrani.si/f/X/3I/3yz8VuzE/slika.png My current sql query selects them all and prints them out. I would like to select all except one ("Termin" in my case which has product_options_id = 6). <?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <p> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { if ($new_price > 0) { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price']*(1-$discount), tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } else { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } } if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <table> <tr> <td class="td_left"><strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong></td> <td class="td_right"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute, 'onchange="changePrice(this.id)"'); ?></td> </tr> </table> Link to comment Share on other sites More sharing options...
shish Posted July 25, 2014 Author Share Posted July 25, 2014 Managed to display all of them except the last one with this: <table> <tr> <td class="td_left"> <strong> <?php $atr_name = $products_options_name['products_options_name']; if($atr_name !='Last_one') { echo $products_options_name['products_options_name'] . ':'; ?> </strong> </td> <td class="td_right"> <?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute, 'onchange="changePrice(this.id)"'); } ?> </td> </tr> </table> Link to comment Share on other sites More sharing options...
gadlol Posted July 25, 2014 Share Posted July 25, 2014 I guess you have to store the results from the attributes query in an array. Then split that array into 2 arrays and then use tep_draw_pull_down_menu() two times. One with the data from the first splitted array and another with the data from the second splitted array. Check out the great Alternative Administration System addon for osCommerce! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.