Payment plugin write to log is not working

  • Posts: 98
  • Thank you received: 7
  • Hikashop Business
10 months 4 weeks ago #354483

-- HikaShop version -- : 4.7.5
-- Joomla version -- : latest 4
-- PHP version -- : 8.1



Hi

I developed a payment plugin for payever based on your example. Since moving to J4 the Payment Log will not updated anymore based on your example

if($this->payment_params->debug) //Debug mode activated or not
		{
			//Here we display debug information which will be catched by HikaShop and stored in the payment log file available in the configuration's Files section.
			echo print_r($vars,true)."\n\n\n";
			echo print_r($dbOrder,true)."\n\n\n";
			echo print_r($hash,true)."\n\n\n";
		}

I checked the paypal plugins and saw that you worked now with
hikashop_writeToLog('paypal_id missing !');

but just this statement in my plugin is not working.
hikashop_writeToLog("test");

Anything additonally needed to instantiate this function ?
Thanks and best regards
Markus

Please Log in or Create an account to join the conversation.

  • Posts: 82019
  • Thank you received: 13184
  • MODERATOR
10 months 3 weeks ago #354489

Hi,

print_r will still work fine. However, the problem with that is that the process needs to go successfully to the end so that the data displayed in the output is stored in the log by HikaShop. If you have something like this:

echo print_r($vars,true);
call_function_which_does_not_exists();
return;
you won't get anything in the payment log file, because PHP will generate a fatal error when trying to call call_function_which_does_not_exists, before HikaShop can log the output.

That's why we now usually use hikashop_writeToLog. This function will directly log the data provided, without waiting for anything.
If you have the line hikashop_writeToLog('test'); somewhere and you don't see anything in the payment log file, it means that your code is not being processed. The most probable is that the notification URL is not being called by the payment gateway for some reason.

Please Log in or Create an account to join the conversation.

  • Posts: 98
  • Thank you received: 7
  • Hikashop Business
10 months 3 weeks ago #354609

Hi Nicolas,

thanks. Let me test it with hikashop_writeToLog('test'); . A first test in the beginning of onPaymentNotification(&$statuses) worked. Thanks for your help

Related question. To activate the php log my hosting provider requires that I put the php.ini into the related folders. But neither in the Plugins folders nor in the hikahsop folders this triggered a proper logging. The php-logs remains empty. Any idea ?

thanks and best regards
Markus

Please Log in or Create an account to join the conversation.

  • Posts: 82019
  • Thank you received: 13184
  • MODERATOR
10 months 3 weeks ago #354612

Hi,

I'm not sure. What does "related folders" means for your hosting ?
If it's "the folder where the main PHP file being called is located", then you should put the php.ini file at the root of the website since the main PHP file being called is the index.php of Joomla for the frontend.

Please Log in or Create an account to join the conversation.

  • Posts: 98
  • Thank you received: 7
  • Hikashop Business
10 months 2 weeks ago #354722

Hi Nicolas,

that worked. I tried the Plugins and also the error is fixed.

Thanks and best regards
Markus

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.143 seconds
Powered by Kunena Forum