Menu

2 drop downs in edit

Help
tdecurtins
2017-10-09
2020-10-06
  • tdecurtins

    tdecurtins - 2017-10-09

    I am trying to have more than one drop down in the edit and add sections but when I add one then the other doesnt work.

    $tabledit->lookup_table = array(
        'product_tax' => array(
            'query' => "SELECT `tax`, `tax_text` FROM `tax_rate`;",
            'option_value' => 'tax',
            'option_text' => 'tax_text'
        )
    );
    $tabledit->lookup_table = array(
        'product_type' => array(
            'query' => "SELECT `type` FROM `product_types`;",
            'option_value' => 'type',
            'option_text' => 'type'
        )
    );
    
     
  • Martin

    Martin - 2017-10-16

    There is only one look up table possible. In your code you replace the var lookup_table ($tabledit->lookup_table) so only the product_types appear in the editor (I think...)

     
  • tdecurtins

    tdecurtins - 2017-10-25

    I ended up creating custom add and edit pages.

     
  • André Fournier

    André Fournier - 2017-11-27

    Index.php
    $tabledit->lt_product_tax = array(
    'product_tax' => array(
    'query' => "SELECT tax, tax_text FROM tax_rate;",
    'option_value' => 'tax',
    'option_text' => 'tax_text'
    )
    );
    $tabledit->lt_product_type = array(
    'product_type' => array(
    'query' => "SELECT type FROM product_types;",
    'option_value' => 'type',
    'option_text' => 'type'
    )
    );

    mte.php
    $lt_fieldname = 'lt_' . $key;
    if (isset($this->$lt_fieldname[$key])) {
    if (is_array($this->$lt_fieldname[$key])) {
    $result = mysqli_query($this->mysqli,$this->$lt_fieldname[$key]['query']);
    if (mysqli_num_rows($result) > 0) {
    while ($menu_items = mysqli_fetch_assoc($result)) {
    $option_value = $menu_items[$this->l$t_fieldname[$key]['option_value']];
    $option_text = $menu_items[$this->$lt_fieldname[$key]['option_text']];

     

    Last edit: André Fournier 2017-11-27
    • Jim Frayer

      Jim Frayer - 2020-10-06

      Hi Andre,
      What line int mte.php did you place your code or did you overwrite the lookup_table section?
      Thanks.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.