Problem with live_site and subdomains

alterna 11 Feb, 2010
Well I need to have the live_site set in my config file for another component but when enabled, Chronoform will always use the value as the action url and not the correct subdomain url which is used at the time.

then I always get a 301 redirection because from subdomains the form is always sent to the live_site domain.

With this I cannot use forms to order from my mobile and facebook subdomains. We checked with Bixie (vm chronoform) this behavior of chronoform

I have erased the live_site value for now to allow a correct working of the shop but I need a workaround for this.

Could you help ?
alterna 12 Feb, 2010
Well Bixie advised to change line 189 in \components\com_chronocontact\libraries\chronoform.php

$CF_PATH = ($mainframe->isSite()) ? JURI::Base() : $mainframe->getSiteURL();

$CF_PATH = JURI::Base() ;

but it does not seem to be enough. When live_site is set, this does not work

does someone has an idea ?
nml375 12 Feb, 2010
Hi alterna,
You could try setting the Submit URL (form edit->general tab) to the proper URL; copy the URL from the displayed form, and edit the host-part to point to the sub-domain.

That said, as far as I've read, the live_site setting is a legacy from J1.0, and components should not depend on it, but rather use the JURI class for URL's.

Also, the suggestion regarding the $CF_PATH;
The test $mainframe->isSite() simply tests if the current application is the site, or the admin backend.
The getSiteURL() method is only defined within the JAdministrator version of the JApplication, not the JSite, and simply returns JURI::root() - which should be the path to the site.
Making this change would not alter the value of $CF_PATH for the site, but would affect the admin page (though I don't think the admin part actually makes use of $CF_PATH).

alterna 12 Feb, 2010

Hi alterna,
You could try setting the Submit URL (form edit->general tab) to the proper URL; copy the URL from the displayed form, and edit the host-part to point to the sub-domain.

No because I need my users to be able to buy from the mainwebsite and from the subdomains for mobile and facebook, so I cannot change the submit URL

It has to be corrected within chronoform so that the correct URL is always used whatever subdomain or domain is used

But I dont know how...
nml375 12 Feb, 2010
Hi alterna,
Unfortunately, both JURI::Base() and JURI::Root() will honor the live_site setting if present.

At best, you could try creating a new JURI object and use the toString() method, along with some creative scripting (taken from the JURI::Base() method):
$cf_uri =& JURI::getInstance();
$cf_host = $cf_uri->toString(array('scheme','host','port'));
if (strpos(php_sapi_name(), 'cgi') !== false && !empty($_SERVER['REQUEST_URI'])) {
  //Apache CGI
  $CF_PATH = $cf_host . rtrim(dirname(str_replace(array('"', '<', '>', "'"), '', $_SERVER["PHP_SELF"])), '/\\');
} else {
  $CF_PATH = $cf_host . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');

GreyHead 12 Feb, 2010
Hi alterna,

I didn't know about the Bixie plugin for VirtueMart, it looks useful.

It sounds as though both ChronoForms and the Bixie plugin have the correct Joomla behaviour and the problem is with the other extension that you are using. Am I understanding that corrrectly? Have you taken this up with the developer there?

alterna 12 Feb, 2010
Well the live_site problem will have to be solved also but I need to solve the problem of subdomains prior.

I have removed the value in the live_site config but am still unable to have a correct working with my chronoform forms from any of my subdomains with Bixie module.

My form is written, then sent, then properly recorded with chronoform in the right database, but then I have a 301 error and there is no way for the info to be passed to virtuemart cart.

The problem comes from chronoform/bixie with subdomains because with a standard product (no form) and subdomains all the buying process is ok !
nml375 13 Feb, 2010
Sorry if I seem ignorant, but isn't the subdomain problem the live_site setting?
In essence, the live_site setting is (was) used to tell Joomla the URL to the site. If it is not set, Joomla will try to figure this out by examining the $_SERVER array - which should provide details as to which host.domain was used to access the document.

If leaving the live_site setting unset, still results in ChronoForms sending the form to a different hostname than the one used to show the form, then it would seem you have a very exotic setup. Unless you explicitly enter a Submit URL for the form, ChronoForms will simply ask Joomla for the URL of the site (using JURL::Base()).

I don't have access to the Bixie vm module, but from what I've been able to see of their demo, they add a redirect from the product form to a form named 'bix_ajax_return'. However, this would be sent to a hidden iframe on the page, and should not affect the behaviour of the rest of the page.
That is, unless it is this redirect that's causing you all these problems?

papile 02 Jul, 2010
Hi Frederik,

sorry for pushing this thread. I was wondering if you could give me more infos about how to use the

within the JURI object.
It's not working on my side.

This topic is locked and no more replies can be posted.