Redirect After Payment Complete

  • Posts: 12
  • Thank you received: 1
8 years 6 months ago #240067

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.4.43
-- Error-message(debug-mod must be tuned on) -- : Call to a member function redirect() on a non-object
Open: /xxxx/xxxx/public_html/templates/g5_hydrogen/html/com_hikashop/checkout/end.php
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?>html)){
$app->redirect(' www.mywebsitename.com/registration-form ');
echo JText::_('THANK_YOU_FOR_PURCHASE');
}else{
echo $this->html;
}
$this->nextButton = false;

I was searching and now reference this post from a couple years ago.
Redirect After Payment

While following the instructions, like the OP, I didn't succeed in changing the after_end modification.
I then modified the 'end' file and now receive the error message:

Call to a member function redirect() on a non-object


1st: If i enter the url directly AND the user is logged in, the form/url displays correctly without error.

Here are my modifications that I tried:
after_end Did not redirect. Using g5_hydrogen template.
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.6.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 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->redirect('http://www.gravitydancecenter.com/registration-form');
//$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );

Then I changed the end file as noted on the referenced link. After making this modification is when I get an error message.
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.6.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->html)){
	echo JText::_('THANK_YOU_FOR_PURCHASE');
}else{
	echo $this->html;
}
$app->redirect('http://www.mywebsitename.com/registration-form');
$this->nextButton = false;

If I place the redirect in the if statement where the Thank You message is, I get this error:

Call to a member function redirect() on a non-object


end file g5_hydrogen template
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.6.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->html)){
	$app->redirect('http://www.mywebsitename.com/registration-form');
	echo JText::_('THANK_YOU_FOR_PURCHASE');
}else{
	echo $this->html;
}
$this->nextButton = false;

Thank you,
Kelso

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
8 years 6 months ago #240103

Hi,

If you delete the definition of the variable "$app" ; the error you got is logical.
The official "after_end" view content is :

<?php
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );

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: 12
  • Thank you received: 1
8 years 6 months ago #240142

Jerome wrote: If you delete the definition of the variable "$app" ; the error you got is logical.
The official "after_end" view content is :

<?php
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );


I see.... but, I didn't. I didn't delete the assignment . It is still there as you can see in my original message:
It's right there in the app_end (first section of code).
$app = JFactory::getApplication();

Regards,
Kelso

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
8 years 6 months ago #240147

Hi,

Please look at your PHP error message, what content you pasted for your different "versions" of the view and my message.
There is no more that assignations in your views ; otherwise you won't have the error message.

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.

Time to create page: 0.062 seconds
Powered by Kunena Forum