Skip to main content

Redirect to custom thank you page from Contact form

More
9 years 6 months ago #266097 by iamalive
-- url of the page with the problem -- : transmetra.imaufbau.ch/Produkt/datenlogger-145
-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.0

Hi
My client would like the contact form to redirect to a thank you page, instead of the current system message.
Can you tell me how I do that, please?

Also Is it possible to have the "OK" and "Cancel" buttons next to the captcha rather than at the top of the form? And presumably The OK button can have a different text, eg. "Send"?

Thanks for your help
Regards
David

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

More
9 years 5 months ago #266099 by nicolas
Hi,

1. You'll want to change the code:
Code:
<a href="<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid); ?>" class="<?php echo $css_button; ?>"><?php
to:
Code:
<a href="<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid).'?return_url='.urlencode(hikashop_currentURL()); ?>" class="<?php echo $css_button; ?>"><?php
in the file "show_default" via the menu Display>Views.

2. For the other changes, you can edit the file "contact" of the view "product" via the menu Display>Views and apply the changes you want to the view. It's just some copy/paste of the code so it should be easy.
The following user(s) said Thank You: iamalive

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

More
9 years 5 months ago #266164 by iamalive
Hi Nicolas

Thanks for your input.

I've changed the code, but am unsure where and how to place the link to the article.

Sadly, I am not a programmer :-(

Regards
David

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

More
9 years 5 months ago #266172 by nicolas
Hi,

You want to change the code hikashop_currentURL() to:
Code:
'http://mywebsite.com/my/article/url'

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

More
9 years 5 months ago #266238 by iamalive
Great! Thanks very much.

I've altered the code as below :
Code:
<a href="<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid).'?return_url='.urlencode('https://transmetra.imaufbau.ch/danke'); ?>" class="<?php echo $css_button; ?>"><?php echo JText::_('CONTACT_US_FOR_INFO'); ?></a>

But sadly, it still doesn't lead to the thank you page, just shows the system message :-(

What have I done wrong?

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

More
9 years 5 months ago #266241 by nicolas
Hi,

That sounds good though.
Can you make sure that you're editing the view file for your frontend template and not another one ?

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

More
9 years 5 months ago #266305 by iamalive
I am using the file you mentioned above

file "show_default" via the menu Display>Views


I've made a screenshot of it.

I'm sure I've got the right file.

Regards
David

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

More
9 years 5 months ago #266316 by nicolas
Hi,

I do see that the change is done on your website.
However, while the return_url parameter is added to the URL of the contact button, it's missing in the contact form on your website:
monosnap.com/file/69n73ZiRshaTma60ixjnONnph8jNbF
As if the line
Code:
<input type="hidden" name="redirect_url" value="<?php $redirect_url = JRequest::getString('redirect_url', ''); echo $this->escape($redirect_url); ?>" />
had been modified in the file "contact of the view "product".
Could you check on that ?

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

More
9 years 5 months ago #266331 by iamalive
Hi Nicolas

I have modified that file "contact", but only to move the buttons from the top to the bottom and to rename them.

The line you quote is still the same.

I'm enclosing a copy of the modified contact form view as a text file for you to check.

Regards
David

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

More
9 years 5 months ago #266427 by nicolas
Hi,

I know. In the code I gave you, return_url should be changed by redirect_url
The following user(s) said Thank You: iamalive

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

More
9 years 5 months ago - 9 years 5 months ago #266447 by iamalive
That did the trick!
Thanks Nicolas.

Anyway to turn off the system message, which is now supurflous to requirements?

Best regards
David
Last edit: 9 years 5 months ago by iamalive.

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

More
9 years 5 months ago #266494 by Jerome
Hello,

One solution would be to edit the translation and leave a empty string instead.
www.hikashop.com/download/languages.html#modify

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.
The following user(s) said Thank You: iamalive

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

More
9 years 5 months ago #266535 by iamalive
Good idea - I've created the overrides in that way.

Thanks for all your help, Nicolas.

Best regards
David

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

More
9 years 4 months ago #270487 by joycehoveling
Hello Nicolas,

I am having the same issue as David had; the redirect page after submitting a message on the contact form is not working. I've put the code as mentioned above in the show_default view file. In my case:

<a href="<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid).'?redirect_url='.urlencode(' www.tweedehandjes.com/bedankt-voor-je-bericht.html '); ?>" class="">
Could you see what's wrong?
Also; after the customer submits a comment, I'd like to get an email notification in my admin email. How can I set this?

Thanks in advance,
regards,
Joyce
www.tweedehandjes.com/klantenservice.html

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

More
9 years 3 months ago #270490 by nicolas
Hi,

1. This only works when you use the contact button from the product details page to access the contact form.
If you access the contact form directly, you don't have the redirect_url parameter in the URL.
So in that case, you would have to create a menu item of the type external URL and enter the full URL to access the contact form with the url_encoded URL in the redirect_url parameter of the external URL.

2. Enter your email address in the setting "Send email for new comments" in the HikaShop configuration.

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

More
9 years 3 months ago #270551 by joycehoveling
Hi Nicolas,

I am so sorry but I do not understand... I have created the external url of the page where the customer should be redirected to after submitting the contact form:
www.tweedehandjes.com/bedankt-voor-je-bericht
Could you please help me> What shoud be the correct code and where do i need the put the code?

Thanks in advance
Regards,
Joyce

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

More
9 years 3 months ago #270558 by nicolas
Hi,

No, that's not it.
There is no code to put anywhere.
You just need to put the contact form URL as external URL.
For example:
Code:
http://www.tweedehandjes.com/index.php?option=com_hikashop&ctrl=product&task=contact&redirect_url=https%3A%2F%2Fwww.tweedehandjes.com%2Fbedankt-voor-je-bericht.html
That way, when you click on the link of that menu item, it will direct you to the contact page of HikaShop with the redirect_url parameter which will be taken into account by HikaShop after the email is sent.

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

More
9 years 3 months ago #270606 by joycehoveling
Ah! clear, thanks!

Regards,
Joyce

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

Time to create page: 0.331 seconds
Powered by Kunena Forum