Thank you, I ended up just modifying the template_default settings which got me to where I wanted to be for the most part. I am pretty much done, just looking to finish up some UI finishing touches, and I did find some code that looks like it could be of great help for those looking to create an automatic return to their original page during a transition during checkout, however for the life of me I cannot seem to interpret how to implement it correctly. My formatting is correct, I am just not understanding how this code works. I feel there is a step missing between inserting this in my header_php.php file in checkout_process. Like setting the $_SESSION['been_here'] value on the originating website perhaps?
I am wanting my header_php.php file to be able to use an if statement to determine which code to process, however the only variables or values I can seem to easily utilize are SERVER_NAME or template_dir, both of which do not distinguish between the same website (one version has &template_dir attached to the url which causes the template_default files to load, but $template_dir is still listed as that of which website the url is associated with in the config_sites file, so putting ```
<? php if ($template_dir =='website3') {
```isn't going to work in this instance.) Perhaps there is a simpler way to go about this, although I did not find anything on calling specific modules/pages functions outside of php if statements in the file itself. If there could be a way to set different modules/pages to be called per template (including a template default one, that would be the easiest solution I think. Or a way to just define a different $template_dir to the default_template system.)
Surely there is a solution that doesn't require me to actually learn to code :shocking:
```
if (isset($_SESSION['been_here'])) {
$server_name=$_SERVER['SERVER_NAME'];
$len=(strlen($server_name));
$domain=substr($server_name,strpos($server_name,'.'),$len);
$origin='www'.$domain;
if ($server_name != $origin) {
zen_redirect('https://www'.$domain.'/index.php?main_page=checkout_process');
$_SESSION['been_here']=1;
}
}
```
> Hi again,
>
> OK I managed to get mine the way I wanted. Tell me if it's what you wanted to do, or if anyone else is interested in this.
>
> Motivation: My CC charges me a flat monthly fee (+ percentage of course) for every https:// site I ask him to approve. Since I have several stores, I would have to, pay him extra for each one.
>
> Note: All my domains are sub-domains of the main domain. i.e. <https://www.domain.tld>, store1.domain.tld, store2.domain.tld, etc.
>
> Solution: Added some lines of code to checkout process to see if the transaction is originating from the main site. If not, remember which sub-domain it came from -> switch to the main site -> process -> switch back to the sub-domain.
>
> If anyone is interested, it's generic code provided you use the main domain/sub-domain approach. I wouldn't want to do it any other way, since it would be a security risk if it worked for just any domain.
>
> Here's the doctored header_php file for checkout_process. Comments welcome!
>
> <?php
>
> ```
// Added by Dov Zamir on 6/4/2009 - saves the original sub-domain and goes to the main site for processing
if (isset($_SESSION['been_here'])) {
$server_name=$_SERVER['SERVER_NAME'];
$len=(strlen($server_name));
$domain=substr($server_name,strpos($server_name,'.'),$len);
$origin='www'.$domain;
if ($server_name != $origin) {
zen_redirect('https://www'.$domain.'/index.php?main_page=checkout_process');
$_SESSION['been_here']=1;
}
}
// End of addition
```
>
> // This should be first line of the script:
> $zco_notifier->notify('NOTIFY_HEADER_START_CHECKOUT_PROCESS');
>
> require(DIR_WS_MODULES . zen_get_module_directory('checkout_process.php'));
>
> // load the after_process function from the payment modules
>
> $payment_modules->after_process();
>
> $_SESSION['cart']->reset(true);
>
> // unregister session variables used during checkout
> unset($_SESSION['sendto']);
> unset($_SESSION['billto']);
> unset($_SESSION['shipping']);
> unset($_SESSION['payment']);
> unset($_SESSION['comments']);
>
> $order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM
> // This should be before the zen_redirect:
>
> $zco_notifier->notify('NOTIFY_HEADER_END_CHECKOUT_PROCESS');
>
> ```
// Changed by Dov Zamir - 6/4/2009 - Return to original site after processing.
if (isset($_SESSION['been_here'])) {
unset($_SESSION['been_here']);
zen_redirect('https://'.$server_name.'/index.php?main_page=checkout_success');
}
else {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')); }
```
>
>
>
>
> require(DIR_WS_INCLUDES . 'application_bottom.php');
>
> ?>