oc-content/plugins/favorite_items/functions.php
// SHOW LISTINGS FROM CURRENTLY ACTIVE FAVORITE LIST
SHOW LISTINGS FROM CURRENTLY ACTIVE FAVORITE LIST
SHOW LISTINGS FROM CURRENTLY ACTIVE FAVORITE LIST
function fi_list_items( $list_id = NULL ) {
  if(osc_is_web_user_logged_in()) {
    $user_id = osc_logged_user_id();
  } else {
    $user_id = mb_get_cookie('fi_user_id');
  }
  if($list_id == '' or $list_id <= 0) {
    $list = ModelFI::newInstance()->getCurrentFavoriteListByUserId( $user_id );
  } else {
    $list = ModelFI::newInstance()->getFavoriteListById( $list_id );
  }
  if(isset($list['list_id'])) {
    $iSearch = new Search();
    $iSearch->addConditions(sprintf("%st_favorite_items.list_id = %d", DB_TABLE_PREFIX, $list['list_id']));
    $iSearch->addConditions(sprintf("%st_favorite_items.item_id = %st_item.pk_i_id", DB_TABLE_PREFIX, DB_TABLE_PREFIX));
    $iSearch->addTable(sprintf("%st_favorite_items", DB_TABLE_PREFIX));
    $list_items = $iSearch->doSearch();
  }
  GLOBAL $fi_global_items;
  $fi_global_items = View::newInstance()->_get('items') ;                 
  View::newInstance()->_exportVariableToView('items', $list_items);    
  require_once 'user/list_items.php';
  GLOBAL $fi_global_items;                                                
  View::newInstance()->_exportVariableToView('items', $fi_global_items);  
}
function fi_list_items ( $ list_id = NULL ) { if ( osc_is_web_user_logged_in ( ) ) { $ user_id = osc_logged_user_id ( ) ; } else { $ user_id = mb_get_cookie ( 'fi_user_id' ) ; } if ( $ list_id == '' or $ list_id <= 0 ) { $ list = ModelFI :: newInstance ( ) -> getCurrentFavoriteListByUserId ( $ user_id ) ; } else { $ list = ModelFI :: newInstance ( ) -> getFavoriteListById ( $ list_id ) ; } if ( isset ( $ list [ 'list_id' ] ) ) { $ iSearch = new Search ( ) ; $ iSearch -> addConditions ( sprintf ( " %st_favorite_items.list_id = %d " , DB_TABLE_PREFIX , $ list [ 'list_id' ] ) ) ; $ iSearch -> addConditions ( sprintf ( " %st_favorite_items.item_id = %st_item.pk_i_id " , DB_TABLE_PREFIX , DB_TABLE_PREFIX ) ) ; $ iSearch -> addTable ( sprintf ( " %st_favorite_items " , DB_TABLE_PREFIX ) ) ; $ list_items = $ iSearch -> doSearch ( ) ; } GLOBAL $ fi_global_items ; $ fi_global_items = View :: newInstance ( ) -> _get ( 'items' ) ; View :: newInstance ( ) -> _exportVariableToView ( 'items' , $ list_items ) ; require_once 'user/list_items.php' ; GLOBAL $ fi_global_items ; View :: newInstance ( ) -> _exportVariableToView ( 'items' , $ fi_global_items ) ; }
SHOW LISTINGS FROM CURRENTLY ACTIVE FAVORITE LIST
SHOW LISTINGS FROM CURRENTLY ACTIVE FAVORITE LIST
// SEARCH ITEMS IN LIST AND CREATE ITEM ARRAY // EXPORT FAVORITE ITEMS TO VARIABLE //save existing item array //exporting our searched item array //calling stored item array //restore original item array