Extend oxlist core class

Hi,
i want to extend oxlist core class.
I have a new table in db called oxorder2bc which stores oxorderid, oxartid, oxprovision and some further data…
I have designed a new core class:


class sk_provision_list extends oxList
{
	protected $_sClassName = "sk_provision_list";

    public function __construct()
    {
        parent::__construct();
		$this->init( 'sk_provision_list' );
    }
	public function assign($dbRecord)
	{
		parent::assign($dbRecord);
	}
}

and the manager class:


class sk_provision extends oxAdminList
{
    protected $_sListClass = 'sk_provision_list';
    protected $_sThisTemplate = 'sk_provision.tpl';
    public function render()
    {
        
        parent::render();
	return $this->_sThisTemplate;
    }
	
	protected function _buildSelectString( $oObject = null )
    {	
        return 'select sum(oxprice),sum(oxprovision), oxshopid, oxtitle, oxbuydate from oxorder2bc where 1';
    }
	
	protected function _prepareWhereQuery( $aWhere, $sqlFull )
    {
		
        $sQ = parent::_prepareWhereQuery( $aWhere, $sqlFull );
	return $sQ;
    }
	
}


the tpl file is not necessary to post I think.

I get the following error in the BE:

Function ‘setInList’ does not exist or is not accessible! (sk_provision_list)

#0 [internal function]: oxSuperCfg->__call(‘setInList’, Array)
#1 E:\Apache2\htdocs\oxid-test-neu\core\oxlist.php(374): sk_provision_list->setInList()
#2 E:\Apache2\htdocs\oxid-test-neu\admin\oxadminlist.php(812): oxList->getBaseObject()
#3 E:\Apache2\htdocs\oxid-test-neu\admin\oxadminlist.php(223): oxAdminList->getItemList()
#4 E:\Apache2\htdocs\oxid-test-neu\admin\sk_provision.php(45): oxAdminList->render()
#5 E:\Apache2\htdocs\oxid-test-neu\views\oxshopcontrol.php(473): sk_provision->render()
#6 E:\Apache2\htdocs\oxid-test-neu\views\oxshopcontrol.php(384): oxShopControl->_render(Object(sk_provision))
#7 E:\Apache2\htdocs\oxid-test-neu\views\oxshopcontrol.php(125): oxShopControl->_process(‘sk_provision’, NULL)
#8 E:\Apache2\htdocs\oxid-test-neu\index.php(103): oxShopControl->start()
#9 E:\Apache2\htdocs\oxid-test-neu\admin\index.php(40): require_once(‘E:\Apache2\htdo…’)
#10 {main};

Can anybody help?

ok. but how can I design then an own list-processing class?
thank you

You can copy an existing scheme exactly, e.g. article_list:

class Article_List extends oxAdminList
{
    /**
     * Name of chosen object class (default null).
     *
     * @var string
     */
    protected $_sListClass = 'oxarticle';

    /**
     * Type of list.
     *
     * @var string
     */
    protected $_sListType = 'oxarticlelist';

So here $_sListClass is list members class and $_sListType is list class.

In your code $_sListClass is list class.

i will give it a try.

anyhow, I do not understand, why the following code is not working:


class sk_provision extends oxAdminList
{
    //protected $_sListClass = 'sk_provision_list';
	protected $_sThisTemplate = 'sk_provision.tpl';
    
	public function init()
	{
		parent::init();
	}
	
	public function render()
    {
        $this->_aViewData['mylist']=$this->getNewList();
        parent::render();
		return $this->_sThisTemplate;
    }
	
	protected function _buildSelectString( $oObject = null )
    {	//SK erweitert um: ororderarticles.oxordershopid
        return 'select sum(oxprice),sum(oxprovision), oxshopid, oxtitle, oxbuydate from oxorder2bc where 1 group by oxorderid,oxshopid ';
    }
	
	protected function _prepareWhereQuery( $aWhere, $sqlFull )
    {
		$oUser=oxConfig::getInstance()->getUser();
		$sUserShop=$oUser->oxuser__oxshopid->value;
		if ($sUserShop != "oxbaseshop") { //SK
		$aWhere[ getViewName( "oxorder2bc" ) . ".oxshopid" ] =$sUserShop;
		}	
        $sQ = parent::_prepareWhereQuery( $aWhere, $sqlFull );
		$bFileLog=fopen("log-query-provision-where.txt","w");
		$sWrite=fwrite($bFileLog,$sQ);
        
        


        return $sQ;
    }
	public function getNewList()
	{
		$aList=oxNew('oxarticles');
		$sSelect="select sum(oxprice),sum(oxprovision), oxshopid, oxtitle, oxbuydate from oxorder2bc where 1 group by oxorderid,oxshopid ";
		$aList->selectString($sSelect);
		return $aList;
	}
}

$aList=oxNew('oxarticles');

:confused:

Hi, no, this was an error.
But when I insert “oxlist”, he shows me in the Backend 14 empty rows (there are 14 items after the select query, but they are empty in the view).

  • Do I need no a Listclass of my own and a listtype class of my own?
  • What would be the minimal design for this class?