Add this snippet on the account_upgrade.html page and all other pages containing PayPal or 2Checkout buttons or Authorize.NET image with a link. 

 

<script>

function SK__Billing__InjectUserName( )

{

  var user_name_found = false;

  if ( window.location.href.indexOf( "/Admin/" ) != -1 ) { return; }

  // Check if there's a "user_name" in the input parameters

  var params = document.location.search;

  if ( params == "" ) {

     document.location.href = document.location.href.substring( 0, document.location.href.lastIndexOf( "/" ) ) + "/index.html";

     return;

  }

  params = params.substring( 1 );

  var pairs = params.split( "&" );

  for ( var i = 0; i < pairs.length; i++ ) {

     var param = pairs[ i ].split( "=" );

     if ( param.length == 2 ) {

        param[ 1 ] = param[ 1 ].replace(/^\s*/, "");

        param[ 1 ] = param[ 1 ].replace(/\s*$/, "");

        if ( param[ 0 ] == "user_name" && param[ 1 ] != "" ) {

           user_name_found = true;

           // Find all forms for 2CO and PayPal and inject the user_name value inside

           var forms = document.getElementsByTagName( 'form' );

           for ( var j = 0; j < forms.length; j++ ) {

              if ( forms[ j ].action && forms[ j ].action.toLowerCase().indexOf( "2checkout.com" ) != -1 ) {

                 var hidden_field = document.createElement( 'input' );

                 hidden_field.setAttribute( 'type', 'hidden' );

                 hidden_field.setAttribute( 'name', 'merchant_order_id' );

                 hidden_field.setAttribute( 'value', param[ 1 ] );

                 forms[ j ].appendChild( hidden_field );

              }

              if ( forms[ j ].action && forms[ j ].action.toLowerCase().indexOf( "paypal.com" ) != -1 ) {

                 var package_code = forms[ j ].elements[ 'item_number' ] ? forms[ j ].elements[ 'item_number' ].value : '';

                 if ( package_code == '' ) {

                    forms[ j ].onsubmit = function( ) { return false; };

                 }
                 if ( forms[ j ].elements[ 'item_name' ] ) {
                    forms[ j ].elements[ 'item_name' ].parentNode.removeChild( forms[ j ].elements[ 'item_name' ] );
                 }

                 var hidden_field = document.createElement( 'input' );

                 hidden_field.setAttribute( 'type', 'hidden' );
                 hidden_field.setAttribute( 'name', 'item_name' );
                 hidden_field.setAttribute( 'value', param[ 1 ] + '/' + package_code );
                 forms[ j ].appendChild( hidden_field );
              }

           }

        }

     }

  }

  if ( !user_name_found ) {

     document.location.href = document.location.href.substring( 0, document.location.href.lastIndexOf( "/" ) ) + "/index.html";

     return;

  }

}

$( window ).addEvent( 'domready', function() {  SK__Billing__InjectUserName(); } );

</script>


<script>

function SK__Billing__UpdateCCBillingURL() {

var login = "";

var reload_parent = "";

var s = "";

if ( document.location.search ) {

   var q = document.location.search.substring( 1 );

   q.split( '&' ).each(function(p) {

      p.split( '=' ).each(function(nv, index, array) {

         if ( index == 0 && nv == 'user_name' ) {

            login = array[ 1 ];

         }

         if ( index == 0 && nv == 'reload_parent' ) {

            reload_parent = array[ 1 ];

         }

         if ( index == 0 && nv == 's' ) {

            s = array[ 1 ];

         }

      });

       

   });

   $$( 'a' ).each(function(a){

      if ( a.get( 'href' ) && a.get( 'href' ).indexOf( "cc_billing.html" ) != -1 ) {

         a.set( 'href', a.get( 'href' ) + '&login=' + login  + '&reload_parent=' + reload_parent + '&s=' + s );

         a.set( 'target', '_self' );

      }

   });

}

}


$( window ).addEvent( 'domready', function() {  SK__Billing__UpdateCCBillingURL() } );

</script>