oc-content/plugins/favorite_items/index.php
// CHECK IF PRICE HAS CHANGED WHEN ITEM WAS EDITED
CHECK IF PRICE HAS CHANGED WHEN ITEM WAS EDITED
CHECK IF PRICE HAS CHANGED WHEN ITEM WAS EDITED
function fi_check_edit_price( $item ) {
  $item_id = isset($item['idItem']) ? $item['idItem'] : 0;
  $item_price_new = isset($item['price']) ? $item['price'] : '';
  $new_formatted_price = fi_price_format($item_price_new, isset($item['currency']) ? $item['currency'] : '');
  $old_item = Item::newInstance()->findByPrimaryKey( $item_id );
  $item_price_old = isset($old_item['i_price']) ? $old_item['i_price'] : 0;
  $old_formatted_price = fi_price_format($item_price_old, isset($old_item['fk_c_currency_code']) ? $old_item['fk_c_currency_code'] : '');
  if($item_price_old <> $item_price_new) {
    $user_list = ModelFI::newInstance()->getUserListByItemId( $item_id );     
    foreach($user_list as $u) {
      if(isset($u['user_email']) && isset($u['user_name'])) {
        fi_email_price_change($u['user_email'], $u['user_name'], $item_id, $old_formatted_price, $new_formatted_price);
      }
    }
  }
}
function fi_check_edit_price ( $ item ) { $ item_id = isset ( $ item [ 'idItem' ] ) ? $ item [ 'idItem' ] : 0 ; $ item_price_new = isset ( $ item [ 'price' ] ) ? $ item [ 'price' ] : '' ; $ new_formatted_price = fi_price_format ( $ item_price_new , isset ( $ item [ 'currency' ] ) ? $ item [ 'currency' ] : '' ) ; $ old_item = Item :: newInstance ( ) -> findByPrimaryKey ( $ item_id ) ; $ item_price_old = isset ( $ old_item [ 'i_price' ] ) ? $ old_item [ 'i_price' ] : 0 ; $ old_formatted_price = fi_price_format ( $ item_price_old , isset ( $ old_item [ 'fk_c_currency_code' ] ) ? $ old_item [ 'fk_c_currency_code' ] : '' ) ; if ( $ item_price_old <> $ item_price_new ) { $ user_list = ModelFI :: newInstance ( ) -> getUserListByItemId ( $ item_id ) ; foreach ( $ user_list as $ u ) { if ( isset ( $ u [ 'user_email' ] ) && isset ( $ u [ 'user_name' ] ) ) { fi_email_price_change ( $ u [ 'user_email' ] , $ u [ 'user_name' ] , $ item_id , $ old_formatted_price , $ new_formatted_price ) ; } } } }
CHECK IF PRICE HAS CHANGED WHEN ITEM WAS EDITED
CHECK IF PRICE HAS CHANGED WHEN ITEM WAS EDITED
// get all user emails that has this listing in favorite list // SEND EMAIL THAT PRICE HAS CHANGED