Author Topic: Redirect Joomla's registration page to VirtueMart  (Read 193 times)

Venci Gentchev

  • Jr. Member
  • **
  • Posts: 126
    • Bulgarian Computer Store
Redirect Joomla's registration page to VirtueMart
« on: August 10, 2017, 20:24:15 pm »
Hello everyone,

I use the registration form of Virtuemart and I do not have a published Joomla registration menu.
However, if I add the following to the URL address: "index.php?option=com_users&view=registration", opens the Joomla registration form. In my opinion, this means that it will be indexed by Google.
What I have decided to do is to modify the default.php file in the following way:
mysite/templates/theme/html/com_users/registration/default.php
Code: [Select]
defined('_JEXEC') or die;
$app = JFactory::getApplication('site');
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=user', false));

So everything works the way I want, but my question is whether there is no setup in the administration for this purpose that I miss?
Also, can I expect future problems?
No pain, no gain, no site!

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9175
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Redirect Joomla's registration page to VirtueMart
« Reply #1 on: August 10, 2017, 20:46:25 pm »
$app = JFactory::getApplication('site');

remove the site. It has no effect, once the app is setup you get always the same app (creates a lot problems). But your idea should work. Expect always problems, when you mod the core, but it should work.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Venci Gentchev

  • Jr. Member
  • **
  • Posts: 126
    • Bulgarian Computer Store
Re: Redirect Joomla's registration page to VirtueMart
« Reply #2 on: August 10, 2017, 21:05:02 pm »
Thank you for the advice, my friend. I removed the "site" from the code.
Well, template makers have overwritten the file anyway to fit the design. So there was a risk before my intervention. The important thing is that the change is not hardcoded.

No pain, no gain, no site!

rage76

  • Jr. Member
  • **
  • Posts: 118
Re: Redirect Joomla's registration page to VirtueMart
« Reply #3 on: August 11, 2017, 17:28:20 pm »
Dear Venci

I am glad you brought this up. I too use VM registration and have the same issue.

I checked the "default.php" in my template  but the code is different.

<form id="member-registration" action="<?php echo JRoute::_('index.php?option=com_users&task=registration.register'); ?>" method="post" class="form-validate" enctype="multipart/form-data">

How do you suggest I take care of this?

Venci Gentchev

  • Jr. Member
  • **
  • Posts: 126
    • Bulgarian Computer Store
Re: Redirect Joomla's registration page to VirtueMart
« Reply #4 on: August 11, 2017, 23:27:57 pm »
First make sure you overwrite a file in:
templates/YourTheme/html/com_users/registration/default.php

You need to delete everything from the file and leave only the following:
Code: [Select]
<?php
defined
('_JEXEC') or die;
$app JFactory::getApplication();
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=user'false));
?>
No pain, no gain, no site!

rage76

  • Jr. Member
  • **
  • Posts: 118
Re: Redirect Joomla's registration page to VirtueMart
« Reply #5 on: August 12, 2017, 07:51:34 am »
You are telling me to technically create a new file. But won't that cause other problems/issues? Since, the already existing file is a template override and must've been added for a reason.

There is a lot of code in this file and I am not a coder so I donot know what that does !!

Venci Gentchev

  • Jr. Member
  • **
  • Posts: 126
    • Bulgarian Computer Store
Re: Redirect Joomla's registration page to VirtueMart
« Reply #6 on: August 12, 2017, 08:29:05 am »
I do not know what to say.  :)
You decide whether to change something or not. The file has been overwritten by template makers for some reason - changing styles or otherwise.
Perhaps if I had told you to add the lines at the top, you would have been more relaxed.  :)
This file is only used for Joomla registration. Once I only use Virtualmart registration, I do not see any reason for someone to open a Joomla registration page.

But won't that cause other problems/issues?
Of course. If you decide to use Joomla's registration, you will not be able to. When you change something, always expect problems.  ;)
Additionally, if Joomla changes anything in the registration code, it will not work because templates manufacturers have already overwritten a file. By the way, this is one of the main reasons that causes problems with Virtuemart, but many people forget or do not know how to test the problem.

This is the most harmless solution for me. If anyone wants, he can challenge it.
Of course, if you're worried about this, and if you want to achieve the described effect, you can install one of the many plugins that do that.
No pain, no gain, no site!

rage76

  • Jr. Member
  • **
  • Posts: 118
Re: Redirect Joomla's registration page to VirtueMart
« Reply #7 on: August 12, 2017, 11:04:13 am »
hmm...I think I will give it a try(on test site). I am already using the plugin to redirect to VM registration but that has not disabled the default URL.

Thanks.


rage76

  • Jr. Member
  • **
  • Posts: 118
Re: Redirect Joomla's registration page to VirtueMart
« Reply #8 on: August 13, 2017, 09:57:43 am »
ok, I tried this on my local host and it worked without any issues and took me to "/index.php/signup" but on the live site; when I type the url

"/index.php?option=com_users&view=registration", it takes me to "/index.php/login" with a message "Please login first"

Any idea why?