Display invoice at checkout end

  • Posts: 2
  • Thank you received: 0
8 years 3 months ago #226475

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)

<?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.

  • Posts: 11
  • Thank you received: 1
8 years 3 months ago #226548

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.

  • Posts: 2
  • Thank you received: 0
8 years 3 months ago #226549

The only thing I added was:

$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.

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
8 years 3 months ago #226564

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 14
  • Thank you received: 0
6 years 4 months ago #284465

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:

<?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.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
6 years 4 months ago #284468

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:

        $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:
        $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.

  • Posts: 14
  • Thank you received: 0
6 years 4 months ago #284521

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?

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.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
6 years 4 months ago #284522

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.

  • Posts: 14
  • Thank you received: 0
6 years 4 months ago #284553

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

 $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.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
6 years 4 months ago #284554

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.

  • Posts: 14
  • Thank you received: 0
6 years 4 months ago #284650

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.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
6 years 4 months ago #284652

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.

  • Posts: 14
  • Thank you received: 0
6 years 4 months ago #284725

Hi!

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

The fact is that when I remove the redirecting 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.

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
6 years 4 months ago #284747

Hello,

In that case, using that kind of code just before the redirection code will probably do the job :

// cleaning cart from session
$cartClass = hikashop_get('class.cart');
$cartClass->cleanCartFromSession(false,true);

Last edit: 6 years 4 months ago by Mohamed Thelji.

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

  • Posts: 14
  • Thank you received: 0
6 years 3 months ago #284796

Hi!

Mohamed, thank you! Yes, it work!

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

Time to create page: 0.113 seconds
Powered by Kunena Forum