Jump to content

[solved] Problems with template export/import


psy
 Share

Recommended Posts

I'm combining two PW sites into one, Site A into Site B.

At each step, I did it bit by bit as the 'all at once' approach failed.
 
First, I exported all the fields from Site A and imported into Site B. Any field types not supported by import/export, eg FieldtypeOptions I manually recreated. All good.

Next I exported all the templates from Site A and imported them into Site B and copied across their associated template files. All good.

Finally I exported the pages I needed from Site A into Site B - again, bit by bit to ensure it all went smoothly.

From the admin side, it all looked and worked perfectly.

Front end was a totally different story. All existing pages in Site B worked as expected. NONE of the pages imported from Site A displayed. They all ended in a redirect loop with no errors in the PW logs or Tracy Debugger.

After some trial-and-error, I finally got it working with:

- create a new template in Site B admin with no associated template file and just a title field
- import the fields from the imported Site A template into the newly created template (both on Site B)
- copy the Site A php template file into a new file that matched the new PW Site B template name and save in Site B site/templates

I can deal with the above workaround. Just curious to know if I did something wrong or if the template import/export feature is problematic?

 

### Solution:

While the export/import was a slow process, turned out the front end redirecting issue was unrelated. For reasons unknown, all templates marked as HTTPS only were the ones redirecting, ie all templates from Site A. Finally solved it by changing the $config->https to true in site/config.php

Now the pages display correctly as https whether the template forces the issue or not.

 

Edited by psy
Solved problem
Link to comment
Share on other sites

Which PW-version are Site A & Site B?

I have used fields & templates export & import a lot, but without ex-/importing pages.

I don't have had any issues so far with the templates ex-/import feature. Only if there are templates in family-children relation that need both imported together in a new site, it needs multiple import steps, as in the first run, the family settings can not be set because wether parent nor childrens are known in the system.

  • Like 1
Link to comment
Share on other sites

I'm not really supporting it anymore because there are too many new fieldtypes to keep up with, but I still find this https://github.com/adrianbj/ProcessMigrator much easier and more reliable than the built in approach. Be sure to use the backup option because I know there are a few situations where it can do some weird things.

  • Like 1
Link to comment
Share on other sites

7 hours ago, horst said:

Which PW-version are Site A & Site B?

I have used fields & templates export & import a lot, but without ex-/importing pages.

I don't have had any issues so far with the templates ex-/import feature. Only if there are templates in family-children relation that need both imported together in a new site, it needs multiple import steps, as in the first run, the family settings can not be set because wether parent nor childrens are known in the system.

@horst Site A is 3.0.107 and Site B is 3.0.110, and yes, I encountered the parent/child issue which is why I did it step by step.

 

@adrian yes, the templates do have multiple field types, including some new ones including fieldset page. Maybe that's where the problem lay? Will take a look at ProcessMigrator next time. Thanks for the tip

  • Like 1
Link to comment
Share on other sites

1 hour ago, psy said:

the templates do have multiple field types, including some new ones including fieldset page.

I think Migrator would need to be updated to support these - it might not be too hard because of the similarity to repeaters.

  • Like 1
Link to comment
Share on other sites

Thanks for all your suggestions. I've actually narrowed down the cause however don't know how to fix...

It's related to https. Both site htaccess files were set to https only. Site A templates were also set to https only. Site B templates defaulted to http or https. Site B was an older site upgraded from 3.0.25 to 3.0.110.

I can now get the imported fields/templates/pages in Site B working by setting the templates to http or https. This however raises another issue, ie all assets - images, forms, etc - are served as http and throw errors, and in the case of forms, don't show on the front end at all.

Will do more digging around the forums and if you know how to resolve, please do share

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...