Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Supplier Orders - Purchase Orders


LeeFoster

Recommended Posts

I have installed and modified the below add on to work on 2.3.4 however one of the drop down fields isn't working as it should. I'm hoping someone can point me in the right direction.

 

http://addons.oscommerce.com/info/8081

 

The offending section is below

<!-- table total //-->
    <tr>
      <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
    </tr>
    <tr>
      <td class="main"><table border="1" cellspacing="0" cellpadding="5">
       <tr>
        <td colspan="3" class="main" align="center"><strong><?php echo TABLE_HEADING_ADD_PRODUCTS; ?></strong></td>
       </tr>
       <tr class="dataTableHeadingRow">
        <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_QUANTITY; ?></td>
        <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
        <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_ATTRIBUT; ?></td>
       </tr>
       <tr>
<?php
echo tep_draw_form('form_add_product', FILENAME_ORDER_PURCHASE_ORDERS, tep_get_all_get_params(array('action')) . 'action=add_product');

echo   '<td class="main"><input type="text" name="products_quantite_add" id="products_quantite_add" value="" size="5"></td>
        <td class="main">';

//données produits du menu déroulant
      $products_query = tep_db_query("select products_id, products_tax_class_id, products_name_purchase_orders, products_price_purchase_orders from " . TABLE_PRODUCTS . " order by products_name_purchase_orders asc");

      $products_array[] = array('id'=>'-1', 'text'=>TEXT_CHOICE_PRODUCT);

     if ($oID != '' && $select_verrou == 0) {
        while ($products = tep_db_fetch_array($products_query)) {
               $products_array[] = array('id'=>$products['products_id'], 'text'=>($products['products_name_purchase_orders'] . ' (' . $currencies->format($products['products_price_purchase_orders'], true) . ')'));
             }
           }
   echo tep_draw_pull_down_menu('menu_id_products', $products_array, '', PARAM_SIZE_TEXT . ' onChange="this.form.submit();"', false);
?>
        </td>
        <td></td>
       </tr>
    <?php

    if(isset($product_id) && $product_id != -1) {
//Les options du produit-----------------------------------------------------
      $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)$product_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.option_price_purchase_orders, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$product_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['option_price_purchase_orders'] != '0') {
            $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->format($products_options['option_price_purchase_orders'], true) .') ';
          }
        }
?>
       <tr>
        <td></td><td></td>
        <td class="main"><?php echo tep_draw_pull_down_menu('attributes_options_id[' . $products_options_name['products_options_id'] . ']', $products_options_array); ?></td>
       </tr>
<?php
      }
//------------------------------------------------------
    }
?>
       <tr>
        <td colspan="3" class="main" align="center"><?php if ($select_verrou == 0) echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?></td>
       </tr>
</form>
      </table>
Link to comment
Share on other sites

Little bit more information. The below is the main issue, it is not building the array from the database.

 $products_query = tep_db_query("select products_id, products_tax_class_id, products_name_purchase_orders, products_price_purchase_orders from " . TABLE_PRODUCTS . " order by products_name_purchase_orders asc");

      $products_array[] = array('id'=>'-1', 'text'=>TEXT_CHOICE_PRODUCT);

     if ($oID != '' && $select_verrou == 0) {
        while ($products = tep_db_fetch_array($products_query)) {
               $products_array[] = array('id'=>$products['products_id'], 'text'=>($products['products_name_purchase_orders'] . ' (' . $currencies->format($products['products_price_purchase_orders'], true) . ')'));
             }
           }
   echo tep_draw_pull_down_menu('menu_id_products', $products_array, '', PARAM_SIZE_TEXT . ' onChange="this.form.submit();"', false);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...