We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23156
    • 15 Posts
    Call snippet:
    [!AjaxSearch? &language=`english` &whereSearch=`products,stocks,providers` &documents=`1,2,3,4,5,6,7,8,9,10,11,12` &filter=`name,iphone,10|pvd_name,Nokia,10` &order=`name` &extract=`99:description` &config=`owntables-2` &searchWordList=`owntablesWordList` &stripOutput=`saveHtml` &tplLayout=`@FILE:assets/snippets/ajaxSearch/templates/optionMultipleList/layout.tpl.html` &tplAjaxResult=`@FILE:assets/snippets/ajaxSearch/templates/owntables-2AjaxResult.tpl.html`!]

    config (owntables-2.conf.php):
    <?php
    
    function saveHtml($results){ 
    
      // replace line Breaking by space
      $results = stripLineBreaking($results);
      // strip javascript tags
      $results = stripJscripts($results);
      
      return $results;
    }
    
    function owntablesWordList(){ 
    
      $list = "GPS,phone,Nokia,HTC,i-mate,Palm,Iphone,Blackberry";
      return $list;
    }
    
    function products(& $main,& $joined, $listIDs){
    
      $main = array(
          'tb_name' => "ext_products",
          'tb_alias' => 'pdt',
          'id' => 'id',
          'searcheable' => array('name','image','description'),
          'date' =>array(),
          'filters' => array(),
          'jfilters'  => array()
        );
        
      $main['filters'][]= array(
          'field' => 'available',
          'oper' => '=',
          'value' => '1' 
      );
      
      $main['filters'][]= array(
          'field' => 'id',
          'oper' => 'in',
          'value' => $listIDs
      );
        
      $joined = NULL;
    }
    
    function stocks(& $main,& $joined, $listIDs){
    
      $main = NULL;
              
      $joined = array(
            'tb_name' => "ext_stocks",
            'tb_alias' => 'stk',
            'main' => 'id',
            'join' => 'product',
            'concat' => array('name'),
            'concat_alias' => array('stk_name'),
            'concat_separator' => ', ',
            'filters' => array()
        );
      $joined['filters'][]= array(
            'field' => 'nb',
            'oper' => '>',
            'value' => '0' 
      );
    }
    
    function providers(& $main,& $joined, $listIDs){
    
      $main = NULL;
              
      $joined = array(
            'tb_name' => "ext_providers",
            'tb_alias' => 'pvd',
            'main' => 'provider',
            'join' => 'id',
            'concat' => array('name','web'),
            'concat_alias' => array('pvd_name','pvd_web'),
            'concat_separator' => ', ',
            'filters' => array()
        );
    }
    
    ?>

    But I have an error:
    AjaxSearch error: table products,stocks,providers not defined in the configuration file: owntables-2 !


    What do I do wrong?