The best solution is imho the one above and this

`if(empty($limit)){`

if(!empty($category->limit_list_initial)){

$suglimit = $category->limit_list_initial;

} else {

if(empty($category->limit_list_step)){

$suglimit = VmConfig::get ('list_limit', 20);

} else {

$suglimit = $category->limit_list_step;

}

}

if(empty($category->products_per_row)){

$category->products_per_row = VmConfig::get ('products_per_row', 3);

}

$rest = $suglimit%$category->products_per_row;

$limit = $suglimit - $rest;

}