Get db data under payment method

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #326702

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.4
-- Browser(s) name and version -- : FireFox

Hi

Let me see if I can can explain what I would like to do :-)

When a user orders an item and chooses a certain offline payment method, I would like that the emails sent to him has extra text added below the payment info - and also on the Thank you page.
This extra text has to be a link containing the order number and the total price.

Can I make it like this some way?

Regards
Thomas

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

  • Posts: 12953
  • Thank you received: 1778
3 years 11 months ago #326723

Hello Thomas,

If you wan to edit the "Thank you" page, the solution will be to directly edit the code of the "After_end" file of the "Checkout" view of your front-end template via "Hikashop->Display->Views".
For more information :
www.hikashop.com/support/documentation/1...-display.html#layout

Kind regards,
Mohamed.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #326744

Thank you ...

But I need to show something depending of the payment method that has been chosen - and that should be order number and total amount.

This I also need ind the emails sent to the customer.

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

  • Posts: 12953
  • Thank you received: 1778
3 years 11 months ago #326765

Hello,

Good, note that you'll find both of these informations through the following variable : "$this->order"

Kind regards,
Mohamed.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #326809

But where do I add this to get it to show, when I chose a certain payment method?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #326824

Hi,

You need to use a PHP condition.
For example:

if($this->order->order_payment_method=='paypal') {
 echo $this->order->order_number;
}
As said previously, if you want to add it at the end of the checkout on the default thank you page, you can edit the file "after_end" via the menu Display>Views.
Now of course, you'll have to adapt the code to the situation.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #326912

Thank you!

Are you sure about that file?

I tried that, but nothing appears after and order - I even tried a simple echo, with same result.

<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.0
* @author hikashop.com
* @copyright (C) 2010-2020 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );

if($this->order->order_payment_method=='mobilepay') {
echo $this->order->order_number;
}

if(!empty($this->url))
$app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$this->url));

$app = JFactory::getApplication();
$app->triggerEvent('onHikashopOrderTrackingDisplay', array($this->order));

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #326926

That's the default thank you page.
However, if you entered a URL in the "return URL" setting of your payment method, it will use that URL and not the default thank you page of HikaShop. In that case, I don't know exactly what you should do as I don't know how is made the URL you chose on your website.
Also, with some payment methods, where there is no redirection to the payment gateway for the payment at the end of the checkout, it's possible it is another view file.
The modification in the after_end view file is the most generic one, and thus what we first recommend to not confuse the merchants with too much information.
If you want a precise answer, I would need you to tell me which payment methods you're using and how you configured them.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #326985

Hi

I don't use any return URL, just the default thank you page.
I have set up the bank transfer plugin with these settings.

But I still can't get the page to show anything entered into the after_end file :-(

Regards
Thomas

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #327021

Hi,

The bank transfer payment method doesn't redirect to a payment gateway at the end of the checkout and thus it doesn't use the "after_end" view file which is used when the customer comes back from the payment gateway.
For the bank transfer payment plugin, it's the file plugins/hikashoppayment/banktransfer/banktransfer_end.php which is used.
The order number is available with $this->order_number and the order total with $this->amount in that file.
To override it, you should copy that file to templates/YOUR_TEMPLATE/hikashoppayment/banktransfer_end.php via FTP and modify that copy. That way, you won't loose your changes when you update HikaShop.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #327102

Hi

Makes sense!
And thanks, I'll make the override :-)

Regards
Thomas

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #327103

Weird ...
I can insert TEST! on the page, but when I copy the content to test, I don't see that?
The second

<div class="hikashop_banktransfer_end" id="hikashop_banktransfer_end">
	<span class="hikashop_banktransfer_end_message" id="hikashop_banktransfer_end_message">
		<?php echo JText::_('ORDER_IS_COMPLETE').'<br/>'.
		JText::sprintf('PLEASE_TRANSFERT_MONEY',$this->amount).'<br/>'.
		$this->information.'<br/>'.
		JText::sprintf('INCLUDE_ORDER_NUMBER_TO_TRANSFER',$this->order_number).'<br/>'.
		JText::_('THANK_YOU_FOR_PURCHASE');?>
	</span>
</div>
TEST! TEST!

<div class="hikashop_banktransfer_end" id="hikashop_banktransfer_end">
	<span class="hikashop_banktransfer_end_message" id="hikashop_banktransfer_end_message">
		<?php echo JText::_('ORDER_IS_COMPLETE').'<br/>'.
		JText::sprintf('PLEASE_TRANSFERT_MONEY',$this->amount).'<br/>'.
		$this->information.'<br/>'.
		JText::sprintf('INCLUDE_ORDER_NUMBER_TO_TRANSFER',$this->order_number).'<br/>'.
		JText::_('THANK_YOU_FOR_PURCHASE');?>
	</span>
</div>

Last edit: 3 years 11 months ago by nicolas.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #327114

Hi,

It could be because the HTML elements have the same ID which is not valid in HTML ?
www.w3schools.com/html/html_id.asp

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #327169

Hello

Seems to have been a cache issue, so I get what I want now :-)
Thanks!

Would it be possible on that page to make a check on which bank transfer option the customer has made?

I have set up 2 types of bank transfer and would like to show different messages to them?

Kind regards
Thomas

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #327179

Hi,

You should be able to based on their id:

if($this->order->order_payment_id == XX) {
 // display something for the bank transfer payment method with the id XX
} else {
 // display something for the other bank transfer payment methods
}

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 11 months ago #327201

Perfect!

Thank you so much :-)

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

Time to create page: 0.069 seconds
Powered by Kunena Forum