Jump to content

mvigil514

Members
  • Content count

    34
  • Joined

  • Last visited


Reputation Activity

  1. Downvote
    mvigil514 got a reaction from multimixer in Options as Images Sort Problem   
    Hello All,
     
    I am using Options as Images v1.2. I have looked through the forums and have not been able to make this work. I am trying to change the sort order in the admin section to sort by products_options_values_name. Currently, we have many (500+) option values for one option and they are sorted by options_values_id. I have tried adding "order by products_options_values_name" at the end of $query2, but it does not seem to work. Maybe someone with more PHP/MySQL knowledge can figure this out. Below is the relevant section of code. I can post the entire file if needed.
     

    <td valign="top" width="75%"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NAME; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ID; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE_NAME; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DIMENSIONS; ?></td> </tr> <?php $query1 = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_id . "'" ); //First find all the products options values that belong to the selected product option while ($result1 = tep_db_fetch_array($query1)) { $products_options_values_id = $result1['products_options_values_id']; //Now pull their details from the database $query2 = tep_db_query ("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $products_options_values_id . "' and language_id = '" .$language_id . "'"); while ($result2 = tep_db_fetch_array($query2)) { $products_options_values_name = $result2 ['products_options_values_name']; $products_options_values_id = $result2 ['products_options_values_id']; $products_options_values_thumbnail = $result2['products_options_values_thumbnail']; $products_options_values_dimensions = $result2['products_options_values_dimensions']; if ($HTTP_GET_VARS['cID'] == $products_options_values_id){ $selected_value['name'] = $products_options_values_name; $selected_value['id'] = $products_options_values_id; $selected_value['image'] = $products_options_values_thumbnail; $selected_value['dimensions'] = $products_options_values_dimensions; $selected_value['id'] = $products_options_values_id; } if ( (isset($selected_value['id'])) && ($products_options_values_id == $selected_value['id']) ) { echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id ) . '\'">' . "\n"; } ?> <td class="dataTableContent"><?php echo $products_options_values_name ?></td> <td class="dataTableContent"><?php echo $products_options_values_id ?></td> <td class="dataTableContent" align="center"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . 'options/' . $products_options_values_thumbnail, $products_options_values_name, OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) ?></td> <td class="dataTableContent"><?php echo $products_options_values_thumbnail ?></td> <td class="dataTableContent"><?php echo $products_options_values_dimensions ?></td> </tr> <?php } } ?>
     
    Thanks in advance for any consideration.
     
    Michael
  2. Downvote
    mvigil514 got a reaction from multimixer in Options as Images Sort Problem   
    Hello All,
     
    I am using Options as Images v1.2. I have looked through the forums and have not been able to make this work. I am trying to change the sort order in the admin section to sort by products_options_values_name. Currently, we have many (500+) option values for one option and they are sorted by options_values_id. I have tried adding "order by products_options_values_name" at the end of $query2, but it does not seem to work. Maybe someone with more PHP/MySQL knowledge can figure this out. Below is the relevant section of code. I can post the entire file if needed.
     

    <td valign="top" width="75%"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NAME; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ID; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE_NAME; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DIMENSIONS; ?></td> </tr> <?php $query1 = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_id . "'" ); //First find all the products options values that belong to the selected product option while ($result1 = tep_db_fetch_array($query1)) { $products_options_values_id = $result1['products_options_values_id']; //Now pull their details from the database $query2 = tep_db_query ("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $products_options_values_id . "' and language_id = '" .$language_id . "'"); while ($result2 = tep_db_fetch_array($query2)) { $products_options_values_name = $result2 ['products_options_values_name']; $products_options_values_id = $result2 ['products_options_values_id']; $products_options_values_thumbnail = $result2['products_options_values_thumbnail']; $products_options_values_dimensions = $result2['products_options_values_dimensions']; if ($HTTP_GET_VARS['cID'] == $products_options_values_id){ $selected_value['name'] = $products_options_values_name; $selected_value['id'] = $products_options_values_id; $selected_value['image'] = $products_options_values_thumbnail; $selected_value['dimensions'] = $products_options_values_dimensions; $selected_value['id'] = $products_options_values_id; } if ( (isset($selected_value['id'])) && ($products_options_values_id == $selected_value['id']) ) { echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id ) . '\'">' . "\n"; } ?> <td class="dataTableContent"><?php echo $products_options_values_name ?></td> <td class="dataTableContent"><?php echo $products_options_values_id ?></td> <td class="dataTableContent" align="center"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . 'options/' . $products_options_values_thumbnail, $products_options_values_name, OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) ?></td> <td class="dataTableContent"><?php echo $products_options_values_thumbnail ?></td> <td class="dataTableContent"><?php echo $products_options_values_dimensions ?></td> </tr> <?php } } ?>
     
    Thanks in advance for any consideration.
     
    Michael
×