; $commissions[] = $_row; } return $commissions; } /** * save commission * * @param array * @return bool */ function affp_saveCommission($_commission){ if(isset($_commission['Amount']))$_commission['Amount'] = round($_commission['Amount'], 2); if(!isset($_commission['cID'])) return false; $_cID = $_commission['cID']; unset($_commission['cID']); foreach ($_commission as $_ind=>$_val) $_commission[$_ind] = "`".xEscSQL($_ind)."`='".xEscSQL($_val)."'"; $sql = "UPDATE ".AFFILIATE_COMMISSIONS_TABLE." SET ".implode(", ", $_commission)." WHERE cID=".(int)$_cID; db_query($sql); return true; } /** * return commissions(earnings) for customer * @param integer - customer id * @return array */ function affp_getCommissionsAmount($_CustomerID){ $CurrencyAmount = array(); $sql = "select SUM(`Amount`) AS CurrencyAmount, CurrencyISO3 FROM `".AFFILIATE_COMMISSIONS_TABLE."` WHERE CustomerID = ".(int)$_CustomerID." GROUP BY `CurrencyISO3` "; $result = db_query($sql); while ($_row = db_fetch_row($result)){ $CurrencyAmount[$_row['CurrencyISO3']] = sprintf("%.2f", $_row['CurrencyAmount']); } return $CurrencyAmount; } /** * return payments to customer * @param integer - customer id * @return array */ function affp_getPaymentsAmount($_CustomerID){ $PaymentAmount = array(); $sql = "select SUM(`Amount`) AS CurrencyAmount, CurrencyISO3 FROM `".AFFILIATE_PAYMENTS_TABLE."` WHERE CustomerID = ".(int)$_CustomerID." GROUP BY `CurrencyISO3` "; $result = db_query($sql); while ($_row = db_fetch_row($result)){ $PaymentAmount[$_row['CurrencyISO3']] = sprintf("%.2f", $_row['CurrencyAmount']); } return $PaymentAmount; } /** * return settings for customer * @param integer - customer id * @return array */ function affp_getSettings($_CustomerID){ $Settings = array(); $sql = "select affiliateEmailOrders, affiliateEmailPayments FROM `".CUSTOMERS_TABLE."` WHERE customerID=".(int)$_CustomerID; list($Settings['EmailOrders'], $Settings['EmailPayments']) = db_fetch_row(db_query($sql)); return $Settings; } /** * save settings for customer * @param integer * @param integer */ function affp_saveSettings($_CustomerID, $_EmailOrders, $_EmailPayments){ $sql = "UPDATE `".CUSTOMERS_TABLE."` SET affiliateEmailOrders = '".(int)$_EmailOrders."', affiliateEmailPayments = '".(int)$_EmailPayments."' WHERE customerID=".(int)$_CustomerID; db_query($sql); } /** * get customer referer * @param integer - customer id * @return integer */ function affp_getReferer($_CustomerID){ $sql = "select affiliateID FROM `".CUSTOMERS_TABLE."` WHERE customerID=".(int)$_CustomerID; list($affiliateID) = db_fetch_row(db_query($sql)); return $affiliateID; } /** * Return array with commission information by order id * * @param integer $_OrderID * @return array */ function affp_getCommissionByOrder($_OrderID){ $sql = "select cID, customerID, Amount, CurrencyISO3, xDateTime, Description, CustomerID FROM ".AFFILIATE_COMMISSIONS_TABLE." WHERE OrderID=".(int)$_OrderID; $commission = db_fetch_row(db_query($sql)); if(!$commission['cID']) return $commission; $commission['CustomerLogin'] = regGetLoginById($commission['customerID']); $commission['Amount'] = sprintf("%.2f", $commission['Amount']); list($_t) = explode(' ', $commission['xDateTime']); $commission['xDateTime'] = TransformDATEToTemplate($_t); return $commission; } ?> ERROR: Couldn't find language file!