How to change template layout for donation-complete page?

  • Dave
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 1 month ago #123420 by Dave
After a donation, the user is directed to the donation-complete page which has the same template (layout) as the donation page.

The donation-complete page displays the thanksmessage, and it also displays the same footer modules as my donation page.

My goal is to have a donation-complete page that uses a different template style or a different url, so that it does not display the same footer modules from my donation page. I want the thanksmessage, but I don't want the footer modules.

How can I change the code so that the donation-complete page uses a different template style than the donation page?
Or, change the code so that the redirect is to a different (hidden) menu item that uses a different template?

I think the file I need to change is /components/com_jdonation/view/complete/html.php L68.
I have tried several modifications, but no success.

Can you help?

Thanks!

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

More
5 years 1 month ago #123432 by Mr. Dam
Hi,
In file: root -> components -> com_jdonation -> view -> complete -> html.php
You can add code
$app = JFactory::getApplication();
$app->redirect(URL);

URL is the link of hidden menu, this when user is redirected to Donation complete page, he (she) will be redirected to the hidden Menu link also
Dam

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

  • Dave
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 1 month ago - 5 years 1 month ago #123479 by Dave
This problem is not solved.

Dam's reply needs a correction: you must use single quotes around URL, or the redirection will not work. Corrected:
$app = JFactory::getApplication();
$app->redirect('URL');

Also, the URL must include http or https, like this:
$app = JFactory::getApplication();
$app->redirect(' www.sitename/index.php/my_hidden_menu_item_name ');

Also, the new code must contain a reference to the thanksmessage, or else the message will not display on the redirected page. Like this:
$app = JFactory::getApplication();
$app->redirect(' www.sitename/index.php/my_hidden_menu_item_name ', $message);

What this does:
It changes the post-donation landing page with Thank You message
from a child of the donation page
to a new independent page.

Why you would want to do this:
If your footer (or other blocks) on the Donation page contain essential content for the Donation page, this content will also be displayed on the post-donation Thank You page, because the post-donation landing page is a child of the Donation page and therefore uses the same layout as the Donation page.
If you don't want the essential content of the Donation page to redundantly display on the post-donation landing page, then you can make the code change described above to redirect the user to a new independent landing page after donation.

PROBLEM:
The code change described above uses the redirect function, which invokes the enqueueMessage function, which unavoidably converts the format of the Thank You message into a 'system message' format that must be displayed in standard bootstrap green, blue, yellow, or red styling for system messages.

CONCLUSION:
The redirect suggestion is not a good solution for displaying the JD post-donation Thank You message on a new independent page, because redirect unavoidably changes the format of the message from a pleasing "matching style article" into a "dismiss by clicking, ugly colors, system message".

The original problem still exists: how to use a layout for the post-donation Thank You page that is different than the layout for the Donation page.

Thx.
Last edit: 5 years 1 month ago by Dave. Reason: fix

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

More
5 years 1 month ago #123485 by Mr. Dam
If you want to use different layout in Thank you page, you can create override layout for layout:
root -> components -> com_jdonation -> view -> complete -> tmpl -> default.php

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

  • Dave
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 1 month ago #123492 by Dave
On my donation page, two content items are assigned to the footer-1 position.

On the donation-complete page, I want only one content item assigned to footer-1 position.

Therefore the layout override approach won't work for me. I need the footer on both pages, but I need different footer content on each page.

My solution must be at the menu item level. I need to assign different modules to display in footer according to different menu items.

Therefore I need the donation-complete menu item to be unrelated to the donation menu item.

And I need a better way to do it than redirect / enqueueMessage.

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

Moderators: Mr. DamDũng Nguyễn Việt