I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Reply To: Bulding Table / execute shortcode in PHP

dashed-slug.net Forums Exchange extension support Bulding Table / execute shortcode in PHP Reply To: Bulding Table / execute shortcode in PHP

#9763
alexg
Keymaster

@LeinAd I understand now, thank you.

You would like to add a button to the deposit-list template, that displays deposit QR codes on a popup. What you are describing would require development, especially the part about popups.

If you are serious about this, start by copying over templates/deposit-list.php into your theme as described here. Then, you’d need to:
1. add a now column with the button
2. capture the button click event
3. create a popup somehow
4. in that popup, render the qr code

If you want to study the code that renders qr codes, it’s here: https://github.com/dashed-slug/wallets/blob/5.0.12/assets/scripts/wallets-ko.js#L286-L322

Essentially you want to render the qrcode_uri of each coin into your popup element. So, very roughly, something like:

$('.button','.dashed-slug-wallets.deposit-list' ).click(
	function() {

		var coin = self.selectedCryptoCoin();
		if ( 'object' == typeof( coins[ coin ] ) ) {

			// choose to render qrcode_uri if specified, or deposit address string otherwise
			var qrcode_uri = false;
			if ( 'string' == typeof( coins[ coin ].deposit_address_qrcode_uri ) ) {
				qrcode_uri = coins[ coin ].deposit_address_qrcode_uri;
			} else if ( 'string' == typeof( coins[ coin ].deposit_address ) ) {
				qrcode_uri = coins[ coin ].deposit_address;
			}
			
			// TODO create/display a popup somehow

			var $popup = $('#popup');
			$popup.qrcode( {
				width: $popup.width(),
				height: $popup.height(),
				text: qrcode_uri
			} );
		}
	}
);

I haven’t tested this, but hopefully you get the general idea. If you want to see the API docs for the qr code library, it’s here:

https://github.com/jeromeetienne/jquery-qrcode/

Hope this helps.

with regards