'affil', 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), 'EventHandlerClass' => Array ('class' => 'AffiliatesEventHandler', 'file' => 'affiliates_event_handler.php', 'build_event' => 'OnBuild'), 'TagProcessorClass' => Array ('class' => 'AffiliatesTagProcessor', 'file' => 'affiliates_tag_processor.php', 'build_event' => 'OnBuild'), 'AutoLoad' => true, 'Hooks' => Array ( Array ( 'Mode' => hAFTER, 'Conditional' => false, 'HookToPrefix' => 'u', 'HookToSpecial' => 'register', 'HookToEvent' => Array ('OnBeforeItemCreate', 'OnBeforeItemUpdate'), 'DoPrefix' => '', 'DoSpecial' => 'register', 'DoEvent' => 'OnValidateAffiliate', ), Array ( 'Mode' => hAFTER, 'Conditional' => false, 'HookToPrefix' => 'u', 'HookToSpecial' => 'register', 'HookToEvent' => Array ('OnCreate'), 'DoPrefix' => '', 'DoSpecial' => 'register', 'DoEvent' => 'OnRegisterAffiliate', ), Array ( 'Mode' => hAFTER, 'Conditional' => false, 'HookToPrefix' => 'adm', 'HookToSpecial' => '', 'HookToEvent' => Array ('OnStartup'), 'DoPrefix' => '', 'DoSpecial' => '', 'DoEvent' => 'OnResetStatistics', ), Array ( 'Mode' => hAFTER, 'Conditional' => false, 'HookToPrefix' => 'adm', 'HookToSpecial' => '', 'HookToEvent' => Array ('OnStartup'), 'DoPrefix' => '', 'DoSpecial' => '', 'DoEvent' => 'OnStoreAffiliate', ), ), 'AggregateTags' => Array ( Array ( 'AggregateTo' => 'u', 'AggregatedTagName' => 'IsAffiliate', 'LocalTagName' => 'User_IsAffiliate', ), Array ( 'AggregateTo' => 'u', 'AggregatedTagName' => 'AffiliateIsActive', 'LocalTagName' => 'User_AffiliateIsActive', ), Array ( 'AggregateTo' => 'u', 'AggregatedTagName' => 'AffiliateField', 'LocalTagName' => 'CurrentUserAffiliateField', ), Array ( 'AggregateTo' => 'u', 'AggregatedTagName' => 'IsAffiliateOrRegisterAsAffiliateAllowed', 'LocalTagName' => 'IsAffiliateOrRegisterAsAffiliateAllowed', ), Array ( 'AggregateTo' => 'm', 'AggregatedTagName' => 'RequireAffiliate', 'LocalTagName' => 'Main_RequireAffiliate', ), Array ( 'AggregateTo' => 'm', 'AggregatedTagName' => 'AllowAffiliateRegistration', 'LocalTagName' => 'AllowAffiliateRegistration', ), ), 'QueryString' => Array ( 1 => 'id', 2 => 'Page', 3 => 'PerPage', 4 => 'event', 5 => 'mode', ), 'IDField' => 'AffiliateId', 'StatusField' => Array ('Status'), // field, that is affected by Approve/Decline events 'TitleField' => 'UserName', 'TitlePresets' => Array ( 'default' => Array ( 'new_status_labels' => Array ('affil' => '!la_title_Adding_Affiliate!'), 'edit_status_labels' => Array ('affil' => '!la_title_Editing_Affiliate!'), 'new_titlefield' => Array ('affil' => '!la_title_New_Affiliate!'), ), 'affiliates_list' => Array ('prefixes' => Array ('affil_List'), 'format' => "!la_title_Affiliates!"), 'affiliates_edit' => Array ('prefixes' => Array ('affil'), 'format' => "#affil_status# '#affil_titlefield#' - !la_title_General!"), 'affiliate_payments' => Array ('prefixes' => Array ('affil', 'apayments_List'), 'format' => "#affil_status# '#affil_titlefield#' - !la_title_Payments!"), 'affiliates_payout' => Array ('prefixes' => Array ('affil', 'apayments'), 'format' => "!la_title_PayOut_To! '#affil_titlefield#'"), ), 'Forms' => Array ( 'registration' => Array ( 'VirtualFields' => Array ( 'TermsAccepted' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'error_msgs' => Array ('required' => '!lu_comm_MustAgreeAffiliateTermsError!'), 'required' => 1, 'default' => NULL, ), ) ), ), 'EditTabPresets' => Array ( 'Default' => Array ( 'general' => Array ('title' => 'la_tab_General', 't' => 'in-commerce/affiliate_plans/affiliates_edit', 'priority' => 1), 'payments' => Array ('title' => 'la_tab_Payments', 't' => 'in-commerce/affiliate_plans/affiliate_edit_payments', 'priority' => 2), ), ), 'PermSection' => Array ('main' => 'in-commerce:affiliates'), 'Sections' => Array ( 'in-commerce:affiliates_folder' => Array ( 'parent' => 'in-commerce', 'icon' => 'affiliates', 'label' => 'la_tab_Affiliates', 'use_parent_header' => 1, 'permissions' => Array (), 'priority' => 5, 'type' => stTREE, ), 'in-commerce:affiliates' => Array ( 'parent' => 'in-commerce:affiliates_folder', 'icon' => 'affiliates', 'label' => 'la_tab_Affiliates', 'url' => Array ('t' => 'in-commerce/affiliate_plans/affiliates_list', 'pass' => 'm'), 'permissions' => Array ('view', 'add', 'edit', 'delete', 'advanced:approve', 'advanced:decline'), 'priority' => 5.1, // ., because this section replaces parent in tree 'type' => stTAB, ), ), 'TableName' => TABLE_PREFIX.'Affiliates', 'CalculatedFields' => Array ( '' => Array ( 'UserId' => 'u.PortalUserId', 'UserName' => 'IF(u.Username = "", u.Email, u.Username)', 'PlanName' => 'ap.Name', ), ), 'ListSQLs' => Array ( '' => ' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.PortalUserId = u.PortalUserId LEFT JOIN '.TABLE_PREFIX.'AffiliatePlans ap ON %1$s.AffiliatePlanId = ap.AffiliatePlanId' ), 'SubItems' => Array ('apayments'), 'ListSortings' => Array ( '' => Array ( 'Sorting' => Array ('CreatedOn' => 'desc', 'UserName' => 'asc'), ) ), 'Fields' => Array ( 'AffiliateId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'PortalUserId' => Array ('type' => 'int', 'unique'=>Array (), 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!', 'unique' => '!la_affiliate_already_exists!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'required' => 1, 'default' => null), 'AffiliatePlanId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT Name, AffiliatePlanId FROM '.TABLE_PREFIX.'AffiliatePlans WHERE Enabled = 1 ORDER BY Name', 'option_key_field' => 'AffiliatePlanId', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 0), 'AccumulatedAmount' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%.02f', 'not_null' => '1', 'default' => '0.00'), 'AmountToPay' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%.02f', 'not_null' => '1', 'default' => '0.00'), 'LastPaymentDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL), 'LastOrderDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL), 'Status' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options'=>Array (1=>'la_Active', 2=>'la_Pending', 0=>'la_Disabled'), 'use_phrases'=>1, 'not_null' => '1', 'default' => STATUS_PENDING), 'AffiliateCode' => Array ('type' => 'string', 'not_null' => '1', 'default' => ''), 'ItemsSold' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'PaymentTypeId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => ''), 'options_sql' => 'SELECT Name, PaymentTypeId FROM '.TABLE_PREFIX.'AffiliatePaymentTypes WHERE Status = 1 ORDER BY IsPrimary DESC, Priority DESC, Name ASC', 'option_key_field' => 'PaymentTypeId', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 0), 'SSN' => Array ('type' => 'string', 'not_null' => '1', 'default' => '', 'required' => 1), 'Comments' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL), 'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'), ), 'VirtualFields' => Array ( 'UserName' => Array ('type' => 'string', 'default' => ''), 'PlanName' => Array ('type' => 'string', 'default' => ''), 'UserId' => Array ('type' => 'int', 'default' => 0), ), 'Grids' => Array ( 'Default' => Array ( 'Icons' => Array ( 'default' => 'icon16_item.png', 0 => 'icon16_disabled.png', 1 => 'icon16_item.png', 2 => 'icon16_pending.png', 'module' => 'core', ), 'Fields' => Array ( 'AffiliateId' => Array ( 'title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ), 'UserName' => Array ( 'data_block' => 'grid_userlink_td', 'filter_block' => 'grid_like_filter'), 'PlanName' => Array ( 'title' => 'la_col_PlanName', 'filter_block' => 'grid_like_filter'), 'PaymentTypeId' => Array ( 'title' => 'column:la_fld_PaymentType', 'filter_block' => 'grid_options_filter', 'width' => 120, ), 'CreatedOn' => Array ( 'title' => 'column:la_fld_RegisteredOn', 'format' => '_regional_DateFormat', 'filter_block' => 'grid_date_range_filter', 'width' => 140, ), 'Status' => Array ( 'filter_block' => 'grid_options_filter', 'width' => 100, ), ), ), ), );