Get article by name or number

oxid6

#1

I try to write a simple function or plugin for the oxid shop which allows to get the article data by name or number.
I can’t do that.
Got anybody got a clue?


#2

many people here have a clue


#3

But I can’t find any topic with similar question.


#4

Try the code from here:


#5

class oxGetArticleByNumberPlugin extends oxErpPluginBase
{
public function invoke($aParams)
{
$am = $this->getConfig()->getParameter(‘am’);
$art = $this->getConfig()->getParameter(‘oxartnum’);
$aResult = array();

    		$rs = oxDb::getDB()->select( "SELECT OXID FROM ...");	
    		
            if ($rs != false && $rs->count() > 0)
     {
                while (!$rs->EOF) {
                    $rs->fields = array_change_key_case($rs->fields, CASE_LOWER);
                    $aResult[] =  $rs->fields['oxid']; //only the oxid
                    $rs->fetchRow();
     }

    		
        $oResult = new oxERPReturn();
        $oResult->aResult = $aResult;
        $oResult->blResult = true;
        return $oResult;
}

}
Call to undefined method oxGetArticleByNumberPlugin::getConfig().

but when I try:
$am = $aParams[‘am’];
$art = $aParams[‘oxartnum’];
there is no error but $art param is empty.


#6

Try:

> oxRegistry::getConfig()->

Where comes invoke($aParams){…} from?


#7

Function ‘‘getParameter’’ does not exist or is not accessible!

Params are from OXERPCallPlugin function


#8

Oh, it’s very old: Use getRequestParameter instead of

getParameter


#9

Now is no error, but $art param is empty. :frowning:

really has no function to get articles or orders for another field than OXID?


#10

Have a look: Order_Article.php getMainProduct();


#11

where the file is?
I can’t find it.


#12

Hmm i am too old for this :rofl:: I told the wrong file. application/controllers/admin/Order_Article.php


#13

I found the file on https://docs.oxid-esales.com/sourcecodedocumentation website
But the file is useless for me, because I need use SOAP technology and every function need own call procedure with array type parameters.


#14

I can create function (I show my function above).
Problem is with parameters. They are empty.