The question is not simple.
It concerns the settings of the payment system in the online store woocommerce . The problem is this: the php variable (email address) is transferred to the script for some reason, encoded.
To get started, I get these email fields entered by the user. Using var_dump, I check that the variable contains correct information (email o4137889@nwytg.net ), but when the variable is passed inside the script
accountId: '<?=$order->billing_email?>'
I get this coded string in utf-8 accountId: 'o4137889@nwytg.net' ,
Moreover, it doesnβt matter whether it is output via abbreviated <?= ?> Or <?php ?> And echo
accountId: '<?php echo $billing_email ?>' ,
, through a variable or directly - the result is identical each time.
What can it be connected with and how to fix it?
global $woocommerce; $order = new WC_Order( $order_id ); var_dump($order->billing_email); //o4137889@nwytg.net <script src="https://widget.cloudpayments.ru/bundles/cloudpayments"></script> <script> var widget = new cp.CloudPayments(); widget.<?=$widget_f?>({ // options <!-- /////////////??????????????? --> publicId: '<?=$this->public_id?>', //id ΠΈΠ· Π»ΠΈΡΠ½ΠΎΠ³ΠΎ ΠΊΠ°Π±ΠΈΠ½Π΅ΡΠ° description: 'ΠΠΏΠ»Π°ΡΠ° Π·Π°ΠΊΠ°Π·Π° <?=$order_id?>', //Π½Π°Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ amount: <?=$order->get_total()?>, //ΡΡΠΌΠΌΠ° currency: '<?=$this->currency?>', //Π²Π°Π»ΡΡΠ° invoiceId: <?=$order_id?>, //Π½ΠΎΠΌΠ΅Ρ Π·Π°ΠΊΠ°Π·Π° accountId: '<?=$order->billing_email?>', //ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡ ΠΏΠ»Π°ΡΠ΅Π»ΡΡΠΈΠΊΠ° data: <?php echo (($this->kassa_enabled == 'yes') ? json_encode($kassa_array) : "{}") ?> }, function (options) { // success window.location.replace('<?=$this->get_return_url($order)?>'); }, function (reason, options) { // fail window.location.replace('<?=$order->get_cancel_order_url()?>'); } ); </script> The server is on unix managed by vesta cp with php version 7.2
<!DOCTYPE html> <html lang="ru-RU" prefix="og: http://ogp.me/ns#"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> </head>- Vasya$order_idcorrectly, for example, even$order_idwhere$order_idemail isinvoiceId: <?=$order_id?>, //Π½ΠΎΠΌΠ΅Ρ Π·Π°ΠΊΠ°Π·Π°- Vasyavar_dump($order);var_dump for billing_email is output like this string (18) βo4137889@nwytg.netβ, i.e. there, as it should be - 18 shows characters, not 78 as you might think - Vasya