oxArticleList setSqlLimit > 54 does not work

Hello, maybe somebody know, why oxArticle->selectString not work if i use limit more than 54 than it return me empty string, if limit 54 work but return not 54 items about 30.

not work function select and selectLimit in oxLegacyDb, if i use for example getAll it work

oxArticle doesn’t have function “selectString”. Consider providing some example code to reproduce the problem

vanilla_thunder , sorry oxArticleList not oxArticle

    $articles = oxNew('oxArticleList');
    $articleTable = getViewName('oxarticles');

   ...
   $sql = "select * from $articleTable {$joins} where {$where} ORDER BY {$articleTable}.oxid";

    $articles->setSqlLimit(1, 150);
    $articles->selectString($sql);

this code works for me,
since it works for 53 but not for 54 articles, the query itself should be ok.
memory size limit might be a problem here. check it’s value and try to increase it

1 Like

ini_set(‘memory_limit’, ‘-1’);

return false, but not work only with select and selectLimit, if i use getAll return all article about 3500

how much of total memory do you have?
Both mentioned functions work in different ways:
getAll returns an array while selectString iterates through sql resultset and loads ever oxArticle which consumes by far more memory

1 Like

I think i have enough memory, maybe it something config options?

i know none.
Could you try removing joins from sql query and check if you can increase limits?

$articles = oxNew('oxArticleList');
    $articles->setSqlLimit(1, 150);
    $articles->selectString("select * from oxv_oxarticles_lt  where oxv_oxarticles_lt.oxactive=1 AND oxv_oxarticles_lt.oxparentid = ''  ORDER BY oxv_oxarticles_lt.oxid");
    return $articles->count(); // false

if i get with getAll arrays and when how i can load by oxid oxArticle ?

$oxArticle = oxNew('oxArticle');
    $oxArticle->load($oxid); 

it load me to oxArticle array with oxarticle inputs

your code works for me: (but we have obviously only 80 active parent products)


Are there any entries in php error log or execption log?

You can load whole object by its ID with the code you posted, or if you already have all needed data in your array, you can also use assignArray() function
https://docs.oxid-esales.com/sourcecodedocumentation/4.10.6/oxlist_8php_source.html#l00405
or assign it manually like this:

$oArticleList = oxNew("oxarticlelist");
foreach($array as $key => $data) {
  $oArticle = oxNew("oxarticle");
  $oArticle->assign($data);
  $oArticleList->add($oArticle);
}
1 Like

no error logs :frowning:

$array = \oxDb::getDb(\oxDb::FETCH_MODE_ASSOC)->getAll($sql);
    
    $articleList = [];
    foreach($array as $data) {
        $oArticle = oxNew("oxarticle");
        $oArticle->assign($data);
        $articleList[] = $oArticle;
        //$articles->add($oArticle); // With add when 50 limit added 15 count , more than 70 not added get false
    }

    return $articleList; // this articleList not assign more than 80 items , but in $array from getAll i have more 200 for example