$creditCards = CRM_Financial_BAO_PaymentProcessor::getCreditCards($paymentProcessorID);
$creditCardTypes = CRM_Core_Payment_Form::getCreditCardCSSNames($creditCards);
CRM_Core_Resources::singleton()
- ->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', 10)
+ ->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', 10, 'html-header', FALSE)
// workaround for CRM-13634
// ->addSetting(array('config' => array('creditCardTypes' => $creditCardTypes)));
- ->addScript('CRM.config.creditCardTypes = ' . json_encode($creditCardTypes) . ';');
+ ->addScript('CRM.config.creditCardTypes = ' . json_encode($creditCardTypes) . ';', '-9999', 'html-header');
}
}
* Changes the icon depending on the credit card number.
* Removes spaces and dashes from credit card numbers.
*/
- function civicrm_billingblock_creditcard_helper() {
+ $(function civicrm_billingblock_creditcard_helper() {
$.each(CRM.config.creditCardTypes, function(key, val) {
var html = '<a href="#" title="' + val + '" class="crm-credit_card_type-icon-' + key + '"><span>' + val + '</span></a>';
$('.crm-credit_card_type-icons').append(html);
civicrm_billingblock_set_card_type(ccnumber);
});
- }
+ });
function civicrm_billingblock_set_card_type(ccnumber) {
// Based on http://davidwalsh.name/validate-credit-cards