- Posts: 303
- Thank you received: 18
Custom HTML on PayPal Thank You Page
- mojooutdoors-holden
-
Topic Author
- Offline
Less
More
8 years 2 days ago #298503
by mojooutdoors-holden
Custom HTML on PayPal Thank You Page was created by mojooutdoors-holden
-- HikaShop version -- : 3.5.0
-- Joomla version -- : 3.8.12
-- PHP version -- : 7.1
How would I add custom html to the PayPal thank you page (i.e., "/checkout/after_end.php")? I've looked in the plugin and see where this can be changed, but my website is defaulting to displaying the info as a system message.
A few of the other payment plugins have their own dedicated thank you message that you can change inside the plugin files (.e.g, First Data). Ideally, I would like to do this without another redirect to a custom thank you page.
-- Joomla version -- : 3.8.12
-- PHP version -- : 7.1
How would I add custom html to the PayPal thank you page (i.e., "/checkout/after_end.php")? I've looked in the plugin and see where this can be changed, but my website is defaulting to displaying the info as a system message.
Code:
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );
if(!empty($this->url))
$app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$this->url));
A few of the other payment plugins have their own dedicated thank you message that you can change inside the plugin files (.e.g, First Data). Ideally, I would like to do this without another redirect to a custom thank you page.
Please Log in or Create an account to join the conversation.
8 years 2 days ago #298512
by nicolas
Replied by nicolas on topic Custom HTML on PayPal Thank You Page
Hi,
PayPal also has its own end file: plugins/hikashoppayment/paypal/paypal_end.php
So you can add your HTML there.
PayPal also has its own end file: plugins/hikashoppayment/paypal/paypal_end.php
So you can add your HTML there.
Please Log in or Create an account to join the conversation.
- mojooutdoors-holden
-
Topic Author
- Offline
Less
More
- Posts: 303
- Thank you received: 18
8 years 1 day ago #298550
by mojooutdoors-holden
Replied by mojooutdoors-holden on topic Custom HTML on PayPal Thank You Page
I found that file and figured it would need to go in there. However, I'm not sure where it needs to be added? I couldn't determine which block corresponds to the "thank you" message that is currently displaying at the end of checkout?
Code:
<?php
/**
* @package HikaShop for Joomla!
* @version 3.5.0
* @author hikashop.com
* @copyright (C) 2010-2018 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_paypal_end" id="hikashop_paypal_end">
<span id="hikashop_paypal_end_message" class="hikashop_paypal_end_message">
<?php echo JText::sprintf('PLEASE_WAIT_BEFORE_REDIRECTION_TO_X', $this->payment_name).'<br/><span id="hikashop_paypal_button_message">'. JText::_('CLICK_ON_BUTTON_IF_NOT_REDIRECTED').'</span>';?>
</span>
<span id="hikashop_paypal_end_spinner" class="hikashop_paypal_end_spinner hikashop_checkout_end_spinner">
</span>
<br/>
<form id="hikashop_paypal_form" name="hikashop_paypal_form" action="<?php echo $this->payment_params->url;?>" method="post">
<div id="hikashop_paypal_end_image" class="hikashop_paypal_end_image">
<input id="hikashop_paypal_button" type="submit" class="btn btn-primary" value="<?php echo JText::_('PAY_NOW');?>" name="" alt="<?php echo JText::_('PAY_NOW');?>" onclick="document.getElementById('hikashop_paypal_form').submit(); return false;"/>
</div>
<?php
foreach($this->vars as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars((string)$value).'" />';
}
hikaInput::get()->set('noform',1); ?>
</form>
<script type="text/javascript">
<!--
function isIframe(){
try{
return window.self !== window.top;
}catch(e){
return false;
}
}
if(isIframe()){
document.getElementById('hikashop_paypal_form').target = '_blank';
}
document.getElementById('hikashop_paypal_form').submit();
//-->
</script>
<!--[if IE]>
<script type="text/javascript">
document.getElementById('hikashop_paypal_button').style.display = 'none';
document.getElementById('hikashop_paypal_button_message').innerHTML = '';
</script>
<![endif]-->
</div>
Please Log in or Create an account to join the conversation.
8 years 1 day ago #298557
by nicolas
Replied by nicolas on topic Custom HTML on PayPal Thank You Page
Hi,
Sorry, I read your message too rapidly.
The paypal_end.php file is for the end of the chekout where the customer is redirected to PayPal, not for the page after the payment.
For the page after the payment, it's indeed the after_end view file.
There, you can enter your HTML before the <?php tag. Note that it will appear for all the payment plugins that redirect back the customer to the website and for which you didn't specify a return URL.
If you want to display things only for some payment methods, you can use some PHP check on $this->order->order_payment_method
Sorry, I read your message too rapidly.
The paypal_end.php file is for the end of the chekout where the customer is redirected to PayPal, not for the page after the payment.
For the page after the payment, it's indeed the after_end view file.
There, you can enter your HTML before the <?php tag. Note that it will appear for all the payment plugins that redirect back the customer to the website and for which you didn't specify a return URL.
If you want to display things only for some payment methods, you can use some PHP check on $this->order->order_payment_method
Please Log in or Create an account to join the conversation.
- mojooutdoors-holden
-
Topic Author
- Offline
Less
More
- Posts: 303
- Thank you received: 18
8 years 23 hours ago #298599
by mojooutdoors-holden
Replied by mojooutdoors-holden on topic Custom HTML on PayPal Thank You Page
So would this addition override the system message that is displaying? Currently, I have:
My guess is to replace this part:
with my custom code?
Code:
<?php
/**
* @package HikaShop for Joomla!
* @version 3.5.0
* @author hikashop.com
* @copyright (C) 2010-2018 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://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(!empty($this->url))
$app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$this->url));
My guess is to replace this part:
Code:
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );
if(!empty($this->url))
$app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$this->url));
with my custom code?
Please Log in or Create an account to join the conversation.
8 years 12 hours ago #298605
by nicolas
Replied by nicolas on topic Custom HTML on PayPal Thank You Page
Hi,
If you don't want these default texts to be displayed anymore, then yes, you can remove that code and add your code instead.
If you don't want these default texts to be displayed anymore, then yes, you can remove that code and add your code instead.
The following user(s) said Thank You: mojooutdoors-holden
Please Log in or Create an account to join the conversation.
- mojooutdoors-holden
-
Topic Author
- Offline
Less
More
- Posts: 303
- Thank you received: 18
7 years 11 months ago #299373
by mojooutdoors-holden
Replied by mojooutdoors-holden on topic Custom HTML on PayPal Thank You Page
Thanks Nicolas!
Please Log in or Create an account to join the conversation.
Time to create page: 0.170 seconds