I did that but nothing changed.
Here is the function code.
if( !function_exists('related_listings') ) {
function related_listings() {
View::newInstance()->_exportVariableToView('items', array());
$mSearch = new Search();
$mSearch->addCategory(osc_item_category_id());
$mSearch->addRegion(osc_item_region());
$mSearch->addItemConditions(sprintf("%st_item.pk_i_id < %s ", DB_TABLE_PREFIX, osc_item_id()));
$mSearch->limit('0', '4');
$aItems = $mSearch->doSearch();
$iTotalItems = count($aItems);
if( $iTotalItems == 4 ) {
View::newInstance()->_exportVariableToView('items', $aItems);
return $iTotalItems;
}
unset($mSearch);
$mSearch = new Search();
$mSearch->addCategory(osc_item_category_id());
$mSearch->addItemConditions(sprintf("%st_item.pk_i_id != %s ", DB_TABLE_PREFIX, osc_item_id()));
$mSearch->limit('0', '4');
$aItems = $mSearch->doSearch();
$iTotalItems = count($aItems);
if( $iTotalItems > 0 ) {
View::newInstance()->_exportVariableToView('items', $aItems);
return $iTotalItems;
}
unset($mSearch);
return 0;
}
}
That is why i was thinking that may be there is other function related to this one and is messing the things up.