Need some help with a payment plugin.
13 years 11 months ago #69608
by jansuhr
Jan Suhr
www.colorconsult.se www.jansuhr.se
Replied by jansuhr on topic Re: Need some help with a payment plugin.
When checking out ant going to the payment gateway this error pops up first in the list:
Notice: Trying to get property of non-object in /mydomain/components/com_hikashop/controllers/checkout.php on line 1284
Line 1284 in the checkout.php looks like this:
$app->setUserState( HIKASHOP_COMPONENT.'.order_id',$order->order_id);
I guess that the order_id is lost in some way.
What can be wrong?
Jan
Notice: Trying to get property of non-object in /mydomain/components/com_hikashop/controllers/checkout.php on line 1284
Line 1284 in the checkout.php looks like this:
$app->setUserState( HIKASHOP_COMPONENT.'.order_id',$order->order_id);
I guess that the order_id is lost in some way.
What can be wrong?
Jan
Jan Suhr
www.colorconsult.se www.jansuhr.se
Please Log in or Create an account to join the conversation.
13 years 11 months ago #69741
by nicolas
Replied by nicolas on topic Re: Need some help with a payment plugin.
The warnings on the checkout means that the $order object is emptied when the order is saved. I would say that you have something in an onAfterOrderUpdate function in your plugin or somewhere else which messes with that.
Please Log in or Create an account to join the conversation.
13 years 11 months ago - 13 years 11 months ago #69802
by jansuhr
Jan Suhr
www.colorconsult.se www.jansuhr.se
Replied by jansuhr on topic Re: Need some help with a payment plugin.
Thanks Nicolas,
I found the code that created this problem. What made it difficult was that it sort of depended on the session. As long as I was in my session it would go to the gateway, but changing browser and then getting a new session broke it up.
I had some stuff in the _end.php file that created the problem, removed it and now it works again.
So now I have a minor problem with the confirmation emails.
I have this code:
It seems that it doesn't pick up the ($data->order_status=="confirmed")
The other variables work. It selects on the ($data->order_payment_method=="auriga") and echo $payment->payment_description; works.
What have I missed??
Jan
I found the code that created this problem. What made it difficult was that it sort of depended on the session. As long as I was in my session it would go to the gateway, but changing browser and then getting a new session broke it up.
I had some stuff in the _end.php file that created the problem, removed it and now it works again.
So now I have a minor problem with the confirmation emails.
I have this code:
Code:
if($data->order_payment_method=="auriga"){
$paymentClass = hikashop::get('class.payment');
payment = $paymentClass->get($data->order_payment_id);
if($data->order_status=="confirmed"){
echo "Payment approved";
}
else
{
echo "Payment wasn't approved";
echo "<br/><br/>";
echo $payment->payment_description;
}
}
It seems that it doesn't pick up the ($data->order_status=="confirmed")
The other variables work. It selects on the ($data->order_payment_method=="auriga") and echo $payment->payment_description; works.
What have I missed??
Jan
Jan Suhr
www.colorconsult.se www.jansuhr.se
Last edit: 13 years 11 months ago by jansuhr.
Please Log in or Create an account to join the conversation.
13 years 11 months ago #69850
by jansuhr
Jan Suhr
www.colorconsult.se www.jansuhr.se
Replied by jansuhr on topic Re: Need some help with a payment plugin.
If I put in a var_dump($data) in the code I get two instances of "order_status" first one that says ["order_status"]=> string(7) "created" and that is then the one my code reacts to. Then later in the var_dump there is another "order_status" ["order_status"]=> string(9) "confirmed"
This is the same, no matter on how the order_status has been in the system.
So how and where do i pick up the saved order_status from the order?
Thanks
Jan
This is the same, no matter on how the order_status has been in the system.
So how and where do i pick up the saved order_status from the order?
Thanks
Jan
Jan Suhr
www.colorconsult.se www.jansuhr.se
Please Log in or Create an account to join the conversation.
13 years 11 months ago #70027
by nicolas
Replied by nicolas on topic Re: Need some help with a payment plugin.
I suppose that you're editing the order status notification email. Near the beginning of the email, the whole order is reloaded.
That's probably why you don't have the same info in $data at the beginning and at the end of the email.
Just put your code after the loading of the $data variable and that should be ok.
That's probably why you don't have the same info in $data at the beginning and at the end of the email.
Just put your code after the loading of the $data variable and that should be ok.
Please Log in or Create an account to join the conversation.
13 years 11 months ago #70058
by jansuhr
Jan Suhr
www.colorconsult.se www.jansuhr.se
Replied by jansuhr on topic Re: Need some help with a payment plugin.
Sorry that I wasn't more specified.
No it is the order_creation_notification.html.modified.php file I'm fiddeling with this.
This starts at line 279:
I want the customer to be informed in the email if the payment were accepted or not.
Thanks
Jan
No it is the order_creation_notification.html.modified.php file I'm fiddeling with this.
This starts at line 279:
Code:
<?php
JPluginHelper::importPlugin('hikashop');
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onAfterOrderProductsListingDisplay', array(&$data->cart, 'email_notification_html'));
?>
<tr>
<td>
<?php
if(!$app->isAdmin()){
// echo JText::_('ORDER_VALID_AFTER_PAYMENT');
$config =& hikashop_config();
if($data->cart->full_total->prices[0]->price_value_with_tax>0 && hikashop_level(1) && $config->get('allow_payment_button',1)){
global $Itemid;
$url = '';
if(!empty($Itemid)){
$url='&Itemid='.$Itemid;
}
$pay_url = hikashop_frontendLink('index.php?option=com_hikashop&ctrl=order&task=pay&order_id='.$data->order_id.$url);
if($config->get('force_ssl',0) && strpos('https://',$pay_url) === false) {
$pay_url = str_replace('http://','https://',$pay_url);
} ?>
<a href="$pay_url"><?php JText::_('PAY_NOW'); ?></a>
<?php } ?>
<br/>
<br/>
<?php
if($data->order_payment_method=="auriga"){
$paymentClass = hikashop::get('class.payment');
$payment = $paymentClass->get($data->order_payment_id);
if($data->order_status=="confirmed"){
echo "Din order blev godkänd";
}
else
{
echo "Din order blev inte godkänd";
echo "<br/>bank information";
echo "<br/>";
echo $payment->payment_description;
}
}
else
{
$paymentClass = hikashop::get('class.payment');
$payment = $paymentClass->get($data->order_payment_id);
echo "<br/><br/>";
// echo $payment->payment_name;
echo "<br/>";
echo $payment->payment_description;
echo "<br/><br/>";
}
echo JText::sprintf('THANK_YOU_FOR_YOUR_ORDER',HIKASHOP_LIVE);
}
?>
<br/>
<br/>
<?php echo JText::sprintf('BEST_REGARDS_CUSTOMER',$mail->from_name);?>
</td>
I want the customer to be informed in the email if the payment were accepted or not.
Thanks
Jan
Jan Suhr
www.colorconsult.se www.jansuhr.se
Please Log in or Create an account to join the conversation.
13 years 11 months ago #70182
by nicolas
Replied by nicolas on topic Re: Need some help with a payment plugin.
The order creation notification is sent to the user when the order is created, before being redirected to the payment gateway.
The order status notification is sent to the user when the order is confirmed. I guess that you're not editing the correct email which is why it's not working like you want.
The order status notification is sent to the user when the order is confirmed. I guess that you're not editing the correct email which is why it's not working like you want.
Please Log in or Create an account to join the conversation.
13 years 11 months ago #70185
by jansuhr
Jan Suhr
www.colorconsult.se www.jansuhr.se
Replied by jansuhr on topic Re: Need some help with a payment plugin.
Ok, that makes sense.
And that mean that I have to have some code in the onPaymentNotification function that triggers the sending of that email, right?
Jan
And that mean that I have to have some code in the onPaymentNotification function that triggers the sending of that email, right?
Jan
Jan Suhr
www.colorconsult.se www.jansuhr.se
Please Log in or Create an account to join the conversation.
13 years 11 months ago #70258
by nicolas
Replied by nicolas on topic Re: Need some help with a payment plugin.
No. The order status notification is sent automatically when the order is confirmed provided that you have:
$order->history->history_notified=1;
like it is in the PayPal plugin's onPaymentNotification function when the order is confirmed.
$order->history->history_notified=1;
like it is in the PayPal plugin's onPaymentNotification function when the order is confirmed.
Please Log in or Create an account to join the conversation.
Time to create page: 0.236 seconds