');
if (Am_Di::getInstance()->affCommissionRuleTable->hasCustomRules())
{
$gr->addStatic()->setContent(
___('Custom Commission Rules added') . ' ');
} else
{
$rule = Am_Di::getInstance()->affCommissionRuleTable->findFirstBy(array(
'type' => AffCommissionRule::TYPE_GLOBAL,
'tier' => 0));
$gr->addStatic()->setContent(___('First Payment (calculated for first payment in each invoice)') . ' ');
$first = $gr->addElement(new Am_Form_Element_AffCommissionSize('aff_comm[first]', null, 'first_payment'));
$gr->addStatic()->setContent(' ' . ___('Rebill') . ' ');
$second = $gr->addElement(new Am_Form_Element_AffCommissionSize('aff_comm[recurring]', null, 'recurring'));
$gr->addStatic()->setContent(
' ' . ___('or') . ' ');
if ($rule && !$this->isSubmitted())
{
$first->getElementById('first_payment_c-0')->setValue($rule->first_payment_c);
$first->getElementById('first_payment_t-0')->setValue($rule->first_payment_t);
$second->getElementById('recurring_c-0')->setValue($rule->recurring_c);
$second->getElementById('recurring_t-0')->setValue($rule->recurring_t);
}
}
$gr->addStatic()->setContent(
'
'
. ___('Edit Custom Commission Rules')
. ''
);
$gr->addStatic()->setContent('
');
$fs->addAdvCheckbox('aff.commission_include_tax')
->setLabel(___("Calculate Affiliate Commissions from Totals Including Tax\n" .
"by default commission calculated from amounts before tax"));
$fs->addElement('email_checkbox', 'aff.mail_sale_admin', null, array('help-id' => '#Setting_Up_Commission_Notification_Emails'))
->setLabel(___("E-Mail Commission to Admin"));
$fs->addElement('email_checkbox', 'aff.mail_sale_user', null, array('help-id' => '#Setting_Up_Commission_Notification_Emails'))
->setLabel(___('E-Mail Commission to Affiliate'));
$fs = $this->addFieldset()
->setLabel(___('Miscellaneous'));
$this->addAdvCheckbox('aff.affiliate_can_view_details', null, array('help-id' => '#Affiliate_Payout_Options'))
->setLabel(___("Affiliate Can View Sales Details\n" .
'Leave this checkbox unselected to restrict affiliates from seeing their sales details'));
$gr = $this->addGroup()
->setLabel(___("Allow Affiliates to redirect Referrers to any url"));
$gr->addSelect('aff.custom_redirect', array('id' => 'custom_redirect'))
->loadOptions(
array(
Bootstrap_Aff::AFF_CUSTOM_REDIRECT_DISABLED => ___('Disabled'),
Bootstrap_Aff::AFF_CUSTOM_REDIRECT_ALLOW_SOME_DENY_OTHERS => ___('Allow for some affiliates, disallow for others'),
Bootstrap_Aff::AFF_CUSTOM_REDIRECT_DENY_SOME_ALLOW_OTHERS => ___('Disallow for some affiliates, allow for others'),
));
$gr->addHtml()->setHtml('