Skip to main content

Display invoice at checkout end

More
10 years 8 months ago #226475 by tegadmin
Hello,

I am using "Credit Card" as my payment. I am unable to make the thank you page change.
I have added into: /plugins/hikashoppayment/creditcard/creditcard_end.php
I have also tried the same code in: Display -> views -> checkout | after_end (yes under my templates theme)
Code:
<?php /** * @package HikaShop for Joomla! * @version 2.6.0 * @author hikashop.com * @copyright (C) 2010-2015 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><div class="hikashop_creditcard_end" id="hikashop_creditcard_end"> <span class="hikashop_creditcard_end_message" id="hikashop_creditcard_end_message"> <?php echo JText::_('ORDER_IS_COMPLETE').'<br/>'. $this->information.'<br/>'. JText::_('THANK_YOU_FOR_PURCHASE'); $order_id = $app->getUserState('com_hikashop.order_id'); $orderClass = hikashop_get('class.order'); $this->order = $orderClass->loadFullOrder($order_id); $app->redirect('www.smalltiresandwheels.com/hikashop-menu-for-user-control-panel/order/show/cid-'.($order_id));?> </span> </div> <?php if(!empty($this->payment_params->return_url)){ $doc = JFactory::getDocument(); $doc->addScriptDeclaration("window.hikashop.ready( function() {window.location='".$this->payment_params->return_url."'});"); }

Any ideas what I am doing wrong?

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

More
10 years 8 months ago #226548 by cgt
Replied by cgt on topic Display invoice at checkout end
Hello.

The <div> and <span> sections with "class=hikashop_creditcard_end" have been added by you ? If yes, can you try without these tags ?

Regards

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

More
10 years 8 months ago #226549 by tegadmin
The only thing I added was:
Code:
$order_id = $app->getUserState('com_hikashop.order_id'); $orderClass = hikashop_get('class.order'); $this->order = $orderClass->loadFullOrder($order_id); $app->redirect('www.smalltiresandwheels.com/hikashop-menu-for-user-control-panel/order/show/cid-'.($order_id));?>

The span and div were already in there when I opened the file. But I can try to remove them.

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

More
10 years 8 months ago #226564 by Jerome
Hi,

And what result do you have ?

For what i can see in your code ; you're using "$app" which is an undefined variable.
So it can't work and it will generate a PHP fatal error.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
8 years 9 months ago #284465 by Lisitsa
I am using "Purchase order" as my payment.
I need redirect after checkout page - to show this order details.

So in the file /plugins/hikashoppayment/purchaseorder/purchaseorder_end.php

i added some code from this issue:
Code:
<?php /** * @package HikaShop for Joomla! * @version 3.2.0 * @author hikashop.com * @copyright (C) 2010-2017 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><div class="hikashop_purchaseorder_end" id="hikashop_purchaseorder_end"> <span class="hikashop_purchaseorder_end_message" id="hikashop_purchaseorder_end_message"> <?php echo JText::_('ORDER_IS_COMPLETE').'<br/>'. $this->information.'<br/>'. JText::_('THANK_YOU_FOR_PURCHASE'); $app = JFactory::getApplication(); $user = JFactory::getUser(); $order_id = $app->getUserState('com_hikashop.order_id'); $orderClass = hikashop_get('class.order'); $this->order->order_id = $orderClass->loadFullOrder($order_id); $app->redirect(hikashop_completeLink('order&task=show&cid='.$order_id)); ?> </span> </div> <?php if(!empty($this->payment_params->return_url)){ $doc = JFactory::getDocument(); $doc->addScriptDeclaration("window.hikashop.ready( function() {window.location='".$this->payment_params->return_url."'});"); }

But it dont work. Its redirect me to the order, but with previous ID.. not to the last order page. Its create new order in the list with all orders... but my last order remains to lay in the basket ....

Where I have the mistake?

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

More
8 years 9 months ago #284468 by nicolas
Hi,

Since HikaShop 3.0.0, you can't use $app->getUserState('com_hikashop.order_id') to get the id of the order in the end file of the payment plugins.
However, you now have access to it directly in $this->order->order_id
So you can simply the code:
Code:
$app = JFactory::getApplication(); $user = JFactory::getUser(); $order_id = $app->getUserState('com_hikashop.order_id'); $orderClass = hikashop_get('class.order'); $this->order->order_id = $orderClass->loadFullOrder($order_id); $app->redirect(hikashop_completeLink('order&task=show&cid='.$order_id));
to just:
Code:
$app = JFactory::getApplication(); $app->redirect(hikashop_completeLink('order&task=show&cid='.$this->order->order_id));

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

More
8 years 9 months ago #284521 by Lisitsa
Thank you for you answer, i changed my code , but now i have the next error:

Warning: Invalid argument supplied for foreach() in E:\*****\administrator\components\com_hikashop\classes\cart.php on line 2121

My Hikashop is 3.2.0 version Business

Can you check please why it can be?
Code:
2112 public function updatePaymentCustom($cart_id, $payment_id, $custom_html) { 2113 $cart = $this->getFullCart($cart_id); 2114 if($cart === false) 2115 return false; 2116 if($cart->payment->payment_id != $payment_id) 2117 return false; 2118 2119 $cart_id = $cart->cart_id; 2120 self::$cache['full'][$cart_id]->payment->custom_html = $custom_html; 2121 foreach(self::$cache['full'][$cart_id]->usable_methods_payment as &$p) { 2122 if($p->payment_id != $payment_id) 2123 continue; 2124 $p->custom_html = $custom_html; 2125 } 2126 unset($p); 2127 2128 return true; 2129 }

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

More
8 years 9 months ago #284522 by nicolas
Hi,

Replace the text "usable_methods_payment" by "usable_methods->payment" and it should work properly.

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

More
8 years 9 months ago #284553 by Lisitsa
Hi!

Thank you, it helped with previous error "Warning: Invalid argument supplied for foreach()... " but its still didnt get the ID of the current order...
Now this part of code
Code:
$app = JFactory::getApplication(); $app->redirect(hikashop_completeLink('order&task=show&cid='.$this->order->order_id));

redirect me to the page with all orders because i got the link like this view:
http://localhost/e-post/checkout/order/show/cid-

without ID at the end

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

More
8 years 9 months ago #284554 by nicolas
Hi,

I've had a closer look and the purchaseorder, unlike other payment plugins, is missing the line:
parent::onAfterOrderConfirm($order, $methods, $method_id);
after the line:
public function onAfterOrderConfirm(&$order, &$methods, $method_id) {
in the file plugins/hikashoppayment/purchaseorder/purchaseorder.php
That's why $this->order is missing there which should normally not be the case.
We'll add that on our end to the next version.

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

More
8 years 9 months ago #284650 by Lisitsa
Hi, Nicolas! Thank you so much!

Its helped!! And after checkout finish page - user redirected to the current order page.
But there is one more moment. After that the basket does not become empty. I got new order and right redirecting, but full basket.
As if the basket does not fix the last order.

Please check, I will be very grateful.

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

More
8 years 9 months ago #284652 by nicolas
Hi,

Then make sure that you have the "clean cart after order is" setting set to "created" in the HikaShop configuration.

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

More
8 years 9 months ago #284725 by Lisitsa
Hi!

Yes, in my settings everything is correct (added in the attachment).

The fact is that when I remove the redirecting code
Code:
$app = JFactory::getApplication(); $app->redirect(hikashop_completeLink('order&task=show&cid='.$this->order->order_id));

from the file /plugins/hikashoppayment/purchaseorder/purchaseorder_end.php

all begin work correctly, and basket become empty after checkout finish step.

Please check where can be mistake.

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

More
8 years 9 months ago - 8 years 9 months ago #284747 by Mohamed Thelji
Hello,

In that case, using that kind of code just before the redirection code will probably do the job :
Code:
// cleaning cart from session $cartClass = hikashop_get('class.cart'); $cartClass->cleanCartFromSession(false,true);
Last edit: 8 years 9 months ago by Mohamed Thelji.

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

More
8 years 9 months ago #284796 by Lisitsa
Hi!

Mohamed, thank you! Yes, it work!

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

Time to create page: 0.315 seconds
Powered by Kunena Forum