Redirect to custom thank you page from Contact form

  • Posts: 81
  • Thank you received: 2
7 years 7 months ago #266097

-- 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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266099

Hi,

1. You'll want to change the 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:
<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.

  • Posts: 81
  • Thank you received: 2
7 years 7 months ago #266164

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266172

Hi,

You want to change the code hikashop_currentURL() to:

'http://mywebsite.com/my/article/url'

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

  • Posts: 81
  • Thank you received: 2
7 years 7 months ago #266238

Great! Thanks very much.

I've altered the code as below :

<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?

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266241

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.

  • Posts: 81
  • Thank you received: 2
7 years 7 months ago #266305

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

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266316

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

<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.

  • Posts: 81
  • Thank you received: 2
7 years 7 months ago #266331

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

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266427

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.

  • Posts: 81
  • Thank you received: 2
7 years 7 months ago #266447

That did the trick!
Thanks Nicolas.

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

Best regards
David

Last edit: 7 years 7 months ago by iamalive.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 7 months ago #266494

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.

  • Posts: 81
  • Thank you received: 2
7 years 7 months ago #266535

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.

  • Posts: 115
  • Thank you received: 0
7 years 5 months ago #270487

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="<?php echo $css_button; ?>"><?php

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 5 months ago #270490

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.

  • Posts: 115
  • Thank you received: 0
7 years 5 months ago #270551

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 5 months ago #270558

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:

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.

  • Posts: 115
  • Thank you received: 0
7 years 5 months ago #270606

Ah! clear, thanks!

Regards,
Joyce

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

Time to create page: 0.109 seconds
Powered by Kunena Forum